mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30:22 +00:00
chore: added NSFW
This commit is contained in:
parent
f36ca3f501
commit
66473706f6
24
components/NSFW.tsx
Normal file
24
components/NSFW.tsx
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import dynamic from 'next/dynamic'
|
||||||
|
|
||||||
|
const Button = dynamic(() => import('@components/Button'))
|
||||||
|
const Container = dynamic(() => import('@components/Container'))
|
||||||
|
|
||||||
|
const NSFW = ({ onClick }:NSFWProps): JSX.Element => {
|
||||||
|
return <Container>
|
||||||
|
<div className='flex items-center h-screen select-none'>
|
||||||
|
<div className='px-10'>
|
||||||
|
<h1 className='text-2xl font-bold'>해당 컨텐츠는 만19세 이상의 성인만 열람할 수 있습니다.</h1>
|
||||||
|
<p className='text-lg mb-3'>계속하시겠습니까?</p>
|
||||||
|
<Button onClick={onClick}>
|
||||||
|
<i className='fas fa-arrow-right' /> 계속하기
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Container>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NSFWProps {
|
||||||
|
onClick(): void
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NSFW
|
||||||
@ -34,10 +34,12 @@ const Message = dynamic(() => import('@components/Message'))
|
|||||||
const Button = dynamic(() => import('@components/Button'))
|
const Button = dynamic(() => import('@components/Button'))
|
||||||
const TextArea = dynamic(() => import('@components/Form/TextArea'))
|
const TextArea = dynamic(() => import('@components/Form/TextArea'))
|
||||||
const Modal = dynamic(() => import('@components/Modal'))
|
const Modal = dynamic(() => import('@components/Modal'))
|
||||||
|
const NSFW = dynamic(() => import('@components/NSFW'))
|
||||||
|
|
||||||
const Bots: NextPage<BotsProps> = ({ data, date, user, theme, csrfToken }) => {
|
const Bots: NextPage<BotsProps> = ({ data, date, user, theme, csrfToken }) => {
|
||||||
const bg = checkBotFlag(data?.flags, 'trusted') && data?.banner
|
const bg = checkBotFlag(data?.flags, 'trusted') && data?.banner
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const [ nsfw, setNSFW ] = useState(localStorage.nsfw)
|
||||||
const [ reportModal, setReportModal ] = useState(false)
|
const [ reportModal, setReportModal ] = useState(false)
|
||||||
const [ reportRes, setReportRes ] = useState<ResponseProps<null>>(null)
|
const [ reportRes, setReportRes ] = useState<ResponseProps<null>>(null)
|
||||||
function toLogin() {
|
function toLogin() {
|
||||||
@ -63,7 +65,10 @@ const Bots: NextPage<BotsProps> = ({ data, date, user, theme, csrfToken }) => {
|
|||||||
<h2 className='text-lg font-black'>해당 봇은 관리자에 의해 삭제되었습니다.</h2>
|
<h2 className='text-lg font-black'>해당 봇은 관리자에 의해 삭제되었습니다.</h2>
|
||||||
</Message>
|
</Message>
|
||||||
</div>
|
</div>
|
||||||
: <>
|
: data.category.includes('NSFW') && !nsfw ? <NSFW onClick={() => {
|
||||||
|
localStorage.nsfw = true
|
||||||
|
setNSFW(true)
|
||||||
|
}} /> : <>
|
||||||
<div className='w-full pb-2'>
|
<div className='w-full pb-2'>
|
||||||
{
|
{
|
||||||
data.state === 'private' ? <Message type='info'>
|
data.state === 'private' ? <Message type='info'>
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { get } from '@utils/Query'
|
|||||||
import { BotList } from '@types'
|
import { BotList } from '@types'
|
||||||
import { botCategoryListArgumentSchema } from '@utils/Yup'
|
import { botCategoryListArgumentSchema } from '@utils/Yup'
|
||||||
import NotFound from 'pages/404'
|
import NotFound from 'pages/404'
|
||||||
|
import { useState } from 'react'
|
||||||
|
|
||||||
const Hero = dynamic(() => import('@components/Hero'))
|
const Hero = dynamic(() => import('@components/Hero'))
|
||||||
const Advertisement = dynamic(() => import('@components/Advertisement'))
|
const Advertisement = dynamic(() => import('@components/Advertisement'))
|
||||||
@ -14,14 +15,19 @@ const ResponsiveGrid = dynamic(() => import('@components/ResponsiveGrid'))
|
|||||||
const BotCard = dynamic(() => import('@components/BotCard'))
|
const BotCard = dynamic(() => import('@components/BotCard'))
|
||||||
const Container = dynamic(() => import('@components/Container'))
|
const Container = dynamic(() => import('@components/Container'))
|
||||||
const Paginator = dynamic(() => import('@components/Paginator'))
|
const Paginator = dynamic(() => import('@components/Paginator'))
|
||||||
|
const NSFW = dynamic(() => import('@components/NSFW'))
|
||||||
|
|
||||||
const Category: NextPage<CategoryProps> = ({ data, query }) => {
|
const Category: NextPage<CategoryProps> = ({ data, query }) => {
|
||||||
|
const [ nsfw, setNSFW ] = useState(localStorage.nsfw)
|
||||||
if(!data || data.data.length === 0 || data.totalPage < Number(query.page)) return <NotFound />
|
if(!data || data.data.length === 0 || data.totalPage < Number(query.page)) return <NotFound />
|
||||||
return <>
|
return <>
|
||||||
<Hero header={`${query.category} 카테고리 봇들`} description={`다양한 "${query.category}" 카테고리의 봇들을 만나보세요.`} />
|
<Hero header={`${query.category} 카테고리 봇들`} description={`다양한 "${query.category}" 카테고리의 봇들을 만나보세요.`} />
|
||||||
<SEO title={`${query.category} 카테고리 봇들`} description={`다양한 ${query.category} 카테고리의 봇들을 만나보세요.`} />
|
<SEO title={`${query.category} 카테고리 봇들`} description={`다양한 ${query.category} 카테고리의 봇들을 만나보세요.`} />
|
||||||
|
{
|
||||||
<Container>
|
query.category === 'NSFW' && !nsfw ? <NSFW onClick={() => {
|
||||||
|
localStorage.nsfw = true
|
||||||
|
setNSFW(true)
|
||||||
|
}} /> : <Container>
|
||||||
<Advertisement />
|
<Advertisement />
|
||||||
<ResponsiveGrid>
|
<ResponsiveGrid>
|
||||||
{
|
{
|
||||||
@ -31,6 +37,7 @@ const Category: NextPage<CategoryProps> = ({ data, query }) => {
|
|||||||
<Paginator totalPage={data.totalPage} currentPage={data.currentPage} pathname={`/categories/${query.category}`} />
|
<Paginator totalPage={data.totalPage} currentPage={data.currentPage} pathname={`/categories/${query.category}`} />
|
||||||
<Advertisement />
|
<Advertisement />
|
||||||
</Container>
|
</Container>
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user