From 606f3cbc82919756fe7ac8691f1449857be4e1d5 Mon Sep 17 00:00:00 2001 From: SKINMAKER Date: Thu, 28 Sep 2023 23:22:46 +0900 Subject: [PATCH] deps: update next.js to 13 (#627) * deps: update next.js to 13 * chore: migrate to new Link component * chore: remove future option from next.config * chore: update react-select * chore: enable hideSourceMaps on sentry * chore: assert type as string * chore: make placeholder and value absolute * feat: set timeout for redirect * chore: ignore ts error * chore: add generics * chore: * chore: add ts comment * feat: use dnd-kit instead of react-sortable-hoc * fix: give absolute position to placeholder --- components/Application.tsx | 22 +- components/BotCard.tsx | 186 +++--- components/Button.tsx | 14 +- components/DeveloperLayout.tsx | 165 ++--- 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 | 507 +++++++++------- components/Owner.tsx | 24 +- components/Paginator.tsx | 71 +-- components/ResponsiveGrid.tsx | 2 +- components/Search.tsx | 9 +- components/ServerCard.tsx | 230 +++---- 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 | 518 ++++++++-------- pages/bots/[id]/index.tsx | 564 +++++++++--------- 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 | 294 ++++----- pages/servers/[id]/index.tsx | 430 ++++++------- 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 | 364 +++++------ 41 files changed, 2827 insertions(+), 2575 deletions(-) diff --git a/components/Application.tsx b/components/Application.tsx index 75d2b26..90f9df2 100644 --- a/components/Application.tsx +++ b/components/Application.tsx @@ -5,16 +5,18 @@ 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 cafd397..468518c 100644 --- a/components/BotCard.tsx +++ b/components/BotCard.tsx @@ -10,107 +10,113 @@ 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 - /> -
-
-
-
-

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

-

{bot.name}

-
-

- {bot.intro} -

+ return ( +
+
+
+
+
+
-
- {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 ? ( - - - 관리하기 - + + +
+
+ + + 보기 + - ) : bot.state !== 'ok' ? - 초대하기 - : - + + 관리하기 + + + ) : bot.state !== 'ok' ? - 초대하기 - - } + 초대하기 + : + + 초대하기 + + } +
-
+ ) } diff --git a/components/Button.tsx b/components/Button.tsx index 7a588d9..44cafe3 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 ?
+ ) } interface DeveloperLayout { diff --git a/components/Footer.tsx b/components/Footer.tsx index a08075f..93b2e06 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -16,9 +16,9 @@ const Footer: React.FC = ({ theme, setTheme }) => { 2020-2023 한국 디스코드 리스트, All rights reserved.
- - - + + + @@ -33,18 +33,18 @@ const Footer: React.FC = ({ theme, setTheme }) => {

한국 디스코드 리스트

@@ -53,23 +53,23 @@ const Footer: React.FC = ({ theme, setTheme }) => {

정책

@@ -83,8 +83,8 @@ const Footer: React.FC = ({ theme, setTheme }) => { */}
  • - - 인증 + + 인증
  • diff --git a/components/Form/Select.tsx b/components/Form/Select.tsx index 54ad56b..a1f4bb0 100644 --- a/components/Form/Select.tsx +++ b/components/Form/Select.tsx @@ -15,6 +15,18 @@ const Select: React.FC = ({ placeholder, options, handleChange, han }, } }, + placeholder: provided => { + return { + ...provided, + position: 'absolute' + } + }, + singleValue: provided => { + return { + ...provided, + position: 'absolute' + } + } }} className='border-grey-light border dark:border-transparent rounded' classNamePrefix='outline-none text-black dark:bg-very-black dark:text-white ' diff --git a/components/Form/Selects.tsx b/components/Form/Selects.tsx index 308cf2d..8ea889c 100644 --- a/components/Form/Selects.tsx +++ b/components/Form/Selects.tsx @@ -1,60 +1,92 @@ -import { ComponentType } from 'react' -import ReactSelect, { components, GroupTypeBase, MultiValueProps, OptionTypeBase } from 'react-select' +import React, { MouseEventHandler } from 'react' +import ReactSelect, { + components, + MultiValueProps, + MultiValueRemoveProps, +} from 'react-select' +import { closestCenter, DndContext, DragEndEvent } from '@dnd-kit/core' +import { restrictToParentElement } from '@dnd-kit/modifiers' import { - SortableContainer, - SortableElement, - SortableHandle, -} from 'react-sortable-hoc' + arrayMove, + horizontalListSortingStrategy, + SortableContext, + useSortable, +} from '@dnd-kit/sortable' +import { CSS } from '@dnd-kit/utilities' -function arrayMove(array, from, to) { - array = array.slice() - array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]) - return array -} - -const SortableMultiValue = SortableElement(props => { - // this prevents the menu from being opened/closed when the user clicks - // on a value to begin dragging it. ideally, detecting a click (instead of - // a drag) would still focus the control and toggle the menu, but that - // requires some magic with refs that are out of scope for this example - const onMouseDown = e => { +const MultiValue = (props: MultiValueProps