From b421d1ab64b7f89e3d83666390835ab6c04ff5dd Mon Sep 17 00:00:00 2001 From: SKINMAKER Date: Wed, 29 Nov 2023 22:04:33 +0900 Subject: [PATCH] chore: apply prettier (#637) * chore: apply prettier * chore: edit ready comment * chore: move ts comment --- components/Advertisement.tsx | 42 +- components/Application.tsx | 15 +- components/BotCard.tsx | 65 +- components/Button.tsx | 48 +- components/Captcha.tsx | 17 +- components/ColorCard.tsx | 2 +- components/DeveloperLayout.tsx | 193 ++-- components/DiscordAvatar.tsx | 23 +- components/Docs.tsx | 16 +- components/Footer.tsx | 22 +- components/Forbidden.tsx | 28 +- components/Form/CheckBox.tsx | 9 +- components/Form/Input.tsx | 16 +- components/Form/Label.tsx | 42 +- components/Form/Select.tsx | 82 +- components/Form/Selects.tsx | 116 ++- components/Form/TextArea.tsx | 125 ++- components/Hero.tsx | 201 ++-- components/Image.tsx | 71 +- components/Loader.tsx | 4 +- components/Login.tsx | 6 +- components/LongButton.tsx | 86 +- components/Markdown.tsx | 17 +- components/Message.tsx | 4 +- components/Modal.tsx | 14 +- components/NSFW.tsx | 53 +- components/Navbar.tsx | 562 ++++++----- components/Notice.tsx | 2 +- components/Owner.tsx | 24 +- components/Paginator.tsx | 42 +- components/PlatformDisplay.tsx | 11 +- components/Redirect.tsx | 26 +- components/ReportTemplate.tsx | 171 ++-- components/ResponsiveGrid.tsx | 10 +- components/Search.tsx | 217 +++-- components/Segment.tsx | 2 +- components/ServerCard.tsx | 185 ++-- components/ServerIcon.tsx | 25 +- components/SubmittedBotCard.tsx | 21 +- components/Tag.tsx | 39 +- components/Toggle.tsx | 6 +- components/Tooltip.tsx | 18 +- pages/404.tsx | 15 +- pages/_app.tsx | 252 ++--- pages/_document.tsx | 193 +++- pages/_error.tsx | 31 +- pages/_offline.tsx | 27 +- pages/about.tsx | 154 +-- pages/addbot.tsx | 369 ++++++-- pages/addserver/[id].tsx | 416 +++++--- pages/addserver/index.tsx | 95 +- pages/api/auth/discord/callback.ts | 16 +- pages/api/auth/github/callback.ts | 34 +- pages/api/auth/github/index.ts | 12 +- pages/api/image/discord/avatars/[id].ts | 50 +- pages/api/image/discord/icons/[id].ts | 44 +- pages/api/index.ts | 2 +- pages/api/v1/bots/servers.ts | 62 +- pages/api/v1/bots/voted/[id].ts | 35 +- pages/api/v2/applications/bots/[id]/index.ts | 25 +- pages/api/v2/applications/bots/[id]/reset.ts | 7 +- .../api/v2/applications/servers/[id]/index.ts | 22 +- .../api/v2/applications/servers/[id]/reset.ts | 14 +- pages/api/v2/bots/[id]/index.ts | 174 +++- pages/api/v2/bots/[id]/owners.ts | 95 +- pages/api/v2/bots/[id]/report.ts | 38 +- pages/api/v2/bots/[id]/stats.ts | 78 +- pages/api/v2/bots/[id]/vote.ts | 53 +- pages/api/v2/list/bots/new.ts | 2 +- pages/api/v2/list/bots/votes.ts | 16 +- .../bots/submits/[id]/[date]/approve.ts | 65 +- .../bots/submits/[id]/[date]/deny.ts | 89 +- .../bots/submits/[id]/[date]/index.ts | 25 +- .../management/bots/submits/[id]/history.ts | 19 +- .../v2/management/bots/submits/[id]/index.ts | 25 +- pages/api/v2/management/bots/submits/index.ts | 15 +- pages/api/v2/management/index.ts | 9 +- pages/api/v2/management/load.ts | 1 - pages/api/v2/search/all.ts | 9 +- pages/api/v2/search/bots.ts | 9 +- pages/api/v2/search/servers.ts | 9 +- pages/api/v2/servers/[id]/index.ts | 158 +++- pages/api/v2/servers/[id]/owners.ts | 19 +- pages/api/v2/servers/[id]/report.ts | 38 +- pages/api/v2/servers/[id]/vote.ts | 55 +- pages/api/v2/users/[id]/report.ts | 46 +- pages/api/widget/bots/[type]/[id].ts | 8 +- pages/api/widget/servers/[type]/[id].ts | 8 +- pages/bots/[id]/edit.tsx | 603 ++++++++---- pages/bots/[id]/index.tsx | 666 +++++++------ pages/bots/[id]/invite.tsx | 24 +- pages/bots/[id]/report.tsx | 212 +++-- pages/bots/[id]/vote.tsx | 165 ++-- pages/bots/categories/[category].tsx | 86 +- pages/bots/categories/index.tsx | 68 +- pages/bots/index.tsx | 39 +- pages/bots/list/new.tsx | 40 +- pages/bots/list/votes.tsx | 59 +- pages/bots/search.tsx | 114 ++- pages/calculator.tsx | 211 +++-- pages/callback/discord.tsx | 20 +- pages/community-rule.tsx | 18 +- pages/debug.tsx | 80 +- pages/developers/applications/bots/[id].tsx | 213 +++-- pages/developers/applications/index.tsx | 57 +- .../developers/applications/servers/[id].tsx | 217 +++-- pages/developers/docs/[first]/[second].tsx | 107 ++- pages/developers/docs/[first]/index.tsx | 2 +- pages/discord.tsx | 6 +- pages/guidelines.tsx | 9 +- pages/index.tsx | 30 +- pages/iu.tsx | 6 +- pages/license.tsx | 102 +- pages/panel.tsx | 156 +-- pages/pendingBots/[id]/[date].tsx | 223 +++-- pages/privacy.tsx | 12 +- pages/profile.tsx | 6 +- pages/search.tsx | 142 +-- pages/security.tsx | 131 +-- pages/servers/[id]/edit.tsx | 389 +++++--- pages/servers/[id]/index.tsx | 486 ++++++---- pages/servers/[id]/join.tsx | 6 +- pages/servers/[id]/report.tsx | 212 +++-- pages/servers/[id]/vote.tsx | 162 ++-- pages/servers/categories/[category].tsx | 73 +- pages/servers/categories/index.tsx | 46 +- pages/servers/index.tsx | 65 +- pages/servers/list/votes.tsx | 59 +- pages/servers/search.tsx | 114 ++- pages/tos.tsx | 9 +- pages/users/[id]/index.tsx | 123 +-- pages/users/[id]/report.tsx | 209 ++-- pages/verification.tsx | 20 +- types/global.d.ts | 3 +- types/index.ts | 16 +- utils/Constants.ts | 383 +++++--- utils/Csrf.ts | 2 +- utils/DiscordBot.ts | 43 +- utils/Fetch.ts | 10 +- utils/Jwt.ts | 21 +- utils/Knex.ts | 2 +- utils/Logger.ts | 6 +- utils/Mongo.ts | 56 +- utils/Query.ts | 894 ++++++++++++------ utils/Regex.ts | 2 +- utils/RequestHandler.ts | 9 +- utils/ResponseWrapper.ts | 2 +- utils/ShowdownExtensions.ts | 29 +- utils/Tools.ts | 131 ++- utils/Webhook.ts | 332 ++++--- utils/Yup.ts | 120 +-- utils/useOutsideClick.ts | 2 +- 152 files changed, 8356 insertions(+), 5120 deletions(-) diff --git a/components/Advertisement.tsx b/components/Advertisement.tsx index d24bba0..73a4baa 100644 --- a/components/Advertisement.tsx +++ b/components/Advertisement.tsx @@ -1,25 +1,31 @@ import AdSense from 'react-adsense' const Advertisement: React.FC = ({ size = 'short' }) => { - return
-
- {process.env.NODE_ENV === 'production' ? ( - - ) : ( - 'Advertisement' - )} + return ( +
+
+ {process.env.NODE_ENV === 'production' ? ( + + ) : ( + 'Advertisement' + )} +
-
+ ) } declare global { diff --git a/components/Application.tsx b/components/Application.tsx index 90f9df2..3caa2db 100644 --- a/components/Application.tsx +++ b/components/Application.tsx @@ -7,17 +7,16 @@ const ServerIcon = dynamic(() => import('@components/ServerIcon')) const Application: React.FC = ({ type, id, name }) => { return ( -
- { - type === 'bot' ? - : - - } -

{name}

+
+ {type === 'bot' ? ( + + ) : ( + + )} +

{name}

) - } interface ApplicationProps { diff --git a/components/BotCard.tsx b/components/BotCard.tsx index 468518c..d78f493 100644 --- a/components/BotCard.tsx +++ b/components/BotCard.tsx @@ -11,18 +11,18 @@ const DiscordAvatar = dynamic(() => import('@components/DiscordAvatar')) const BotCard: React.FC = ({ manage = false, bot }) => { return ( -
+
@@ -30,15 +30,15 @@ const BotCard: React.FC = ({ manage = false, bot }) => {
-
+
-
+
@@ -55,19 +55,19 @@ const BotCard: React.FC = ({ manage = false, bot }) => {
-
+

{Status[bot.status]?.text}

-

{bot.name}

+

+ {bot.name} +

-

- {bot.intro} -

+

{bot.intro}

- {bot.category.slice(0, 3).map(el => ( + {bot.category.slice(0, 3).map((el) => ( ))}{' '} {bot.category.length > 3 && } @@ -80,35 +80,31 @@ const BotCard: React.FC = ({ manage = false, bot }) => {
- - 보기 - + className='w-full rounded-bl-2xl py-3 text-center text-sm font-bold text-koreanbots-blue transition duration-100 ease-in hover:bg-koreanbots-blue hover:text-white hover:shadow-lg' + > + 보기 {manage ? ( - - 관리하기 - + className='w-full rounded-br-2xl py-3 text-center text-sm font-bold text-emerald-500 transition duration-100 ease-in hover:bg-emerald-500 hover:text-white hover:shadow-lg' + > + 관리하기 - ) : bot.state !== 'ok' ? - 초대하기 - : + ) : bot.state !== 'ok' ? ( + + 초대하기 + + ) : ( - 초대하기 + 초대하기 - } + )}
@@ -117,7 +113,6 @@ const BotCard: React.FC = ({ manage = false, bot }) => {
) - } interface BotCardProps { @@ -125,4 +120,4 @@ interface BotCardProps { bot: Bot } -export default BotCard \ No newline at end of file +export default BotCard diff --git a/components/Button.tsx b/components/Button.tsx index 44cafe3..a151e28 100644 --- a/components/Button.tsx +++ b/components/Button.tsx @@ -6,33 +6,41 @@ const Button: React.FC = ({ className, children, href, - disabled=false, + disabled = false, onClick, }) => { - return href ? - - {children} - - - : onClick ? - : - + ) : ( + + ) } interface ButtonProps { diff --git a/components/Captcha.tsx b/components/Captcha.tsx index 25585cf..7418cd0 100644 --- a/components/Captcha.tsx +++ b/components/Captcha.tsx @@ -1,15 +1,20 @@ import { Ref } from 'react' import HCaptcha from '@hcaptcha/react-hcaptcha' - const Captcha: React.FC = ({ dark, onVerify }) => { - return + return ( + + ) } interface CaptchaProps { - dark: boolean - onVerify(token: string, eKey?: string): void - ref?: Ref + dark: boolean + onVerify(token: string, eKey?: string): void + ref?: Ref } -export default Captcha \ No newline at end of file +export default Captcha diff --git a/components/ColorCard.tsx b/components/ColorCard.tsx index 66f6c32..ef42301 100644 --- a/components/ColorCard.tsx +++ b/components/ColorCard.tsx @@ -3,7 +3,7 @@ const ColorCard: React.FC = ({ header, first, second, className

{header}

- {first} + {first}
{second}

diff --git a/components/DeveloperLayout.tsx b/components/DeveloperLayout.tsx index 3b4ba60..f3517bb 100644 --- a/components/DeveloperLayout.tsx +++ b/components/DeveloperLayout.tsx @@ -9,106 +9,169 @@ import { NextSeo } from 'next-seo' const Container = dynamic(() => import('@components/Container')) const Divider = dynamic(() => import('@components/Divider')) -const DeveloperLayout: React.FC = ({ children, enabled, docs, currentDoc }:DeveloperLayout) => { - const [ navbarEnabled, setNavbarOpen ] = useState(false) +const DeveloperLayout: React.FC = ({ + children, + enabled, + docs, + currentDoc, +}: DeveloperLayout) => { + const [navbarEnabled, setNavbarOpen] = useState(false) return ( -
- -
-
+
+ +
+
    -
  • - +
  • + + +
  • -
  • - +
  • + + +
  • - { - enabled === 'docs' && <> + {enabled === 'docs' && ( + <> -
  • setNavbarOpen(true)} onClick={() => setNavbarOpen(true)}> - -
  • - } +
  • setNavbarOpen(true)} + onClick={() => setNavbarOpen(true)} + > + +
  • + + )}
-
-
-
    -
  • setNavbarOpen(false)} onClick={() => setNavbarOpen(false)}>닫기
  • +
    +
    +
      +
    • setNavbarOpen(false)} + onClick={() => setNavbarOpen(false)} + > + 닫기 +
    • -
    • - 나의 리스트 +
    • + 나의 리스트
    • -
    • - 문서 +
    • + 문서
    - { - enabled === 'docs' && <> + {enabled === 'docs' && ( + <> -
      -
    • setNavbarOpen(false)} className='lg:hidden cursor-pointer py-1 px-4 rounded-md mb-2'> +
        +
      • setNavbarOpen(false)} + className='mb-2 cursor-pointer rounded-md px-4 py-1 lg:hidden' + > 닫기
      • - { - docs?.map(el => { - if(el.list) return ( + {docs?.map((el) => { + if (el.list) + return (
        - {el.name} -
          - { - el.list.map(e => - -
        • setNavbarOpen(false)} className={`cursor-pointer px-4 py-2 rounded-md ${currentDoc === e.name ? 'bg-discord-blurple text-white' : 'hover:text-gray-500 dark:hover:text-white'}`}> - {e.name} -
        • - - ) - } + + {el.name} + +
            + {el.list.map((e) => ( + +
          • setNavbarOpen(false)} + className={`cursor-pointer rounded-md px-4 py-2 ${ + currentDoc === e.name + ? 'bg-discord-blurple text-white' + : 'hover:text-gray-500 dark:hover:text-white' + }`} + > + {e.name} +
          • + + ))}
        ) - - return ( - -
      • setNavbarOpen(false)} className={`cursor-pointer py-2 px-4 rounded-md ${currentDoc === el.name ? 'bg-discord-blurple text-white' : 'hover:text-gray-500 dark:hover:text-white'}`}> - {el.name} -
      • - - ) - }) - } + + return ( + +
      • setNavbarOpen(false)} + className={`cursor-pointer rounded-md px-4 py-2 ${ + currentDoc === el.name + ? 'bg-discord-blurple text-white' + : 'hover:text-gray-500 dark:hover:text-white' + }`} + > + {el.name} +
      • + + ) + })}
      - } + )}
    -
    - - {children} - +
    + {children}
    ) } interface DeveloperLayout { - children: ReactNode - enabled: 'applications' | 'docs' + children: ReactNode + enabled: 'applications' | 'docs' docs?: DocsData[] currentDoc?: string } diff --git a/components/DiscordAvatar.tsx b/components/DiscordAvatar.tsx index 1238914..a6cbb48 100644 --- a/components/DiscordAvatar.tsx +++ b/components/DiscordAvatar.tsx @@ -4,20 +4,27 @@ import { KoreanbotsEndPoints } from '@utils/Constants' const Image = dynamic(() => import('@components/Image')) -const DiscordAvatar: React.FC = props => { - return - +const DiscordAvatar: React.FC = (props) => { + return ( + + ) } interface DiscordAvatarProps { alt?: string userID: string className?: string - size? : 128 | 256 | 512 + size?: 128 | 256 | 512 } interface ImageEvent extends Event { diff --git a/components/Docs.tsx b/components/Docs.tsx index f71d240..b9a6121 100644 --- a/components/Docs.tsx +++ b/components/Docs.tsx @@ -8,26 +8,28 @@ const Docs: React.FC = ({ title, header, description, subheader, chil const d = description || subheader return ( <> - -
    +
    -

    +

    {header}

    -

    +

    {description}

    -

    +

    {subheader}

    - +
    {children}
    diff --git a/components/Footer.tsx b/components/Footer.tsx index 93b2e06..b8f661d 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -9,16 +9,16 @@ const Toggle = dynamic(() => import('@components/Toggle')) const Footer: React.FC = ({ theme, setTheme }) => { return (
    -
    - +
    +
    -

    국내 디스코드의 모든 것을 한 곳에서.

    +

    + 국내 디스코드의 모든 것을 한 곳에서. +

    2020-2023 한국 디스코드 리스트, All rights reserved. - -
    +
    -

    한국 디스코드 리스트

    +

    한국 디스코드 리스트

    • @@ -50,7 +50,7 @@ const Footer: React.FC = ({ theme, setTheme }) => {
    -

    정책

    +

    정책

    • @@ -75,7 +75,7 @@ const Footer: React.FC = ({ theme, setTheme }) => {
    -

    커뮤니티

    +

    커뮤니티

      {/*
    • @@ -90,7 +90,7 @@ const Footer: React.FC = ({ theme, setTheme }) => {
    -

    기타

    +

    기타

    다크모드 import('@components/Button')) -const Forbidden:React.FC = () => { +const Forbidden: React.FC = () => { const router = useRouter() - return <> - -
    -
    -

    403

    -

    - {ErrorText[403]} -

    - -

    해당 작업을 수행할 수 있는 권한이 없습니다. 무언가 잘못된 것 같다면 문의해주세요.

    + return ( + <> + +
    +
    +

    403

    +

    {ErrorText[403]}

    + +

    + 해당 작업을 수행할 수 있는 권한이 없습니다. 무언가 잘못된 것 같다면 문의해주세요. +

    +
    -
    - + + ) } export default Forbidden diff --git a/components/Form/CheckBox.tsx b/components/Form/CheckBox.tsx index f72350b..ef91590 100644 --- a/components/Form/CheckBox.tsx +++ b/components/Form/CheckBox.tsx @@ -1,7 +1,14 @@ import { Field } from 'formik' const CheckBox: React.FC = ({ name, ...props }) => { - return + return ( + + ) } interface CheckBoxProps { diff --git a/components/Form/Input.tsx b/components/Form/Input.tsx index fc3980d..527d4ee 100644 --- a/components/Form/Input.tsx +++ b/components/Form/Input.tsx @@ -1,12 +1,16 @@ import { Field } from 'formik' const Input: React.FC = ({ name, placeholder, ...props }) => { - return + return ( + + ) } interface InputProps { diff --git a/components/Form/Label.tsx b/components/Form/Label.tsx index 45187d5..3e230be 100644 --- a/components/Form/Label.tsx +++ b/components/Form/Label.tsx @@ -6,28 +6,30 @@ const Label: React.FC = ({ error = null, grid = true, short = false, - required = false + required = false, }) => { - return