mirror of
https://github.com/koreanbots/core.git
synced 2025-12-17 14:50:24 +00:00
* chore(deps): update dependency typescript to v4.2.4 (#314) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency core-js to v3.10.1 (#315) Co-authored-by: Renovate Bot <bot@renovateapp.com> * feat: camo images in bot desc * chore: added bot delete api * feat: delete button working * feat: added bot remove method * chore: added csrfCaptchaSchema * deps: update * fix: some error at callback * fix(deps): pin dependency abort-controller to 3.0.0 (#313) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/node-fetch to v2.5.10 (#316) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint-plugin-react to v7.23.2 (#317) Co-authored-by: Renovate Bot <bot@renovateapp.com> * style: fixed for deepscan * chore: improved user login interaction * fix(deps): update dependency @sentry/webpack-plugin to v1.15.0 (#318) * chore(deps): update dependency eslint to v7.24.0 (#320) * fix(deps): update dependency postcss to v8.2.10 (#321) Co-authored-by: Renovate Bot <bot@renovateapp.com> * ci: updated ci stuff * style: removed unnecessary script * fix: not using SENTRY_RELEASE env * chore: defaulting mysql password * chore: added sentry_dsn env and only uploading for master * ci: updated trigger * ci: passing source branch env only at push * chore(deps): update typescript-eslint monorepo to v4.22.0 (#322) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint-config-prettier to v8.2.0 (#323) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/react-select to v4.0.15 (#325) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint-plugin-prettier to v3.4.0 (#326) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/sanitize-html to v2 (#328) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/node to v14.14.41 (#324) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency ts-jest to v26.5.5 (#327) Co-authored-by: Renovate Bot <bot@renovateapp.com> * ci: debugging * Update components/DeveloperLayout.tsx Co-authored-by: zero734kr <zero734kr@gmail.com> * Update components/Loader.tsx Co-authored-by: zero734kr <zero734kr@gmail.com> * Update components/ColorCard.tsx Co-authored-by: zero734kr <zero734kr@gmail.com> * Update components/ColorCard.tsx Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix(deps): update dependency core-js to v3.11.0 (#329) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/sanitize-html to v2.3.1 (#330) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency postcss to v8.2.13 (#333) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency tailwindcss to v2.1.2 (#334) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint to v7.25.0 (#335) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency @sentry/webpack-plugin to v1.15.1 (#332) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/node to v14.14.43 (#339) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/jest to v26.0.23 (#337) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint-config-prettier to v8.3.0 (#336) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/react to v17.0.4 (#338) Co-authored-by: Renovate Bot <bot@renovateapp.com> * Update utils/ShowdownExtensions.ts Co-authored-by: zero734kr <zero734kr@gmail.com> * style: fixed some styles * chore: updated api-docs git * refactor: made change on sentry * style: removed debug code * deps: removed node-mock * ci: removed env * style: code style * test: module names * chore: docker using python * chore: docker using build-base * ci: fixed syntax error * chore: changed sql type * feat: added vote * fix: version for v1 * feat: added v1 bot vote check * feat: clearing cache for deleted bot * chore: delete bot real working IMPORTANT: NOW DELETE BOT REAL WORKS! * fix: router called at non-client * style: removed space * feat: added vote check endpoint * fix: router called at non-client * fix(deps): update sentry monorepo to v6.3.5 (#331) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency core-js to v3.11.2 (#340) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/react to v17.0.5 (#345) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update typescript-eslint monorepo to v4.22.1 (#343) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix: BotCard button component rendered as Tag * feat: update docs * feat: using koreanbots cdn for og image * fix: missing querystring label * docs: some text change https://github.com/koreanbots/v2-testing/issues/72#issuecomment-807929228 * fix: removed unexpected char close: https://github.com/koreanbots/v2-testing/issues/76 * fix: redirecting at serverside * fix(deps): pin dependencies (#342) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency ts-jest to v26.5.6 (#347) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency postcss to v8.2.14 (#349) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency core-js to v3.11.3 (#348) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix: router instance called at serverside while rendering * Merge branch 'master' of https://github.com/koreanbots/koreanbots * feat: Sentry enabled only at production * fix: menu not closing close: https://github.com/koreanbots/v2-testing/issues/50 * chore: improved mobile design * fix: tooltip overflows screen close: https://github.com/koreanbots/v2-testing/issues/28 * fix: router called at server-side close: https://github.com/koreanbots/v2-testing/issues/77 * typo: fixed typo issue * typo: improved typo * fix: router called at serverside * chore: removed custom scrollbar style * style: fixed null checks * feat: added owner transfer and edit * chore: clearing cache for updates * chore: redirecting on update * chore: added button margin * feat: disabled webhook * chore: added some spaces * feat: added padding for ad * feat: remove wave * feat: added security page * chore: some margin * feat: added bug reporters * style: fixed eslint * fix(developers): https://github.com/koreanbots/v2-testing/issues/74 * chore: improved ad * feat: migrated to @sentry/nextjs * fix: card invite button fixed * chore: not releasing * chore: debugging * chore: skiping sentry auto release * feat: added docker hub build hook * fix: docker hook * fix: docker hook geting sentry dsn as build-arg * chore: added sentry envs * chore(docker): cleanup * fix: bugs at card * typo: fixed * chore: margin top at message * fix: card building weird * fix: sentry disabled * fix: query string invalid fix: https://github.com/koreanbots/v2-testing/issues/92 * fix: https://github.com/koreanbots/v2-testing/issues/94 * chore: improved style close: https://github.com/koreanbots/v2-testing/issues/83 * fix: scrollbar shown even its not overflowed fix: https://github.com/koreanbots/v2-testing/issues/86 * fix: home not displayed at dev portal fix: https://github.com/koreanbots/v2-testing/issues/84 * types: searchParams is optional prop * feat: added required field notice close: https://github.com/koreanbots/v2-testing/issues/90 * typo: fixed typo issues For https://github.com/koreanbots/v2-testing/issues/79 * fix: causing error on other git url ISSUE: https://sentry.io/share/issue/a13341dc1aab4e5aa994fee8857afff7/ * fix: handle AbortError * chore(deps): update dependency eslint to v7.26.0 (#353) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency core-js to v3.12.1 (#350) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore: reordered bot section * typo: fixed typo issue from https://github.com/koreanbots/v2-testing/issues/79 * feat: opening new tab for discord link close: https://github.com/koreanbots/v2-testing/issues/99 * feat: added opensearch * Update renovate.json * chore: prevent clickjacking * chore: added moz SearchForm for opensearch xml * fix(deps): update dependency rc-tooltip to v5 (#351) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update sentry monorepo to v6.3.6 (#354) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency prettier to v2.3.0 (#355) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update typescript-eslint monorepo to v4.23.0 (#356) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency postcss to v8.2.15 (#357) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency react-select to v4.3.1 (#358) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency knex to v0.95.5 (#359) Co-authored-by: Renovate Bot <bot@renovateapp.com> * style: added space * feat: added get botSubmits list api * chore: updated endpoint * typo: fixed and improved typo issues * chore: improved message for empty category close: https://github.com/koreanbots/v2-testing/issues/100 * feat: support pwa * types: added missing typing * chore: changed manifest * fix: catching error for ga blocked * fix: added missing argument * chore: made some changes * style: could be null * chore: improved pwa * fix: https://github.com/koreanbots/v2-testing/issues/105 * feat: added staff missing permission * fix: https://github.com/koreanbots/v2-testing/issues/104 * feat: added width style * Update pages/_app.tsx Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * style: suggestions at review * feat: updated api-docs * chore: added dest option * chore: changed icon path * feat: just commiting service worker * feat: added bug bounty group * ci: removed reviewdog * feat: added google optimize * chore: added maskable icon and changed short_name * ci: made some changes on renovate * Create SECURITY.md * feat: fetching docs from github * feat: added tos at footer * feat(iOS): added pwa splash screen * types: improved component typing * feat: discord rebranded * ci: configured renovate ignore * [TYPO] 기여 규칙 링크 수정 (#367) * fix(deps): update sentry monorepo to v6.4.0 (#364) * feat: added logging * style: reordered import * feat: improved logging * feat: private api changes * feat: added OG * chore: updated migrate.sql * ci: updated renovate * fix: seo * feat: added approve api * chore: some changes at deny * feat: added approve * refactor: using next-seo for seo * ci(renovate): removed unused option * chore: not passing pwa at navbar * style: removed line break * fix: https://github.com/koreanbots/v2-testing/issues/89 * feat: directly fetching from discord * feat: support searching with index * style: fix deepscan * fix: invalid avatar url * fix: https://github.com/koreanbots/v2-testing/issues/110 reopen: https://github.com/koreanbots/v2-testing/issues/89 * feat: added error message at submit button * fix: https://github.com/koreanbots/v2-testing/issues/89 * feat: added deny presets article * feat: added query aliases * chore: update docs * chore: remvoed empty file * feat: increased ratelimit * feat: added bot lists * style: removed unused variable * fix(deps): update dependency knex to v0.95.6 (#365) * chore(deps): update typescript-eslint monorepo to v4.24.0 (#366) * chore(deps): update dependency @types/react to v17.0.6 (#368) * fix(deps): update dependency formik to v2.2.8 (#369) * fix(deps): update dependency next to v10.2.2 (#370) * fix(deps): update sentry monorepo to v6.4.1 (#371) * fix(deps): update dependency sanitize-html to v2.4.0 (#372) * fix(deps): update dependency postcss to v8.3.0 (#373) * docs: updated license * feat: added refresh data * feat: better image size close: https://github.com/koreanbots/v2-testing/issues/81 * chore: changed slogan * fix: invalid v1 api * fix: forbidden error * feat: added char count at textarea close: https://github.com/koreanbots/v2-testing/issues/112 * feat: changed edit page route * fix(deps): update dependency next to v10.2.3 (#376) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency typescript to v4.3.2 (#383) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint to v7.27.0 (#374) Co-authored-by: Renovate Bot <bot@renovateapp.com> * deps: removed core-js * deps: lock updated * feat: added stable docker compose file Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: zero734kr <zero734kr@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: MintyU <deathcat@outlook.kr>
382 lines
15 KiB
TypeScript
382 lines
15 KiB
TypeScript
import { NextPage, NextPageContext } from 'next'
|
|
import { useRouter } from 'next/router'
|
|
import dynamic from 'next/dynamic'
|
|
import Link from 'next/link'
|
|
import { NextSeo } from 'next-seo'
|
|
import { useEffect, useState } from 'react'
|
|
import { Field, Form, Formik } from 'formik'
|
|
import Tooltip from 'rc-tooltip'
|
|
|
|
import { SnowflakeUtil } from 'discord.js'
|
|
import { ParsedUrlQuery } from 'querystring'
|
|
import { Bot, ResponseProps, Theme, User } from '@types'
|
|
|
|
import { git, KoreanbotsEndPoints, reportCats, Status } from '@utils/Constants'
|
|
import { get } from '@utils/Query'
|
|
import Day from '@utils/Day'
|
|
import { ReportSchema } from '@utils/Yup'
|
|
import Fetch from '@utils/Fetch'
|
|
import { checkBotFlag, checkUserFlag, formatNumber, parseCookie } from '@utils/Tools'
|
|
import { getToken } from '@utils/Csrf'
|
|
|
|
import NotFound from '../../404'
|
|
|
|
const Container = dynamic(() => import('@components/Container'))
|
|
const DiscordAvatar = dynamic(() => import('@components/DiscordAvatar'))
|
|
const Divider = dynamic(() => import('@components/Divider'))
|
|
const Tag = dynamic(() => import('@components/Tag'))
|
|
const Owner = dynamic(() => import('@components/Owner'))
|
|
const Segment = dynamic(() => import('@components/Segment'))
|
|
const LongButton = dynamic(() => import('@components/LongButton'))
|
|
const Advertisement = dynamic(() => import('@components/Advertisement'))
|
|
const Markdown = dynamic(() => import ('@components/Markdown'))
|
|
const Message = dynamic(() => import('@components/Message'))
|
|
const Button = dynamic(() => import('@components/Button'))
|
|
const TextArea = dynamic(() => import('@components/Form/TextArea'))
|
|
const Modal = dynamic(() => import('@components/Modal'))
|
|
const NSFW = dynamic(() => import('@components/NSFW'))
|
|
const Login = dynamic(() => import('@components/Login'))
|
|
|
|
const Bots: NextPage<BotsProps> = ({ data, desc, date, user, theme, csrfToken }) => {
|
|
const bg = checkBotFlag(data?.flags, 'trusted') && data?.banner
|
|
const router = useRouter()
|
|
const [ nsfw, setNSFW ] = useState<boolean>()
|
|
const [ reportModal, setReportModal ] = useState(false)
|
|
const [ reportRes, setReportRes ] = useState<ResponseProps<unknown>>(null)
|
|
useEffect(() => {
|
|
setNSFW(localStorage.nsfw)
|
|
}, [])
|
|
if (!data?.id) return <NotFound />
|
|
return <div style={bg ? { background: `linear-gradient(to right, rgba(34, 36, 38, 0.68), rgba(34, 36, 38, 0.68)), url("${data.bg}") center top / cover no-repeat fixed` } : {}}>
|
|
<Container paddingTop className='py-10'>
|
|
<NextSeo
|
|
title={data.name}
|
|
description={data.intro}
|
|
twitter={{
|
|
cardType: 'summary_large_image'
|
|
}}
|
|
openGraph={{
|
|
images: [
|
|
{
|
|
url: KoreanbotsEndPoints.OG.bot(data.id, data.name, data.intro, data.category, [formatNumber(data.votes), formatNumber(data.servers)]),
|
|
width: 2048,
|
|
height: 1170,
|
|
alt: 'Bot Preview Image'
|
|
}
|
|
]
|
|
}}
|
|
/>
|
|
{
|
|
data.state === 'blocked' ? <div className='pb-40'>
|
|
<Message type='error'>
|
|
<h2 className='text-lg font-black'>해당 봇은 관리자에 의해 삭제되었습니다.</h2>
|
|
</Message>
|
|
</div>
|
|
: data.category.includes('NSFW') && !nsfw ? <NSFW onClick={() => setNSFW(true)} onDisableClick={() => localStorage.nsfw = true} />
|
|
: <>
|
|
<div className='w-full pb-2'>
|
|
{
|
|
data.state === 'private' ? <Message type='info'>
|
|
<h2 className='text-lg font-black'>해당 봇은 특수목적 봇이므로 초대하실 수 없습니다.</h2>
|
|
<p>해당 봇은 공개 사용이 목적이 아닌 특수목적봇입니다. 따라서 따로 초대하실 수 없습니다.</p>
|
|
</Message> :
|
|
data.state === 'reported' ?
|
|
<Message type='error'>
|
|
<h2 className='text-lg font-black'>해당 봇은 신고가 접수되어, 관리자에 의해 잠금 상태입니다.</h2>
|
|
<p>해당 봇 사용에 주의해주세요.</p>
|
|
<p>봇 소유자분은 <Link href='/guidelines'><a className='text-blue-500 hover:text-blue-400'>가이드라인</a></Link>에 대한 위반사항을 확인해주시고 <Link href='/discord'><a className='text-blue-500 hover:text-blue-400'>디스코드 서버</a></Link>로 문의해주세요.</p>
|
|
</Message> : ''
|
|
}
|
|
</div>
|
|
<div className='lg:flex w-full'>
|
|
<div className='w-full text-center lg:w-1/4'>
|
|
<DiscordAvatar
|
|
userID={data.id}
|
|
size={256}
|
|
className='w-full'
|
|
/>
|
|
</div>
|
|
<div className='flex-grow px-5 py-12 w-full text-center lg:w-5/12 lg:text-left'>
|
|
<Tag
|
|
circular
|
|
text={
|
|
<>
|
|
<i className={`fas fa-circle text-${Status[data.status]?.color}`} />{' '}
|
|
{Status[data.status]?.text}
|
|
</>
|
|
}
|
|
/>
|
|
<h1 className='mb-2 mt-3 text-4xl font-bold' style={bg ? { color: 'white' } : {}}>
|
|
{data.name}{' '}
|
|
{checkBotFlag(data.flags, 'trusted') ? (
|
|
<Tooltip placement='bottom' overlay='해당 봇은 한국 디스코드봇 리스트에서 엄격한 기준을 통과한 봇입니다!'>
|
|
<span className='text-koreanbots-blue text-3xl'>
|
|
<i className='fas fa-award' />
|
|
</span>
|
|
</Tooltip>
|
|
) : ''}
|
|
</h1>
|
|
<p className={`${bg ? 'text-gray-300' : 'dark:text-gray-300 text-gray-800'} text-base`}>{data.intro}</p>
|
|
</div>
|
|
<div className='w-full lg:w-1/4'>
|
|
{
|
|
data.state === 'ok' && <LongButton
|
|
newTab
|
|
href={
|
|
data.url ||
|
|
`https://discordapp.com/oauth2/authorize?client_id=${data.id}&scope=bot&permissions=0`
|
|
}
|
|
>
|
|
<h4 className='whitespace-nowrap'>
|
|
<i className='fas fa-user-plus text-discord-blurple' /> 초대하기
|
|
</h4>
|
|
</LongButton>
|
|
}
|
|
<Link href={`/bots/${router.query.id}/vote`}>
|
|
<LongButton>
|
|
<h4>
|
|
<i className='fas fa-heart text-red-600' /> 하트 추가
|
|
</h4>
|
|
<span className='ml-1 px-2 text-center text-black dark:text-gray-400 text-sm bg-little-white-hover dark:bg-very-black rounded-lg'>
|
|
{formatNumber(data.votes)}
|
|
</span>
|
|
</LongButton>
|
|
</Link>
|
|
{
|
|
((data.owners as User[]).find(el => el.id === user?.id) || checkUserFlag(user?.flags, 'staff')) && <LongButton href={`/bots/${data.id}/edit`}>
|
|
<h4>
|
|
<i className='fas fa-cogs' /> 관리하기
|
|
</h4>
|
|
</LongButton>
|
|
}
|
|
{
|
|
((data.owners as User[]).find(el => el.id === user?.id) || checkUserFlag(user?.flags, 'staff')) && <LongButton onClick={async() => {
|
|
const res = await Fetch(`/bots/${data.id}/stats`, { method: 'PATCH'} )
|
|
if(res.code !== 200) return alert(res.message)
|
|
else window.location.reload()
|
|
}}>
|
|
<h4>
|
|
<i className='fas fa-sync' /> 정보 갱신하기
|
|
</h4>
|
|
</LongButton>
|
|
}
|
|
</div>
|
|
</div>
|
|
<Divider className='px-5' />
|
|
<div className='lg:flex lg:flex-row-reverse' style={bg ? { color: 'white' } : {}}>
|
|
<div className='mb-1 w-full lg:w-1/4'>
|
|
<h2 className='3xl mb-2 font-bold'>정보</h2>
|
|
<div className='grid gap-4 grid-cols-2 px-4 py-4 text-black dark:text-gray-400 dark:bg-discord-black bg-little-white rounded-sm'>
|
|
<div>
|
|
<i className='far fa-flag' /> 접두사
|
|
</div>
|
|
<div className='markdown-body text-black dark:text-gray-400'>
|
|
<code>{data.prefix}</code>
|
|
</div>
|
|
<div>
|
|
<i className='fas fa-users' /> 서버수
|
|
</div>
|
|
<div>{data.servers || 'N/A'}</div>
|
|
<div>
|
|
<i className='fas fa-calendar-day' /> 봇 생성일
|
|
</div>
|
|
<div>{Day(date).fromNow(false)}</div>
|
|
{
|
|
checkBotFlag(data.flags, 'verified') ?
|
|
<Tooltip overlay='해당 봇은 디스코드측에서 인증된 봇입니다.'>
|
|
<div className='col-span-2'>
|
|
<i className='fas fa-check text-discord-blurple' /> 디스코드 인증됨
|
|
</div>
|
|
</Tooltip>
|
|
: ''
|
|
}
|
|
</div>
|
|
<h2 className='3xl mb-2 mt-2 font-bold'>카테고리</h2>
|
|
<div className='flex flex-wrap'>
|
|
{data.category.map(el => (
|
|
<Tag key={el} text={el} href={`/categories/${el}`} />
|
|
))}
|
|
</div>
|
|
<h2 className='3xl mb-2 mt-2 font-bold'>제작자</h2>
|
|
{(data.owners as User[]).map(el => (
|
|
<Owner
|
|
key={el.id}
|
|
id={el.id}
|
|
tag={el.tag}
|
|
username={el.username}
|
|
/>
|
|
))}
|
|
<div className='list grid'>
|
|
<a className='text-red-600 hover:underline cursor-pointer' onClick={() => {
|
|
if(!user) return <Login />
|
|
else setReportModal(true)
|
|
}} aria-hidden='true'>
|
|
<i className='far fa-flag' /> 신고하기
|
|
</a>
|
|
<Modal header={`${data.name}#${data.tag} 신고하기`} closeIcon isOpen={reportModal} onClose={() => {
|
|
setReportModal(false)
|
|
setReportRes(null)
|
|
}} full dark={theme === 'dark'}>
|
|
{
|
|
reportRes?.code === 200 ? <Message type='success'>
|
|
<h2 className='text-lg font-semibold'>성공적으로 신고하였습니다!</h2>
|
|
<p>더 자세한 설명이 필요할 수 있습니다! <a className='text-blue-600 hover:text-blue-500' href='/discord'>공식 디스코드</a>에 참여해주세요</p>
|
|
</Message> : <Formik onSubmit={async (body) => {
|
|
const res = await Fetch(`/bots/${data.id}/report`, { method: 'POST', body: JSON.stringify(body) })
|
|
setReportRes(res)
|
|
}} validationSchema={ReportSchema} initialValues={{
|
|
category: null,
|
|
description: '',
|
|
_csrf: csrfToken
|
|
}}>
|
|
{
|
|
({ errors, touched, values, setFieldValue }) => (
|
|
<Form>
|
|
<div className='mb-5'>
|
|
{
|
|
reportRes && <div className='my-5'>
|
|
<Message type='error'>
|
|
<h2 className='text-lg font-semibold'>{reportRes.message}</h2>
|
|
<ul className='list-disc'>
|
|
{reportRes.errors?.map((el, n) => <li key={n}>{el}</li>)}
|
|
</ul>
|
|
</Message>
|
|
</div>
|
|
}
|
|
<h3 className='font-bold'>신고 구분</h3>
|
|
<p className='text-gray-400 text-sm mb-1'>해당되는 항목을 선택해주세요.</p>
|
|
{
|
|
reportCats.map(el =>
|
|
<div key={el}>
|
|
<label>
|
|
<Field type='radio' name='category' value={el} className='mr-1.5 py-2' />
|
|
{el}
|
|
</label>
|
|
</div>
|
|
)
|
|
}
|
|
<div className='mt-1 text-red-500 text-xs font-light'>{errors.category && touched.category ? errors.category : null}</div>
|
|
<h3 className='font-bold mt-2'>설명</h3>
|
|
<p className='text-gray-400 text-sm mb-1'>신고하시는 내용을 자세하게 설명해주세요.</p>
|
|
<TextArea name='description' placeholder='최대한 자세하게 설명해주세요!' theme={theme === 'dark' ? 'dark' : 'light'} value={values.description} setValue={(value) => setFieldValue('description', value)} />
|
|
<div className='mt-1 text-red-500 text-xs font-light'>{errors.description && touched.description ? errors.description : null}</div>
|
|
</div>
|
|
<div className='text-right'>
|
|
<Button className='bg-gray-500 hover:opacity-90 text-white' onClick={()=> setReportModal(false)}>취소</Button>
|
|
<Button type='submit' className='bg-red-500 hover:opacity-90 text-white'>제출</Button>
|
|
</div>
|
|
</Form>
|
|
)
|
|
}
|
|
</Formik>
|
|
}
|
|
</Modal>
|
|
{data.discord && (
|
|
<a
|
|
rel='noopener noreferrer'
|
|
target='_blank'
|
|
className='text-discord-blurple hover:underline'
|
|
href={`https://discord.gg/${data.discord}`}
|
|
>
|
|
<i className='fab fa-discord' />
|
|
디스코드 서버
|
|
</a>
|
|
)}
|
|
{data.web && (
|
|
<a
|
|
rel='noopener noreferrer'
|
|
target='_blank'
|
|
className='text-blue-500 hover:underline'
|
|
href={data.web}
|
|
>
|
|
<i className='fas fa-globe' />
|
|
웹사이트
|
|
</a>
|
|
)}
|
|
{data.git && (
|
|
<a
|
|
rel='noopener noreferrer'
|
|
target='_blank'
|
|
className='hover:underline'
|
|
href={data.git}
|
|
>
|
|
<i className={`fab fa-${git[new URL(data.git).hostname]?.icon ?? 'git-alt'}`} />
|
|
{git[new URL(data.git).hostname]?.text ?? 'Git'}
|
|
</a>
|
|
)}
|
|
</div>
|
|
<Advertisement size='tall' />
|
|
</div>
|
|
<div className='w-full lg:pr-5 lg:w-3/4'>
|
|
<div className='hidden lg:block'>
|
|
<Advertisement />
|
|
</div>
|
|
{
|
|
checkBotFlag(data.flags, 'hackerthon') ? <Segment className='mt-10'>
|
|
<h1 className='text-3xl font-semibold'>
|
|
<i className='fas fa-trophy mr-4 my-2 text-yellow-300' /> 해당 봇은 한국 디스코드봇 리스트 해커톤 수상작품입니다!
|
|
</h1>
|
|
<p>해당 봇은 한국 디스코드봇 리스트 주최로 진행되었던 "한국 디스코드봇 리스트 제1회 해커톤"에서 우수한 성적을 거둔 봇입니다.</p>
|
|
<p>자세한 내용은 <a className='text-blue-500 hover:text-blue-400' href='https://blog.koreanbots.dev/first-hackathon-results/'>해당 글</a>을 확인해주세요.</p>
|
|
</Segment> : ''
|
|
}
|
|
<div className='markdown-body pt-4 w-full'>
|
|
<Segment className='my-4'>
|
|
<Markdown text={desc}/>
|
|
</Segment>
|
|
<Advertisement />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</>
|
|
}
|
|
</Container>
|
|
</div>
|
|
}
|
|
|
|
export const getServerSideProps = async (ctx: Context) => {
|
|
const parsed = parseCookie(ctx.req)
|
|
const data = await get.bot.load(ctx.query.id)
|
|
if(!data) return {
|
|
props: {
|
|
data
|
|
}
|
|
}
|
|
const desc = await get.botDescSafe(data.id)
|
|
const user = await get.Authorization(parsed?.token)
|
|
if((checkBotFlag(data.flags, 'trusted') || checkBotFlag(data.flags, 'partnered')) && data.vanity && data.vanity !== ctx.query.id) {
|
|
ctx.res.statusCode = 301
|
|
ctx.res.setHeader('Location', `/bots/${data.vanity}`)
|
|
return {
|
|
props: {}
|
|
}
|
|
}
|
|
return {
|
|
props: {
|
|
data,
|
|
desc,
|
|
date: SnowflakeUtil.deconstruct(data.id ?? '0').date.toJSON(),
|
|
user: await get.user.load(user || ''),
|
|
csrfToken: getToken(ctx.req, ctx.res)
|
|
},
|
|
}
|
|
}
|
|
|
|
export default Bots
|
|
|
|
interface BotsProps {
|
|
data: Bot
|
|
desc: string
|
|
date: Date
|
|
user: User
|
|
theme: Theme
|
|
csrfToken: string
|
|
}
|
|
interface Context extends NextPageContext {
|
|
query: URLQuery
|
|
}
|
|
|
|
interface URLQuery extends ParsedUrlQuery {
|
|
id: string
|
|
}
|