From 7d38d7fb309033cef07f545e1ed7a3c27bae92b5 Mon Sep 17 00:00:00 2001 From: Eunwoo Choi Date: Sun, 1 Oct 2023 01:40:36 +0900 Subject: [PATCH] Revert "deps: update next.js to 13 (#627)" This reverts commit 606f3cbc82919756fe7ac8691f1449857be4e1d5. --- components/Application.tsx | 22 +- components/BotCard.tsx | 184 +++--- components/Button.tsx | 14 +- components/DeveloperLayout.tsx | 163 +++--- components/Footer.tsx | 38 +- components/Form/Select.tsx | 12 - components/Form/Selects.tsx | 122 ++-- components/Form/TextArea.tsx | 2 - components/Login.tsx | 2 +- components/LongButton.tsx | 12 +- components/Navbar.tsx | 487 +++++++-------- components/Owner.tsx | 24 +- components/Paginator.tsx | 71 ++- components/ResponsiveGrid.tsx | 2 +- components/Search.tsx | 9 +- components/ServerCard.tsx | 228 ++++--- components/SubmittedBotCard.tsx | 58 +- components/Tag.tsx | 42 +- components/Tooltip.tsx | 90 +-- next.config.js | 6 +- package.json | 16 +- pages/_error.tsx | 40 +- pages/_offline.tsx | 40 +- pages/addbot.tsx | 274 ++++----- pages/addserver/[id].tsx | 242 ++++---- pages/bots/[id]/edit.tsx | 516 ++++++++-------- pages/bots/[id]/index.tsx | 554 +++++++++--------- pages/bots/[id]/report.tsx | 152 +++-- pages/bots/[id]/vote.tsx | 104 ++-- pages/developers/applications/bots/[id].tsx | 157 +++-- pages/developers/applications/index.tsx | 2 +- .../developers/applications/servers/[id].tsx | 173 +++--- pages/panel.tsx | 2 +- pages/pendingBots/[id]/[date].tsx | 284 +++++---- pages/servers/[id]/index.tsx | 418 +++++++------ pages/servers/[id]/report.tsx | 152 +++-- pages/servers/[id]/vote.tsx | 104 ++-- pages/users/[id]/index.tsx | 14 +- pages/users/[id]/report.tsx | 144 +++-- utils/Query.ts | 2 +- yarn.lock | 380 ++++++------ 41 files changed, 2553 insertions(+), 2805 deletions(-) diff --git a/components/Application.tsx b/components/Application.tsx index 90f9df2d6b..75d2b2649f 100644 --- a/components/Application.tsx +++ b/components/Application.tsx @@ -5,18 +5,16 @@ const DiscordAvatar = dynamic(() => import('@components/DiscordAvatar')) const ServerIcon = dynamic(() => import('@components/ServerIcon')) const Application: React.FC = ({ type, id, name }) => { - return ( - -
- { - type === 'bot' ? - : - - } -

{name}

-
- - ) + return +
+ { + type === 'bot' ? + : + + } +

{name}

+
+ } diff --git a/components/BotCard.tsx b/components/BotCard.tsx index 468518c34d..cafd3976eb 100644 --- a/components/BotCard.tsx +++ b/components/BotCard.tsx @@ -10,113 +10,107 @@ const Tag = dynamic(() => import('@components/Tag')) const DiscordAvatar = dynamic(() => import('@components/DiscordAvatar')) const BotCard: React.FC = ({ manage = false, bot }) => { - return ( -
-
-
-
-
- -
-
-
-
- -
-
- - {formatNumber(bot.votes)} - - } - dark - /> - {formatNumber(bot.servers)} 서버 : 'N/A'} - dark - /> -
+ return
+
+
+
+
+ +
+
+
+
+
-
-
-

- - {Status[bot.status]?.text} -

-

{bot.name}

-
-

- {bot.intro} -

-
-
- {bot.category.slice(0, 3).map(el => ( - - ))}{' '} - {bot.category.length > 3 && } +
+ + {formatNumber(bot.votes)} + + } + dark + /> + {formatNumber(bot.servers)} 서버 : 'N/A'} + dark + />
- - -
-
- - - 보기 - +
+

+ + {Status[bot.status]?.text} +

+

{bot.name}

+
+

+ {bot.intro} +

+
+
+ {bot.category.slice(0, 3).map(el => ( + + ))}{' '} + {bot.category.length > 3 && } +
+
+
+ + +
+
+ + + 보기 + + + {manage ? ( + + + 관리하기 + - {manage ? ( - - - 관리하기 - - - ) : bot.state !== 'ok' ? + 초대하기 + : + - 초대하기 - : - - 초대하기 - - } -
+ 초대하기 + + }
- ) +
} diff --git a/components/Button.tsx b/components/Button.tsx index 44cafe3085..7a588d9d06 100644 --- a/components/Button.tsx +++ b/components/Button.tsx @@ -9,13 +9,13 @@ const Button: React.FC = ({ disabled=false, onClick, }) => { - return href ? - - {children} - + return href ? + + {children} + : onClick ? -
    -
  • - - - {dev ? '홈' : '개발자'} - - -
  • - { - type !== 'bot' &&
  • - - - 봇 리스트 - + return ( + <> +
+
+
+ +
-
- -
-
- -
- - -
- { - logged ? <> - setNavbarOpen(!navbarOpen)}> - - - {userCache.username} - + { + setMobileAddDropdownOpen(!mobileAddDropdownOpen) + }} + className='flex items-center px-8 py-2 text-gray-100' + > + + 추가하기 + + + + +
-
- + + ) } interface NavbarProps { diff --git a/components/Owner.tsx b/components/Owner.tsx index 3d2efb8a0b..4592c256cb 100644 --- a/components/Owner.tsx +++ b/components/Owner.tsx @@ -3,19 +3,17 @@ import DiscordAvatar from '@components/DiscordAvatar' const Owner: React.FC = ({ id, globalName, username, tag, crown=false }) => { return ( - ( - -
- -
-
-

{ crown && }{tag === '0' ? globalName : username}

- {tag === '0' ? '@' + username : '#' + tag} -
- - ) + + +
+ +
+
+

{ crown && }{tag === '0' ? globalName : username}

+ {tag === '0' ? '@' + username : '#' + tag} +
+
+ ) } diff --git a/components/Paginator.tsx b/components/Paginator.tsx index 9beceb31f5..8ecc7832cc 100644 --- a/components/Paginator.tsx +++ b/components/Paginator.tsx @@ -29,45 +29,44 @@ const Paginator: React.FC = ({ currentPage, totalPage, pathname, return (
- - - - + + + + {pages.map((el, i) => ( - ( - - {el} - - ) + + + {el} + + ))} - - - - + + + +
diff --git a/components/ResponsiveGrid.tsx b/components/ResponsiveGrid.tsx index 7033534dac..e97db63d56 100644 --- a/components/ResponsiveGrid.tsx +++ b/components/ResponsiveGrid.tsx @@ -1,4 +1,4 @@ -const ResponsiveGrid: React.FC = ({ children }) => { +const ResponsiveGrid: React.FC = ({ children }) => { return
{children}
diff --git a/components/Search.tsx b/components/Search.tsx index 1949de8825..7533871159 100644 --- a/components/Search.tsx +++ b/components/Search.tsx @@ -115,7 +115,7 @@ const Search: React.FC = () => { data.data.bots.length === 0 ?
  • 검색 결과가 없습니다.
  • : data.data.bots.map(el => ( - +
  • @@ -133,7 +133,7 @@ const Search: React.FC = () => { data.data.servers.length === 0 ?
  • 검색 결과가 없습니다.
  • : data.data.servers.map(el => ( - +
  • @@ -177,10 +177,7 @@ const Search: React.FC = () => {
  • { recentSearch.slice(0, 10).map((el, n) => ( - +
  • {el?.value} diff --git a/components/ServerCard.tsx b/components/ServerCard.tsx index 5292b6d0bb..58b2ce2628 100644 --- a/components/ServerCard.tsx +++ b/components/ServerCard.tsx @@ -11,141 +11,131 @@ const ServerIcon = dynamic(() => import('@components/ServerIcon')) const ServerCard: React.FC = ({ type, server }) => { const newServerLink = server.data ? `/addserver/${server.id}` : `${DiscordEnpoints.InviteApplication(DSKR_BOT_ID, {}, 'bot', null, server.id)}&disable_guild_select=true` - return ( -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    - - {formatNumber(server.votes)} - - } - dark - /> - {formatNumber(server.members)} 멤버 : 'N/A'} - dark - /> -
    + return
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    -
    -

    - 정보 갱신 불가 -

    -

    {server.name}

    +
    + + {formatNumber(server.votes)} + + } + dark + /> + {formatNumber(server.members)} 멤버 : 'N/A'} + dark + />
    - -

    - {type === 'add' ? - server.data ? '지금 바로 서버를 등록할 수 있습니다.' : '봇을 초대해야 서버를 등록할 수 있습니다.' - : server.intro - } -

    -
    -
    - {server.category?.slice(0, 3).map(el => ( - - ))}{' '} - {server.category?.length > 3 && } -
    +
    +

    + 정보 갱신 불가 +

    +

    {server.name}

    +
    +
    + +

    + {type === 'add' ? + server.data ? '지금 바로 서버를 등록할 수 있습니다.' : '봇을 초대해야 서버를 등록할 수 있습니다.' + : server.intro + } +

    +
    +
    + {server.category?.slice(0, 3).map(el => ( + + ))}{' '} + {server.category?.length > 3 && }
    - - -
    -
    - { - type === 'add' ? - server.data ? - - 등록하기 - - : + + +
    +
    + { + type === 'add' ? + server.data ? + + 등록하기 + + : + - - 봇 초대하기 - + target='_blank' + > + 봇 초대하기 + + + : + <> + + + 보기 + - : - <> - - - 보기 - + {type === 'manage' ? ( + + + 관리하기 + - {type === 'manage' ? ( - - - 관리하기 - - - ) : !['ok', 'unreachable'].includes(server.state) ? + 참가하기 + : + - 참가하기 - : - - 참가하기 - - } - - - } -
    + 참가하기 + + } + + + }
    - ) +
    } diff --git a/components/SubmittedBotCard.tsx b/components/SubmittedBotCard.tsx index c514e305bf..904d9ee33b 100644 --- a/components/SubmittedBotCard.tsx +++ b/components/SubmittedBotCard.tsx @@ -7,38 +7,36 @@ import Link from 'next/link' const SubmittedBotCard: React.FC = ({ href, submit }) => { return ( - ( - -
    -
    -
    -

    {submit.id}

    -
    - - - ) + + ) } diff --git a/components/Tag.tsx b/components/Tag.tsx index 2673e116dc..683a141c23 100644 --- a/components/Tag.tsx +++ b/components/Tag.tsx @@ -37,27 +37,27 @@ const Tag: React.FC = ({ {text} ) : ( - ( - - {text} - - ) + + + {text} + + ) ) : ( = ({ text, }) => { return href ? ( - ( - -
    -
    - {children} - - - ) + + ) : (
    diff --git a/next.config.js b/next.config.js index e20b742007..e6ee49c646 100644 --- a/next.config.js +++ b/next.config.js @@ -20,6 +20,7 @@ const NextConfig = { NEXT_PUBLIC_RELEASE_VERSION: VERSION, SENTRY_SKIP_AUTO_RELEASE: true }, + future: {}, experimental: { scrollRestoration: true }, @@ -41,9 +42,6 @@ const NextConfig = { sentry: process.env.CI ? { disableServerWebpackPlugin: true, disableClientWebpackPlugin: true, - hideSourceMaps: true, - } : { - hideSourceMaps: true, - }, + } : {} } module.exports = withSentryConfig(withPWA(NextConfig)) \ No newline at end of file diff --git a/package.json b/package.json index 0f3af2e84f..200651b29c 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,6 @@ "docker": "docker-compose up -d --build" }, "dependencies": { - "@dnd-kit/core": "^6.0.8", - "@dnd-kit/modifiers": "^6.0.1", - "@dnd-kit/sortable": "^7.0.2", - "@dnd-kit/utilities": "^3.2.1", "@fortawesome/fontawesome-free": "5.15.4", "@hcaptcha/react-hcaptcha": "^1.8.1", "@sentry/nextjs": "^7.57.0", @@ -41,7 +37,7 @@ "knex": "^2.4.0", "mongoose": "6.11.3", "mysql": "2.18.1", - "next": "^13.5.2", + "next": "^12.3.2", "next-connect": "0.10.1", "next-pwa": "^5.6.0", "next-seo": "^6.1.0", @@ -50,14 +46,15 @@ "postcss": "^8.4.24", "postcss-preset-env": "8.5.1", "rc-tooltip": "5.1.1", - "react": "^18.2.0", + "react": "17.0.2", "react-adsense": "0.1.0", - "react-dom": "^18.2.0", + "react-dom": "17.0.2", "react-ga": "^3.3.1", "react-hotkeys": "2.0.0", "react-responsive-modal": "6.4.2", - "react-select": "^5.7.5", + "react-select": "4.3.1", "react-showdown": "2.3.1", + "react-sortable-hoc": "2.0.0", "react-use-clipboard": "1.0.9", "sanitize-html": "^2.11.0", "tailwindcss": "^3.3.2", @@ -78,7 +75,8 @@ "@types/node-fetch": "^2.5.12", "@types/nprogress": "0.2.0", "@types/rc-tooltip": "^3.7.4", - "@types/react": "^18.2.22", + "@types/react": "^17.0.15", + "@types/react-select": "^4.0.17", "@types/sanitize-html": "^2.8.0", "@types/url-regex-safe": "1.0.0", "@typescript-eslint/eslint-plugin": "^5.61.0", diff --git a/pages/_error.tsx b/pages/_error.tsx index 544713a679..2cca7d47c2 100644 --- a/pages/_error.tsx +++ b/pages/_error.tsx @@ -7,31 +7,25 @@ import { ErrorMessage } from '@utils/Constants' const Container = dynamic(() => import('@components/Container')) const MyError: NextPage = () => { - return ( -
    - -

    {getRandom(ErrorMessage)}

    -

    예상치 못한 오류가 발생하였습니다. 문제가 지속적으로 발생한다면 문의해주세요!

    -
    상태 페이지 -
    - - + return
    + +

    {getRandom(ErrorMessage)}

    +

    예상치 못한 오류가 발생하였습니다. 문제가 지속적으로 발생한다면 문의해주세요!

    + 상태 페이지 + -
    -
    - ) + + + + +
    + +
    } export default MyError \ No newline at end of file diff --git a/pages/_offline.tsx b/pages/_offline.tsx index b459275dd5..80f3c4d3c1 100644 --- a/pages/_offline.tsx +++ b/pages/_offline.tsx @@ -5,31 +5,25 @@ import dynamic from 'next/dynamic' const Container = dynamic(() => import('@components/Container')) const MyError: NextPage = () => { - return ( -
    - -

    인터넷이 끊어졌나봐요...

    -

    인터넷 연결을 확인하시고 다시 시도 해주세요!

    - 상태 페이지 -
    - - + return
    + +

    인터넷이 끊어졌나봐요...

    +

    인터넷 연결을 확인하시고 다시 시도 해주세요!

    + 상태 페이지 + -
    -
    - ) + + + + +
    +
    +
    } export default MyError \ No newline at end of file diff --git a/pages/addbot.tsx b/pages/addbot.tsx index 85273e4275..94e5087387 100644 --- a/pages/addbot.tsx +++ b/pages/addbot.tsx @@ -76,154 +76,134 @@ const AddBot:NextPage = ({ logged, user, csrfToken, theme }) => { title:'새로운 봇 추가하기', description: '자신의 봇을 한국 디스코드 리스트에 등록하세요.' }} /> - if(data?.data && data.code === 200) { - setTimeout( - () => redirectTo(router, `/pendingBots/${data.data.id}/${data.data.date}`), - 1_000 - ) - } - return ( - - -

    새로운 봇 추가하기

    -
    - 안녕하세요, {user.tag === '0' ? `@${user.username}` : `${user.username}#${user.tag}`}님! 본인이 아니신가요? -
    - { - data ? data.code == 200 && data.data ? -

    봇 신청 성공!

    -

    봇을 성공적으로 신청했습니다! 심사 페이지로 리다이렉트됩니다.

    -
    : -

    {data.message || '오류가 발생했습니다.'}

    -
      - {data.errors?.map((el, n) =>
    • {el}
    • )} -
    - -
    : <> - } - setCaptcha(true)}> - {({ errors, touched, values, isValid, setFieldTouched, setFieldValue }) => ( -
    -
    - -

    신청하시기 전에 다음 사항을 확인해 주세요!

    -
      -
    • 디스코드 서버에 참가하셨나요?
    • -
    • 봇이 가이드라인을 지키고 있나요?
    • -
    • 봇 소유자가 두 명 이상인가요? 봇 소유자는 봇이 승인된 뒤, 더 추가하실 수 있습니다.
    • -
    • 또한, 봇을 등록하게 되면 작성하신 모든 정보는 웹과 API에 공개됩니다.
    • -
    -
    + return + +

    새로운 봇 추가하기

    +
    + 안녕하세요, {user.tag === '0' ? `@${user.username}` : `${user.username}#${user.tag}`}님! 본인이 아니신가요? +
    + { + data ? data.code == 200 && data.data ? +

    봇 신청 성공!

    +

    봇을 성공적으로 신청했습니다! 심사 페이지로 리다이랙트됩니다. {redirectTo(router, `/pendingBots/${data.data.id}/${data.data.date}`)}

    +
    : +

    {data.message || '오류가 발생했습니다.'}

    +
      + {data.errors?.map((el, n) =>
    • {el}
    • )} +
    + +
    : <> + } + setCaptcha(true)}> + {({ errors, touched, values, isValid, setFieldTouched, setFieldValue }) => ( + +
    + +

    신청하시기 전에 다음 사항을 확인해 주세요!

    +
      +
    • 디스코드 서버에 참가하셨나요?
    • +
    • 봇이 가이드라인을 지키고 있나요?
    • +
    • 봇 소유자가 두 명 이상인가요? 봇 소유자는 봇이 승인된 뒤, 더 추가하실 수 있습니다.
    • +
    • 또한, 봇을 등록하게 되면 작성하신 모든 정보는 웹과 API에 공개됩니다.
    • +
    +
    +
    + + + + + + + + + { + values.category.includes('빗금 명령어') && +

    해당 봇은 빗금 명령어(Slash Command) 카테고리가 선택되었습니다.

    +

    초대링크는 빗금 명령어 권한을 부여하지 않은 일반 봇 초대링크로 자동 생성됩니다. + 따라서 빗금 명령어 권한을 포함한 초대링크를 직접 설정해주세요.

    +
    + } +