From b973c18134ba9733aa4a1dbe6e0fc17b85e77c99 Mon Sep 17 00:00:00 2001 From: izone00 Date: Mon, 11 Mar 2024 17:31:50 +0900 Subject: [PATCH 01/67] =?UTF-8?q?[Feat]=20PartyAPI=20response=EC=99=80=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99=EB=90=98=EB=8A=94=20type=20=EC=A0=95?= =?UTF-8?q?=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/partyTypes.ts | 119 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 types/partyTypes.ts diff --git a/types/partyTypes.ts b/types/partyTypes.ts new file mode 100644 index 000000000..c4cbff528 --- /dev/null +++ b/types/partyTypes.ts @@ -0,0 +1,119 @@ +export type PartyRoomStatus = 'OPEN' | 'START' | 'FINISH' | 'HIDDEN' | 'FAIL'; +/** + * @typedef {Object} PartyRoom + * @property {string} [creatorIntraId] - adminAPI로 조회시 존재 + */ +export type PartyRoom = { + roomId: number; + title: string; + categoryId: number; + currentPeople: number; + minPeople: number; + maxPeople: number; + dueDate: string; + createDate: string; + roomStatus: PartyRoomStatus; + creatorIntraId?: string; +}; + +/** + * @typedef {Object} PartyRoomDetail + * @property {string | null} [myNickname] - Room 참여시 존재 + */ +export type PartyRoomDetail = PartyRoom & { + myNickname: string | null; + hostNickname: string; + content: string; + roomUsers: PartyRoomUser[]; + comments: PartyComment[]; +}; + +/** + * @typedef {Object} PartyRoomUser + * @property {string | null} [intraId] - Room 시작시 or Admin으로 조회시 존재 + */ +export type PartyRoomUser = { + roomUserId: number; + nickname: string; + intraId: string | null; +}; + +/** + * @typedef {Object} PartyRoomDetail + * @property {string | null} [intraid] - Room 시작시 or Admin으로 조회시 존재 + */ +export type PartyComment = { + commentId: number; + nickname: string; + intraid: string | null; + isexist: boolean; + content: string; + isHidden: boolean; + createDate: string; +}; + +export type PartyCategory = { + categoryId: number; + categoryName: string; +}; + +export type PartyGameTemplate = { + gameTemplateId: number; + categoryId: number; + gameName: string; + maxGamePeople: number; + minGamePeople: number; + maxGameTime: number; + minGameTime: number; + genre: string; + difficulty: string; + summary: string; +}; + +export type PartyRoomReport = { + id: number; + reporterIntraId: string; + reporteeIntraId: string; + roomId: number; + message: string; + createdAt: string; +}; + +export type PartyNoshowReport = { + id: number; + reporterIntraId: string; + reporteeIntraId: string; + roomId: number; + message: string; + createdAt: string; +}; + +export type PartyCommentReport = { + id: number; + reporterIntraId: string; + commentsId: number; + roomId: number; + message: string; + createdAt: string; +}; + +export type PartyCreateForm = { + title: string; + categoryId: number; + minPeople: number; + maxPeople: number; + content: string; + dueDate: string; +}; + +export type PartyTemplateForm = { + gameName: string; + categoryId: number; + maxGamePeople: number; + minGamePeople: number; + maxGameTime: number; + minGameTime: number; + genre: string; + difficulty: string; + summary: string; +}; From b876c0baa89462600bb72de9979643929e5a6a26 Mon Sep 17 00:00:00 2001 From: izone00 Date: Mon, 11 Mar 2024 17:33:13 +0900 Subject: [PATCH 02/67] =?UTF-8?q?[Feat]=20Admin=20Party=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EC=97=90=EC=84=9C=20=EC=93=B0=EC=9D=B4=EB=8A=94=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/admin/adminPartyTypes.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 types/admin/adminPartyTypes.ts diff --git a/types/admin/adminPartyTypes.ts b/types/admin/adminPartyTypes.ts new file mode 100644 index 000000000..3586e538c --- /dev/null +++ b/types/admin/adminPartyTypes.ts @@ -0,0 +1,20 @@ +import { PartyRoomStatus } from 'types/partyTypes'; + +export type PartyRoomColumn = { + roomId: number; + title: string; + categoryName: string; + createDate: string; + dueDate: string; + creatorIntraId: string; + roomStatus: PartyRoomStatus; +}; + +export type PartyPenaltyAdmin = { + id: number; + user: object; + penaltyType: string; + message: string; + startTime: string; + penaltyTime: number; +}; From e1292e303fbeefb9571aa25b50d9d990b4b173b0 Mon Sep 17 00:00:00 2001 From: izone00 Date: Mon, 11 Mar 2024 17:56:48 +0900 Subject: [PATCH 03/67] =?UTF-8?q?[Feat]=20Modal=EC=97=90=20Party=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/modal/ModalProvider.tsx | 3 +++ components/modal/modalType/PartyModal.tsx | 11 +++++++++++ types/modalTypes.ts | 3 ++- utils/recoil/modal.ts | 2 ++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 components/modal/modalType/PartyModal.tsx diff --git a/components/modal/ModalProvider.tsx b/components/modal/ModalProvider.tsx index abbf1aa7f..cd1f462ae 100644 --- a/components/modal/ModalProvider.tsx +++ b/components/modal/ModalProvider.tsx @@ -6,6 +6,7 @@ import AdminModal from 'components/modal/modalType/AdminModal'; import NormalModal from 'components/modal/modalType/NormalModal'; import StoreModal from 'components/modal/modalType/StoreModal'; import styles from 'styles/modal/Modal.module.scss'; +import PartyModal from './modalType/PartyModal'; import TournamentModal from './modalType/TournamentModal'; export default function ModalProvider() { @@ -46,6 +47,8 @@ export default function ModalProvider() { ) : modalType === 'TOURNAMENT' ? ( + ) : modalType === 'PARTY' ? ( + ) : null} ) diff --git a/components/modal/modalType/PartyModal.tsx b/components/modal/modalType/PartyModal.tsx new file mode 100644 index 000000000..8f3030086 --- /dev/null +++ b/components/modal/modalType/PartyModal.tsx @@ -0,0 +1,11 @@ +import { useRecoilValue } from 'recoil'; +import { modalState } from 'utils/recoil/modal'; + +export default function PartyModal() { + const { modalName } = useRecoilValue(modalState); + + const content: { [key: string]: JSX.Element | null } = {}; + + if (!modalName) return null; + return content[modalName]; +} diff --git a/types/modalTypes.ts b/types/modalTypes.ts index e4a4e45f2..a1101efa8 100644 --- a/types/modalTypes.ts +++ b/types/modalTypes.ts @@ -68,7 +68,8 @@ type ModalName = | `EDIT-ITEM-${EditItemModal}` | `STORE-${StoreModal}` | `PURCHASE-${PurchaseModal}` - | `TOURNAMENT-${TournamentModal}`; + | `TOURNAMENT-${TournamentModal}` + | `PARTY-${PartyModal}`; export interface Cancel { startTime: string; diff --git a/utils/recoil/modal.ts b/utils/recoil/modal.ts index f0f1911c8..96a676eb8 100644 --- a/utils/recoil/modal.ts +++ b/utils/recoil/modal.ts @@ -24,6 +24,8 @@ export const modalTypeState = selector({ modalType = 'TOURNAMENT'; } else if (prefix === 'ADMIN') { modalType = 'ADMIN'; + } else if (prefix === 'PARTY') { + modalType = 'PARTY'; } return modalType; }, From c20757a8980a1241a41ca6f49e7419c1a91f0e6a Mon Sep 17 00:00:00 2001 From: izone00 Date: Tue, 12 Mar 2024 15:15:40 +0900 Subject: [PATCH 04/67] =?UTF-8?q?[Feat]=20PartyAdmin=20axiosURL=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/axios.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/utils/axios.ts b/utils/axios.ts index c732eea3e..fae676554 100644 --- a/utils/axios.ts +++ b/utils/axios.ts @@ -2,9 +2,12 @@ import axios, { AxiosError } from 'axios'; const baseURL = `${process.env.NEXT_PUBLIC_SERVER_ENDPOINT}`; const manageBaseURL = process.env.NEXT_PUBLIC_MANAGE_SERVER_ENDPOINT ?? '/'; +const managePartyBaseURL = + process.env.NEXT_PUBLIC_PARTY_MANAGE_SERVER_ENDPOINT ?? '/'; const instance = axios.create({ baseURL }); const instanceInManage = axios.create({ baseURL: manageBaseURL }); +const instanceInPartyManage = axios.create({ baseURL: managePartyBaseURL }); instance.interceptors.request.use( function setConfig(config) { @@ -34,10 +37,24 @@ instanceInManage.interceptors.request.use( } ); +instanceInPartyManage.interceptors.request.use( + function setConfig(config) { + config.headers = { + 'Content-Type': 'application/json', + Authorization: `Bearer ${localStorage.getItem('42gg-token')}`, + }; + config.withCredentials = true; + return config; + }, + function getError(error) { + return Promise.reject(error); + } +); + function isAxiosError( error: unknown ): error is AxiosError { return axios.isAxiosError(error); } -export { instance, instanceInManage, isAxiosError }; +export { instance, instanceInManage, instanceInPartyManage, isAxiosError }; From d7cc825dc44251f06cb4349aeb7e2159be2b20e4 Mon Sep 17 00:00:00 2001 From: izone00 Date: Tue, 12 Mar 2024 15:16:11 +0900 Subject: [PATCH 05/67] =?UTF-8?q?[Feat]=20PartyCategory=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20hook=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/party/usePartyCategory.ts | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 hooks/party/usePartyCategory.ts diff --git a/hooks/party/usePartyCategory.ts b/hooks/party/usePartyCategory.ts new file mode 100644 index 000000000..2ff5d4f48 --- /dev/null +++ b/hooks/party/usePartyCategory.ts @@ -0,0 +1,52 @@ +import { useMutation, useQuery, useQueryClient } from 'react-query'; +import { useSetRecoilState } from 'recoil'; +import { PartyCategory } from 'types/partyTypes'; +import { instance, instanceInPartyManage } from 'utils/axios'; +import { toastState } from 'utils/recoil/toast'; + +export default function usePartyCategory() { + const queryClient = useQueryClient(); + const setSnackBar = useSetRecoilState(toastState); + + const { data } = useQuery({ + queryKey: 'partyCategory', + queryFn: () => + instance + .get('/party/categories') + .then(({ data }: { data: PartyCategory[] }) => data), + onError: () => { + setSnackBar({ + toastName: 'GET request', + message: '카테고리를 가져오는데 실패했습니다.', + severity: 'error', + clicked: true, + }); + }, + }); + + const createMutation = useMutation( + (categoryName: string) => + instanceInPartyManage.post('/categories', { categoryName }), + { + onSuccess: () => { + queryClient.invalidateQueries('partyCategory'); + }, + } + ); + const deleteMutation = useMutation( + (categoryId: number) => + instanceInPartyManage.delete(`/categories/${categoryId}`), + { + onSuccess: () => { + queryClient.invalidateQueries('partyCategory'); + }, + } + ); + + return { + categories: data ?? [], // undefind 대신 []을 이용해 에러 처리 + deleteCategory: (categoryId: number) => deleteMutation.mutate(categoryId), + createCategory: (categoryName: string) => + createMutation.mutate(categoryName), + }; +} From 46f24729e315f66c3eaaf5079ab8ad2737c2e1bb Mon Sep 17 00:00:00 2001 From: izone00 Date: Tue, 12 Mar 2024 19:56:19 +0900 Subject: [PATCH 06/67] =?UTF-8?q?[Feat]=20PartyTemplate=20API=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EA=B4=80=EB=A6=AC=20hook=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/party/usePartyTemplate.ts | 71 +++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 hooks/party/usePartyTemplate.ts diff --git a/hooks/party/usePartyTemplate.ts b/hooks/party/usePartyTemplate.ts new file mode 100644 index 000000000..c77b84305 --- /dev/null +++ b/hooks/party/usePartyTemplate.ts @@ -0,0 +1,71 @@ +import { useMutation, useQuery, useQueryClient } from 'react-query'; +import { useSetRecoilState } from 'recoil'; +import { PartyGameTemplate, PartyTemplateForm } from 'types/partyTypes'; +import { instance, instanceInPartyManage } from 'utils/axios'; +import { toastState } from 'utils/recoil/toast'; + +export function usePartyTemplate(categoryId?: number) { + const queryClient = useQueryClient(); + const setSnackBar = useSetRecoilState(toastState); + + const { data } = useQuery({ + queryKey: 'partyGameTemplate', + queryFn: () => + instance + .get('/party/templates') + .then(({ data }: { data: PartyGameTemplate[] }) => { + return categoryId + ? data.filter((d) => d.categoryId === categoryId) + : data; + }), + onError: () => { + setSnackBar({ + toastName: 'GET request', + message: '템플릿을 가져오는데 실패했습니다.', + severity: 'error', + clicked: true, + }); + }, + }); + + const createMutation = useMutation( + (templateForm: PartyTemplateForm) => + instanceInPartyManage.post('/templates', templateForm), + { + onSuccess: () => { + queryClient.invalidateQueries('partyGameTemplate'); + }, + } + ); + const updateMutation = useMutation( + (template: PartyGameTemplate) => + instanceInPartyManage.patch( + `/templates/${template.gameTemplateId}`, + template + ), + { + onSuccess: () => { + queryClient.invalidateQueries('partyGameTemplate'); + }, + } + ); + const deleteMutation = useMutation( + (gameTemplateId: number) => + instanceInPartyManage.delete(`/templates/${gameTemplateId}`), + { + onSuccess: () => { + queryClient.invalidateQueries('partyGameTemplate'); + }, + } + ); + + return { + templates: data ?? [], // undefind 대신 []을 이용해 에러 처리 + createTemplate: (template: PartyTemplateForm) => + createMutation.mutate(template), + updateTemplate: (template: PartyGameTemplate) => + updateMutation.mutate(template), + deleteTemplate: ({ gameTemplateId }: { gameTemplateId: number }) => + deleteMutation.mutate(gameTemplateId), + }; +} From 7f0eb790fdab46972617de276cd98db269260e1f Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 17:57:16 +0900 Subject: [PATCH 07/67] =?UTF-8?q?[Feat]=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=EC=82=AC=EC=9D=B4=EB=93=9C=EB=B0=94=EC=97=90=20=ED=8C=8C?= =?UTF-8?q?=ED=8B=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/SideNav.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/components/admin/SideNav.tsx b/components/admin/SideNav.tsx index 3d01b48fb..1628c994d 100644 --- a/components/admin/SideNav.tsx +++ b/components/admin/SideNav.tsx @@ -9,7 +9,13 @@ import { } from 'react-icons/gr'; import { IoGameControllerOutline, IoReceiptOutline } from 'react-icons/io5'; import { MdOutlineMessage } from 'react-icons/md'; -import { TbCalendarTime, TbCoin, TbPaperBag, TbTrophy } from 'react-icons/tb'; +import { + TbCalendarTime, + TbCoin, + TbPaperBag, + TbTrophy, + TbNote, +} from 'react-icons/tb'; import SideNavContent from 'components/admin/SideNavContent'; import styles from 'styles/admin/SideNav.module.scss'; @@ -121,6 +127,14 @@ export default function SideNav() { > + + + + ); } From bbe924849db9b1489159e68f64719f7d28e781d6 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 17:58:55 +0900 Subject: [PATCH 08/67] =?UTF-8?q?[Feat]=20=ED=8C=8C=ED=8B=B0=EC=8B=A0?= =?UTF-8?q?=EA=B3=A0=ED=83=AD=20nav=EB=B0=94=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/party/PartyNav.tsx | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 components/admin/party/PartyNav.tsx diff --git a/components/admin/party/PartyNav.tsx b/components/admin/party/PartyNav.tsx new file mode 100644 index 000000000..13938cd3b --- /dev/null +++ b/components/admin/party/PartyNav.tsx @@ -0,0 +1,40 @@ +import { useState } from 'react'; +import styles from 'styles/party/PartyNav.module.scss'; +import PartyCategory from './PartyCategory'; +import PartyPenalty from './PartyPenalty'; +import PartyReport from './PartyReport'; +import PartyRoomTable from './PartyRoomTable'; +import PartyTemplate from './PartyTemplate'; + +export default function PartyNav() { + const [navValue, setNavValue] = useState('penalty'); + return ( + <> +
+
    +
  • setNavValue('penalty')}> + 패널티 +
  • +
  • setNavValue('report')}> + 신고 관리 +
  • +
  • setNavValue('room')}> + 방 관리 +
  • +
  • setNavValue('template')}> + 템플릿 관리 +
  • +
  • setNavValue('category')}> + 카테고리 관리 +
  • +
+ + {navValue === 'penalty' && } + {navValue === 'report' && } + {navValue === 'room' && } + {navValue === 'template' && } + {navValue === 'category' && } +
+ + ); +} From 27e8f17d2dc67aa8900f138b34093c5e6e9ede2d Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 17:59:39 +0900 Subject: [PATCH 09/67] =?UTF-8?q?[Feat]=20scss=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/party/PartyCreate.module.scss | 7 ++ styles/party/PartyMain.module.scss | 94 +++++++++++++++++++++++++ styles/party/PartyNav.module.scss | 24 +++++++ styles/party/ParytyRoomList.module.scss | 58 +++++++++++++++ styles/party/TemplateModal.module.scss | 61 ++++++++++++++++ 5 files changed, 244 insertions(+) create mode 100644 styles/party/PartyCreate.module.scss create mode 100644 styles/party/PartyMain.module.scss create mode 100644 styles/party/PartyNav.module.scss create mode 100644 styles/party/ParytyRoomList.module.scss create mode 100644 styles/party/TemplateModal.module.scss diff --git a/styles/party/PartyCreate.module.scss b/styles/party/PartyCreate.module.scss new file mode 100644 index 000000000..8957e25ce --- /dev/null +++ b/styles/party/PartyCreate.module.scss @@ -0,0 +1,7 @@ +.detailForm { + form { + display: flex; + flex-direction: column; + align-items: center; + } +} diff --git a/styles/party/PartyMain.module.scss b/styles/party/PartyMain.module.scss new file mode 100644 index 000000000..b7bbcd24d --- /dev/null +++ b/styles/party/PartyMain.module.scss @@ -0,0 +1,94 @@ +@import 'styles/common.scss'; + +$dark-green: #024900; +$medium-green: #4f9237; +$light-green: #67a64a; + +.pageContainer { + @include pageWrap; + color: $white2; + background-color: $dark-green; + + section { + margin-bottom: 20px; + + h2 { + margin: 0 0 0.5em; + font-size: $big-font; + } + } +} + +.userManagementWrap { + width: 100%; + height: 100%; + + .header { + display: flex; + align-items: center; + justify-content: space-between; + width: 95%; + min-width: 710px; + margin: 10px auto; + .title { + font-size: $big-font; + font-weight: 600; + line-height: 150%; + } + } + + .button_1 { + padding: 4px 12px; + margin-bottom: 10px; + margin-left: 30px; + font-size: $small-font; + cursor: pointer; + border: none; + border-radius: $medium-radius; + } + .delete { + color: #ffffff; + background-color: #d73535; + &:hover { + background-color: #d71e1e; + transition: 0.3s; + } + } + .add { + color: white; + background-color: #10b981; + &:hover { + background-color: #059669; + transition: 0.3s; + } + } +} + +.categoryNav { + ul { + display: flex; + justify-content: space-between; + margin: 0 10px; + + li { + display: flex; + width: 25%; + padding: 0.5em 0; + margin: 0 2px; + font-size: $medium-font; + font-weight: 300; + list-style: none; + background-color: black; + border-top-left-radius: $medium-radius; + border-top-right-radius: $medium-radius; + transition: 0.3s ease width; + justify-content: center; + align-items: center; + + &.selected { + width: 30%; + background-color: $light-green; + } + } + } +} diff --git a/styles/party/PartyNav.module.scss b/styles/party/PartyNav.module.scss new file mode 100644 index 000000000..56bd73d6d --- /dev/null +++ b/styles/party/PartyNav.module.scss @@ -0,0 +1,24 @@ +@import 'styles/common.scss'; + +.container { + width: 100%; +} + +.ullist { + display: flex; + justify-content: center; + gap: 10px; + list-style: none; +} + +.lilist { + padding: 8px 16px; + cursor: pointer; + border: 2px solid #5b5a5a; + border-radius: 8px; + transition: background-color 0.3s ease; + + &:hover { + background-color: #eaeaea; + } +} diff --git a/styles/party/ParytyRoomList.module.scss b/styles/party/ParytyRoomList.module.scss new file mode 100644 index 000000000..8c07770fb --- /dev/null +++ b/styles/party/ParytyRoomList.module.scss @@ -0,0 +1,58 @@ +@import 'styles/common.scss'; + +$dark-green: #024900; +$medium-green: #4f9237; +$light-green: #67a64a; + +.roomListWrap { + padding: 0.5em; + margin: 0; + background-color: $medium-green; + border-radius: $medium-radius; + + .roomItemWrap { + display: flex; + padding: 0.5em; + margin: 2px 0; + color: black; + background-color: $white2; + border-radius: $medium-radius; + justify-content: space-between; + align-items: center; + + .verticalLine { + width: 4px; + background-color: black; + } + + .roomItemDescWrap { + position: relative; + width: 100%; + .roomItemCategory { + font-size: $small-font; + font-weight: 400; + color: $dark-gray; + } + .roomItemTitle { + margin-left: 0.2em; + font-size: $big-font; + } + + &::after { + position: absolute; + top: 0; + right: 0; + box-sizing: border-box; + width: 0; + height: 100%; + content: ''; + border: 1px solid $medium-gray; + } + } + + .roomPeopleWrap { + margin-left: 0.5em; + letter-spacing: 0.1em; + } + } +} diff --git a/styles/party/TemplateModal.module.scss b/styles/party/TemplateModal.module.scss new file mode 100644 index 000000000..27926bc30 --- /dev/null +++ b/styles/party/TemplateModal.module.scss @@ -0,0 +1,61 @@ +/* Modal.css */ + +.modal-overlay { + position: fixed; + top: 0; + left: 0; + z-index: 9999; + display: flex; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); /* 반투명한 배경 */ + justify-content: center; + align-items: center; +} + +.button_2 { + width: 100%; + padding: 10px; + margin: 10px; + font-size: 30px; + color: white; + cursor: pointer; + background: black; + border: 0; + border-radius: 10px; + outline: none; +} + +.button_2:hover { + color: white; + background: orange; +} + +.modal { + width: 30%; + padding: 20px; + background-color: white; + border-radius: 5px; + box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5); /* 그림자 효과 */ +} + +.modal h2 { + margin-top: 0; +} + +.modal form { + display: flex; + flex-direction: column; +} + +.modal label { + margin-bottom: 5px; +} + +.modal input { + width: 100%; + padding: 5px; + margin-bottom: 10px; + border: 1px solid #ccc; + border-radius: 3px; +} From 9dd5461ae8c25059d6fcad93e22a5f0e4052fed6 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:00:16 +0900 Subject: [PATCH 10/67] =?UTF-8?q?[Feat]=20=ED=8C=8C=ED=8B=B0=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/admin/party.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 pages/admin/party.tsx diff --git a/pages/admin/party.tsx b/pages/admin/party.tsx new file mode 100644 index 000000000..1f90b0d2d --- /dev/null +++ b/pages/admin/party.tsx @@ -0,0 +1,9 @@ +import PartyNav from 'components/admin/party/PartyNav'; + +export default function Party() { + return ( + <> + + + ); +} From 8c42e05a086be906f185b9c9208d1259fa441ef2 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:03:54 +0900 Subject: [PATCH 11/67] =?UTF-8?q?[Feat]=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=ED=8C=8C=ED=8B=B0=20=EA=B4=80=EB=A0=A8=20=ED=83=80=EC=9E=85?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/modal/modalType/AdminModal.tsx | 4 ++ constants/admin/table.ts | 82 +++++++++++++++++++++++ types/admin/tableTypes.ts | 9 ++- types/modalTypes.ts | 8 ++- types/partyTypes.ts | 43 ++++++------ 5 files changed, 120 insertions(+), 26 deletions(-) diff --git a/components/modal/modalType/AdminModal.tsx b/components/modal/modalType/AdminModal.tsx index a819a2e07..e1bdb96a9 100644 --- a/components/modal/modalType/AdminModal.tsx +++ b/components/modal/modalType/AdminModal.tsx @@ -15,8 +15,10 @@ import AdminUserCoinModal from 'components/modal/admin/AdminUserCoinModal'; import DeletePenaltyModal from 'components/modal/admin/DeletePenaltyModal'; import DetailModal from 'components/modal/admin/DetailModal'; import AdminSeasonEdit from 'components/modal/admin/SeasonEdit'; +import TemplateModal from 'components/modal/Party/TemplateModal'; import AdminEditTournamentBraket from '../admin/AdminEditTournamentBraket'; import AdminTournamentParticipantEditModal from '../admin/AdminTournamentParticipantEditModal/AdminTournamentParticipantEditModal'; +import PartyRoomEditModal from '../Party/PartyRoomEditModal'; export default function AdminModal() { const { @@ -34,6 +36,7 @@ export default function AdminModal() { coinPolicy, tournament, tournamentId, + template, } = useRecoilValue(modalState); if (!modalName) { @@ -90,6 +93,7 @@ export default function AdminModal() { 'ADMIN-TOURNAMENT_PARTICIPANT_EDIT': tournamentId ? ( ) : null, + 'ADMIN-PARTY_TEMPLATE': , }; return content[modalName]; diff --git a/constants/admin/table.ts b/constants/admin/table.ts index ca6d8a607..ab0fa7c64 100644 --- a/constants/admin/table.ts +++ b/constants/admin/table.ts @@ -158,4 +158,86 @@ export const tableFormat: TableFormat = { name: '토너먼트 생성', columns: ['title', 'startTime', 'endTime', 'type'], }, + partyRoom: { + name: '파티방', + columns: [ + 'roomId', + 'title', + 'categoryName', + 'createDate', + 'dueDate', + 'creatorIntraId', + 'roomStatus', + 'etc', + ], + etc: { + type: 'button', + value: ['해제'], + }, + }, + partyCategory: { + name: '파티 카테고리', + columns: ['categoryId', 'categoryName', 'delete'], + }, + partyTemplate: { + name: '파티 템플릿', + columns: [ + 'gameTemplateId', + 'categoryId', + 'gameName', + 'maxGamePeople', + 'minGamePeople', + 'maxGameTime', + 'minGameTime', + 'genre', + 'difficulty', + 'summary', + 'change', + 'delete', + ], + }, + partyNoshowReport: { + name: '파티노쇼 신고', + columns: [ + 'id', + 'reporterId', + 'reporteeId', + 'roomId', + 'message', + 'createdAt', + ], + }, + partyRoomReport: { + name: '방 신고', + columns: [ + 'id', + 'reporterId', + 'reporteeId', + 'roomId', + 'message', + 'createdAt', + ], + }, + partyCommentReport: { + name: '댓글 신고', + columns: [ + 'id', + 'reporterId', + 'commentsId', + 'roomId', + 'message', + 'createdAt', + ], + }, + partyPenaltyAdmin: { + name: '파티 패널티', + columns: [ + 'id', + 'user', + 'penaltyType', + 'message', + 'startTime', + 'penaltyTime', + ], + }, }; diff --git a/types/admin/tableTypes.ts b/types/admin/tableTypes.ts index 333b85d68..445547b9c 100644 --- a/types/admin/tableTypes.ts +++ b/types/admin/tableTypes.ts @@ -17,7 +17,14 @@ export type TableName = | 'coinPolicy' | 'coinPolicyHistory' | 'tournament' - | 'tournamentCreate'; + | 'tournamentCreate' + | 'partyRoom' + | 'partyCategory' + | 'partyTemplate' + | 'partyNoshowReport' + | 'partyRoomReport' + | 'partyCommentReport' + | 'partyPenaltyAdmin'; export type EtcType = 'button' | 'toggle'; diff --git a/types/modalTypes.ts b/types/modalTypes.ts index a1101efa8..e6853b851 100644 --- a/types/modalTypes.ts +++ b/types/modalTypes.ts @@ -13,6 +13,7 @@ import { StoreManualMode } from 'types/storeTypes'; import { ICoin } from 'types/userTypes'; import { ITournament } from './admin/adminTournamentTypes'; import { GameMode } from './gameTypes'; +import { PartyGameTemplate } from './partyTypes'; import { TournamentInfo } from './tournamentTypes'; type EventModal = 'WELCOME' | 'ANNOUNCEMENT'; @@ -35,6 +36,8 @@ type StoreModal = 'MANUAL' | 'COIN_HISTORY'; type TournamentModal = 'REGISTRY' | 'MANUAL'; +type PartyModal = 'REPORT'; + type AdminModal = | 'PROFILE' | 'USER-COIN' @@ -52,7 +55,9 @@ type AdminModal = | 'COINPOLICY_EDIT' | 'CHECK_SEND_NOTI' | 'TOURNAMENT_BRAKET_EDIT' - | 'TOURNAMENT_PARTICIPANT_EDIT'; + | 'TOURNAMENT_PARTICIPANT_EDIT' + | 'PARTY_EDIT' + | 'PARTY_TEMPLATE'; type ModalName = | null @@ -142,4 +147,5 @@ export interface Modal { tournamentInfo?: TournamentInfo; tournament?: ITournament; tournamentId?: number; + template?: PartyGameTemplate; } diff --git a/types/partyTypes.ts b/types/partyTypes.ts index c4cbff528..d4b485042 100644 --- a/types/partyTypes.ts +++ b/types/partyTypes.ts @@ -1,8 +1,5 @@ -export type PartyRoomStatus = 'OPEN' | 'START' | 'FINISH' | 'HIDDEN' | 'FAIL'; -/** - * @typedef {Object} PartyRoom - * @property {string} [creatorIntraId] - adminAPI로 조회시 존재 - */ +export type PartyRoomStatus = 'OPEN' | 'START' | 'FINISH' | 'HIDDEN'; + export type PartyRoom = { roomId: number; title: string; @@ -16,37 +13,25 @@ export type PartyRoom = { creatorIntraId?: string; }; -/** - * @typedef {Object} PartyRoomDetail - * @property {string | null} [myNickname] - Room 참여시 존재 - */ export type PartyRoomDetail = PartyRoom & { - myNickname: string | null; - hostNickname: string; + myNickname: string | null; // 촉촉한 초코칩 + hostNickname: string; // 촉촉한 초코칩 content: string; roomUsers: PartyRoomUser[]; comments: PartyComment[]; }; -/** - * @typedef {Object} PartyRoomUser - * @property {string | null} [intraId] - Room 시작시 or Admin으로 조회시 존재 - */ export type PartyRoomUser = { roomUserId: number; nickname: string; - intraId: string | null; + intraId?: string; }; -/** - * @typedef {Object} PartyRoomDetail - * @property {string | null} [intraid] - Room 시작시 or Admin으로 조회시 존재 - */ +// 닉네임과 아이디를 가지고 있는 api를 만들어줌. 추가 필요. + export type PartyComment = { commentId: number; - nickname: string; - intraid: string | null; - isexist: boolean; + nickname: string; // 촉촉한 초코칩 content: string; isHidden: boolean; createDate: string; @@ -97,7 +82,7 @@ export type PartyCommentReport = { createdAt: string; }; -export type PartyCreateForm = { +export type PartyForm = { title: string; categoryId: number; minPeople: number; @@ -107,6 +92,7 @@ export type PartyCreateForm = { }; export type PartyTemplateForm = { + gameTemplateId?: number; gameName: string; categoryId: number; maxGamePeople: number; @@ -117,3 +103,12 @@ export type PartyTemplateForm = { difficulty: string; summary: string; }; + +export type PartyPenaltyAdmin = { + id: number; + user: object; + penaltyType: string; + message: string; + startTime: string; + penaltyTime: number; +}; From ede1e74ac3df145324058b3b37c8410537b99e64 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:05:45 +0900 Subject: [PATCH 12/67] =?UTF-8?q?[Feat]=20=ED=8C=8C=ED=8B=B0=20=20?= =?UTF-8?q?=EC=96=B4=EB=93=9C=EB=AF=BC=20=EC=8B=A0=EA=B3=A0=20=EC=95=88?= =?UTF-8?q?=EC=9D=98=20=EC=83=81=EC=84=B8=20=EB=85=B8=EC=87=BC=EC=8B=A0?= =?UTF-8?q?=EA=B3=A0,=20=EB=B0=A9=EC=8B=A0=EA=B3=A0,=20=EB=8C=93=EA=B8=80?= =?UTF-8?q?=EC=8B=A0=EA=B3=A0=20nav=EB=B0=94=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/party/PartyReport.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 components/admin/party/PartyReport.tsx diff --git a/components/admin/party/PartyReport.tsx b/components/admin/party/PartyReport.tsx new file mode 100644 index 000000000..d5b9d412c --- /dev/null +++ b/components/admin/party/PartyReport.tsx @@ -0,0 +1,8 @@ +import PartyReportNav from './PartyReportNav'; +export default function PartyReport() { + return ( + <> + + + ); +} From 489a1e2abea786104c0b2a7f0b6f01436f0fb203 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:07:46 +0900 Subject: [PATCH 13/67] =?UTF-8?q?[Feat]=ED=8C=8C=ED=8B=B0=20=ED=85=9C?= =?UTF-8?q?=ED=94=8C=EB=A6=BF=20=ED=83=AD,=20=EB=AA=A8=EB=8B=AC=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/party/PartyTemplate.tsx | 105 ++++++++++++++++++ components/modal/Party/TemplateModal.tsx | 130 +++++++++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 components/admin/party/PartyTemplate.tsx create mode 100644 components/modal/Party/TemplateModal.tsx diff --git a/components/admin/party/PartyTemplate.tsx b/components/admin/party/PartyTemplate.tsx new file mode 100644 index 000000000..0b158093b --- /dev/null +++ b/components/admin/party/PartyTemplate.tsx @@ -0,0 +1,105 @@ +import React, { useEffect } from 'react'; +import { useSetRecoilState } from 'recoil'; +import { + Paper, + Table, + TableBody, + TableCell, + TableContainer, + TableRow, +} from '@mui/material'; +import { PartyGameTemplate } from 'types/partyTypes'; +import { modalState } from 'utils/recoil/modal'; +import { tableFormat } from 'constants/admin/table'; +import { AdminTableHead } from 'components/admin/common/AdminTable'; +import { usePartyTemplate } from 'hooks/party/usePartyTemplate'; +import styles from 'styles/party/PartyMain.module.scss'; + +const tableTitle: { [key: string]: string } = { + gameTemplateId: '템플릿번호', + categoryId: '카테고리', + gameName: '템플릿이름', + maxGamePeople: '최대인원', + minGamePeople: '최소인원', + maxGameTime: '최대게임시간', + minGameTime: '최소게임시간', + genre: '장르', + difficulty: '난이도', + summary: '요약', + change: '수정', + delete: '삭제', +}; + +export default function PartyTemplate() { + const { templates, deleteTemplate } = usePartyTemplate(); + const setModal = useSetRecoilState(modalState); + + useEffect(() => { + console.log('Render'); + }, [templates]); + const handleEditTemplate = (template?: PartyGameTemplate) => { + setModal({ modalName: 'ADMIN-PARTY_TEMPLATE', template }); + }; + + const handleAddTemplate = () => { + setModal({ modalName: 'ADMIN-PARTY_TEMPLATE' }); + }; + + const deleteHandler = (gameTemplateId: number) => { + deleteTemplate({ gameTemplateId }); + }; + + return ( +
+
+
+ 템플릿 관리 +
+ + + + + + {templates.map((t) => ( + + {tableFormat['partyTemplate'].columns.map((columnName) => { + return ( + + {columnName === 'change' && ( + + )} + {columnName === 'delete' ? ( + + ) : ( + t[columnName as keyof PartyGameTemplate]?.toString() + )} + + ); + })} + + ))} + +
+
+
+
+ ); +} diff --git a/components/modal/Party/TemplateModal.tsx b/components/modal/Party/TemplateModal.tsx new file mode 100644 index 000000000..8de8495c1 --- /dev/null +++ b/components/modal/Party/TemplateModal.tsx @@ -0,0 +1,130 @@ +import React, { useState, useEffect } from 'react'; +import { useSetRecoilState } from 'recoil'; +import { PartyGameTemplate, PartyTemplateForm } from 'types/partyTypes'; +import { modalState } from 'utils/recoil/modal'; +import { usePartyTemplate } from 'hooks/party/usePartyTemplate'; +import styles from 'styles/party/TemplateModal.module.scss'; + +function isUpdate(formData: PartyTemplateForm): formData is PartyGameTemplate { + return !!formData.gameTemplateId; +} + +export default function TemplateModal({ + template, +}: { + template?: PartyTemplateForm; +}) { + const [formData, setFormData] = useState( + template ?? { + gameName: '', + categoryId: 1, + maxGamePeople: 0, + minGamePeople: 0, + maxGameTime: 0, + minGameTime: 0, + genre: '', + difficulty: '', + summary: '', + } + ); + const setModal = useSetRecoilState(modalState); + const { createTemplate, updateTemplate } = usePartyTemplate(); + + useEffect(() => { + if (template) { + setFormData(template); + } + }, []); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + if (isUpdate(formData)) updateTemplate(formData); + else createTemplate(formData); + setModal({ modalName: null }); + }; + + return ( + <> +
+
+

{template ? '템플릿 변경' : '템플릿 추가'}

+
+ + + setFormData({ ...formData, gameName: e.target.value }) + } + /> + + + setFormData({ ...formData, maxGamePeople: +e.target.value }) + } + /> + + + setFormData({ ...formData, minGamePeople: +e.target.value }) + } + /> + + + setFormData({ ...formData, maxGameTime: +e.target.value }) + } + /> + + + setFormData({ ...formData, minGameTime: +e.target.value }) + } + /> + + + setFormData({ ...formData, genre: e.target.value }) + } + /> + + + setFormData({ ...formData, difficulty: e.target.value }) + } + /> + + + setFormData({ ...formData, summary: e.target.value }) + } + /> + + +
+
+
+ + ); +} From bc4603cef545520eb7805d4a46fb421513bb3149 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:08:16 +0900 Subject: [PATCH 14/67] =?UTF-8?q?[Feat]=20=EB=85=B8=EC=87=BC=EA=B4=80?= =?UTF-8?q?=EB=A6=AC,=20=EB=8C=93=EA=B8=80=EA=B4=80=EB=A6=AC,=20=EB=B0=A9?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20nav?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/party/PartyReportNav.tsx | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 components/admin/party/PartyReportNav.tsx diff --git a/components/admin/party/PartyReportNav.tsx b/components/admin/party/PartyReportNav.tsx new file mode 100644 index 000000000..4ac0d5f3b --- /dev/null +++ b/components/admin/party/PartyReportNav.tsx @@ -0,0 +1,29 @@ +import { useState } from 'react'; +import styles from 'styles/party/PartyNav.module.scss'; +import AdminCommentReport from './AdminCommentReport'; +import AdminPartyRoomReport from './AdminPartyRoomReport'; +import PartyNoShowReport from './PartyNoShowReport'; + +export default function PartyReportNav() { + const [navValue, setNavValue] = useState('noshow'); + return ( + <> +
+
    +
  • setNavValue('noshow')}> + 노쇼 관리 +
  • +
  • setNavValue('comment')}> + 댓글 관리 +
  • +
  • setNavValue('room')}> + 방 관리 +
  • +
+ {navValue === 'noshow' && } + {navValue === 'comment' && } + {navValue === 'room' && } +
+ + ); +} From fe55942dcc18cc9a0b0da2a227eccabf1990f425 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:08:44 +0900 Subject: [PATCH 15/67] =?UTF-8?q?[Feat]=20=ED=8C=8C=ED=8B=B0=20=EC=96=B4?= =?UTF-8?q?=EB=93=9C=EB=AF=BC=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC?= =?UTF-8?q?=ED=83=AD=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/party/PartyCategory.tsx | 87 ++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 components/admin/party/PartyCategory.tsx diff --git a/components/admin/party/PartyCategory.tsx b/components/admin/party/PartyCategory.tsx new file mode 100644 index 000000000..8368a04dc --- /dev/null +++ b/components/admin/party/PartyCategory.tsx @@ -0,0 +1,87 @@ +import { useState } from 'react'; +import { + Paper, + Table, + TableBody, + TableCell, + TableContainer, + TableRow, +} from '@mui/material'; +import { PartyCategory } from 'types/partyTypes'; +import { tableFormat } from 'constants/admin/table'; +import { AdminTableHead } from 'components/admin/common/AdminTable'; +import usePartyCategory from 'hooks/party/usePartyCategory'; +import styles from 'styles/party/PartyMain.module.scss'; + +const tableTitle: { [key: string]: string } = { + categoryId: '카테고리번호', + categoryName: '카테고리', + delete: '삭제', +}; + +export default function PartyCategories() { + const { categories, createCategory, deleteCategory } = usePartyCategory(); + const [newCategoryName, setNewCategoryName] = useState(''); + + const handleConfirm = () => { + if (newCategoryName.trim() !== '') { + createCategory(newCategoryName); + console.log(newCategoryName); + } + }; + + const deletehandler = (categoryId: number) => { + deleteCategory(categoryId); + }; + + return ( +
+
+ 카테고리 관리 +
+ setNewCategoryName(e.target.value)} + /> + +
+
+ + + + + {categories.map((c) => ( + + {tableFormat['partyCategory'].columns.map((columnName) => { + return ( + + {columnName === 'delete' ? ( + + ) : ( + c[columnName as keyof PartyCategory]?.toString() + )} + + ); + })} + + ))} + +
+
+
+ ); +} From 2b1244d9f39aecf1fe1b65721a1053c72c5aaf41 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:36:24 +0900 Subject: [PATCH 16/67] =?UTF-8?q?[Feat]=20=EB=B0=A9=20=EC=8B=A0=EA=B3=A0?= =?UTF-8?q?=20=ED=83=AD=20=EA=B5=AC=ED=98=84=20,=20usePartyRoomReport=20?= =?UTF-8?q?=ED=9B=85=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/party/AdminPartyRoomReport.tsx | 54 +++++++++++++++++++ hooks/party/usePartyRoomReport.tsx | 29 ++++++++++ 2 files changed, 83 insertions(+) create mode 100644 components/admin/party/AdminPartyRoomReport.tsx create mode 100644 hooks/party/usePartyRoomReport.tsx diff --git a/components/admin/party/AdminPartyRoomReport.tsx b/components/admin/party/AdminPartyRoomReport.tsx new file mode 100644 index 000000000..dd7e0b8b6 --- /dev/null +++ b/components/admin/party/AdminPartyRoomReport.tsx @@ -0,0 +1,54 @@ +import { + Paper, + Table, + TableBody, + TableCell, + TableContainer, + TableRow, +} from '@mui/material'; +import { tableFormat } from 'constants/admin/table'; +import { AdminTableHead } from 'components/admin/common/AdminTable'; +import { usePartyRoomReport } from 'hooks/party/usePartyRoomReport'; +import styles from 'styles/party/PartyMain.module.scss'; + +const tableTitle: { [key: string]: string } = { + id: '번호', + reporterIntraId: '신고자 이름', + reporteeIntraId: '피신고자 이름', + roomId: '방', + message: '메세지', + createdAt: '시간', +}; + +export default function AdminPartyRoomReport() { + const { roomReports } = usePartyRoomReport(); + + return ( +
+
+ 방 신고리스트 +
+ + + + + {roomReports.map((r) => ( + + {tableFormat['partyRoomReport'].columns.map((columnName) => { + return ( + + {/* r[columnName as keyof PartyRoomReport]?.toString() */} + + ); + })} + + ))} + +
+
+
+ ); +} diff --git a/hooks/party/usePartyRoomReport.tsx b/hooks/party/usePartyRoomReport.tsx new file mode 100644 index 000000000..5802ac04c --- /dev/null +++ b/hooks/party/usePartyRoomReport.tsx @@ -0,0 +1,29 @@ +import { useQuery } from 'react-query'; +import { useSetRecoilState } from 'recoil'; +import { PartyRoomReport } from 'types/partyTypes'; +import { instance } from 'utils/axios'; +import { toastState } from 'utils/recoil/toast'; + +export function usePartyRoomReport() { + const setSnackBar = useSetRecoilState(toastState); + + const { data } = useQuery({ + queryKey: 'PartyRoomReport', + queryFn: () => + instance + .get('/party/admin/reports/rooms') + .then(({ data }: { data: PartyRoomReport[] }) => data), + onError: () => { + setSnackBar({ + toastName: 'GET request', + message: '방 신고를 가져오는데 실패했습니다.', + severity: 'error', + clicked: true, + }); + }, + }); + + return { + roomReports: data ?? [], // undefind 대신 []을 이용해 에러 처리 + }; +} From d1de36fd44680bb8ac860a5190bb4d7f96a35b5b Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:39:28 +0900 Subject: [PATCH 17/67] =?UTF-8?q?[fix]=20=EB=B0=A9=EC=8B=A0=EA=B3=A0=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/party/AdminPartyRoomReport.tsx | 4 ++-- .../{usePartyRoomReport.tsx => useAdminPartyRoomReport.tsx} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename hooks/party/{usePartyRoomReport.tsx => useAdminPartyRoomReport.tsx} (94%) diff --git a/components/admin/party/AdminPartyRoomReport.tsx b/components/admin/party/AdminPartyRoomReport.tsx index dd7e0b8b6..c6ebf7985 100644 --- a/components/admin/party/AdminPartyRoomReport.tsx +++ b/components/admin/party/AdminPartyRoomReport.tsx @@ -8,7 +8,7 @@ import { } from '@mui/material'; import { tableFormat } from 'constants/admin/table'; import { AdminTableHead } from 'components/admin/common/AdminTable'; -import { usePartyRoomReport } from 'hooks/party/usePartyRoomReport'; +import { useAdminPartyRoomReport } from 'hooks/party/useAdminPartyRoomReport'; import styles from 'styles/party/PartyMain.module.scss'; const tableTitle: { [key: string]: string } = { @@ -21,7 +21,7 @@ const tableTitle: { [key: string]: string } = { }; export default function AdminPartyRoomReport() { - const { roomReports } = usePartyRoomReport(); + const { roomReports } = useAdminPartyRoomReport(); return (
diff --git a/hooks/party/usePartyRoomReport.tsx b/hooks/party/useAdminPartyRoomReport.tsx similarity index 94% rename from hooks/party/usePartyRoomReport.tsx rename to hooks/party/useAdminPartyRoomReport.tsx index 5802ac04c..d09cd0aef 100644 --- a/hooks/party/usePartyRoomReport.tsx +++ b/hooks/party/useAdminPartyRoomReport.tsx @@ -4,7 +4,7 @@ import { PartyRoomReport } from 'types/partyTypes'; import { instance } from 'utils/axios'; import { toastState } from 'utils/recoil/toast'; -export function usePartyRoomReport() { +export function useAdminPartyRoomReport() { const setSnackBar = useSetRecoilState(toastState); const { data } = useQuery({ From 63d55e2482669003397b6cd861b27f19bab1d62d Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:45:26 +0900 Subject: [PATCH 18/67] =?UTF-8?q?[Feat]=20=EB=8C=93=EA=B8=80=EC=8B=A0?= =?UTF-8?q?=EA=B3=A0=EC=A1=B0=ED=9A=8C=ED=83=AD=20=EA=B5=AC=ED=98=84,=20us?= =?UTF-8?q?eAdminpartyComment=20=ED=9B=85=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/party/AdminCommentReport.tsx | 55 +++++++++++++++++++ hooks/party/useAdminPartyComment.tsx | 29 ++++++++++ 2 files changed, 84 insertions(+) create mode 100644 components/admin/party/AdminCommentReport.tsx create mode 100644 hooks/party/useAdminPartyComment.tsx diff --git a/components/admin/party/AdminCommentReport.tsx b/components/admin/party/AdminCommentReport.tsx new file mode 100644 index 000000000..2c4d2e77c --- /dev/null +++ b/components/admin/party/AdminCommentReport.tsx @@ -0,0 +1,55 @@ +import { + Paper, + Table, + TableBody, + TableCell, + TableContainer, + TableRow, +} from '@mui/material'; +import { PartyCommentReport } from 'types/partyTypes'; +import { tableFormat } from 'constants/admin/table'; +import { AdminTableHead } from 'components/admin/common/AdminTable'; +import { useAdminPartyCommentReport } from 'hooks/party/useAdminPartyComment'; +import styles from 'styles/party/PartyMain.module.scss'; + +const tableTitle: { [key: string]: string } = { + id: '번호', + reporterIntraId: '신고자 이름', + commentsId: '댓글 번호', + roomId: '방', + message: '메세지', + createdAt: '시간', +}; + +export default function AdminCommentReport() { + const { commentReports } = useAdminPartyCommentReport(); + + return ( +
+
+ 댓글 신고리스트 +
+ + + + + {commentReports.map((rc) => ( + + {tableFormat['partyCommentReport'].columns.map((columnName) => { + return ( + + {rc[columnName as keyof PartyCommentReport]?.toString()} + + ); + })} + + ))} + +
+
+
+ ); +} diff --git a/hooks/party/useAdminPartyComment.tsx b/hooks/party/useAdminPartyComment.tsx new file mode 100644 index 000000000..c7e0750b5 --- /dev/null +++ b/hooks/party/useAdminPartyComment.tsx @@ -0,0 +1,29 @@ +import { useQuery } from 'react-query'; +import { useSetRecoilState } from 'recoil'; +import { PartyCommentReport } from 'types/partyTypes'; +import { instance } from 'utils/axios'; +import { toastState } from 'utils/recoil/toast'; + +export function useAdminPartyCommentReport() { + const setSnackBar = useSetRecoilState(toastState); + + const { data } = useQuery({ + queryKey: 'PartyCommentReport', + queryFn: () => + instance + .get('/party/admin/reports/comments') + .then(({ data }: { data: PartyCommentReport[] }) => data), + onError: () => { + setSnackBar({ + toastName: 'GET request', + message: '방 신고를 가져오는데 실패했습니다.', + severity: 'error', + clicked: true, + }); + }, + }); + + return { + commentReports: data ?? [], // undefind 대신 []을 이용해 에러 처리 + }; +} From 959c216352576ef4e24a302a74ddba3b17e40cdb Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:47:23 +0900 Subject: [PATCH 19/67] =?UTF-8?q?[Fix]=20=EB=B0=A9=EC=8B=A0=EA=B3=A0=20?= =?UTF-8?q?=EC=B6=9C=EB=A0=A5=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/party/AdminPartyRoomReport.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/admin/party/AdminPartyRoomReport.tsx b/components/admin/party/AdminPartyRoomReport.tsx index c6ebf7985..32662a4ba 100644 --- a/components/admin/party/AdminPartyRoomReport.tsx +++ b/components/admin/party/AdminPartyRoomReport.tsx @@ -6,6 +6,7 @@ import { TableContainer, TableRow, } from '@mui/material'; +import { PartyRoomReport } from 'types/partyTypes'; import { tableFormat } from 'constants/admin/table'; import { AdminTableHead } from 'components/admin/common/AdminTable'; import { useAdminPartyRoomReport } from 'hooks/party/useAdminPartyRoomReport'; @@ -40,7 +41,7 @@ export default function AdminPartyRoomReport() { className={styles.tableBodyItem} key={columnName} > - {/* r[columnName as keyof PartyRoomReport]?.toString() */} + {r[columnName as keyof PartyRoomReport]?.toString()} ); })} From 6bf6d964a708b4d36e572ebf4295df2891be4d3f Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 18:51:04 +0900 Subject: [PATCH 20/67] =?UTF-8?q?[Fix]=20=ED=85=9C=ED=94=8C=EB=A6=BF=20?= =?UTF-8?q?=EB=AA=A8=EB=8B=AC=EC=A0=9C=EC=B6=9C=EC=8B=9C=20=20type=3Dsubmi?= =?UTF-8?q?t=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/modal/Party/TemplateModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/modal/Party/TemplateModal.tsx b/components/modal/Party/TemplateModal.tsx index 8de8495c1..3f3d0afa5 100644 --- a/components/modal/Party/TemplateModal.tsx +++ b/components/modal/Party/TemplateModal.tsx @@ -113,7 +113,7 @@ export default function TemplateModal({ setFormData({ ...formData, summary: e.target.value }) } /> -
diff --git a/hooks/party/useAdminPartyNoShow.tsx b/hooks/party/useAdminPartyNoShow.tsx new file mode 100644 index 000000000..08b387c00 --- /dev/null +++ b/hooks/party/useAdminPartyNoShow.tsx @@ -0,0 +1,29 @@ +import { useQuery } from 'react-query'; +import { useSetRecoilState } from 'recoil'; +import { PartyNoshowReport } from 'types/partyTypes'; +import { instance } from 'utils/axios'; +import { toastState } from 'utils/recoil/toast'; + +export function useAdminPartyNoshow() { + const setSnackBar = useSetRecoilState(toastState); + + const { data } = useQuery({ + queryKey: 'PartyNoshowReport', + queryFn: () => + instance + .get('/party/admin/reports/users') + .then(({ data }: { data: PartyNoshowReport[] }) => data), + onError: () => { + setSnackBar({ + toastName: 'GET request', + message: '방 신고를 가져오는데 실패했습니다.', + severity: 'error', + clicked: true, + }); + }, + }); + + return { + noShowReports: data ?? [], // undefind 대신 []을 이용해 에러 처리 + }; +} From 9d6126a0a3aae764abd656b46cd11821dc159801 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 20:52:43 +0900 Subject: [PATCH 22/67] =?UTF-8?q?[Feat]=20=EB=A9=94=EC=9D=B8=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=97=90=20=ED=8C=8C=ED=8B=B0=ED=94=84?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/main/PartyPreview.tsx | 23 ++++++++++++++++++++ pages/index.tsx | 1 + styles/main/PartyPreview.module.scss | 32 ++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 components/main/PartyPreview.tsx create mode 100644 styles/main/PartyPreview.module.scss diff --git a/components/main/PartyPreview.tsx b/components/main/PartyPreview.tsx new file mode 100644 index 000000000..8782e0866 --- /dev/null +++ b/components/main/PartyPreview.tsx @@ -0,0 +1,23 @@ +import usePartyRoom from 'hooks/party/usePartyList'; +import styles from 'styles/main/PartyPreview.module.scss'; +export default function PartyPreview() { + const { partyRooms } = usePartyRoom(); + const limitedRooms = partyRooms.slice(0, 3); + console.log(partyRooms); + return ( +
+
    + {limitedRooms.map((room) => ( +
  • +
    + {room.title} + {`${room.currentPeople}/${room.maxPeople}`} +
    +
  • + ))} +
+
+ ); +} diff --git a/pages/index.tsx b/pages/index.tsx index 5e9913eb2..ce4019266 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -15,6 +15,7 @@ const Home: NextPage = () => { tournamentData.liveTournament?.length > 0) && (
)} +
diff --git a/styles/main/PartyPreview.module.scss b/styles/main/PartyPreview.module.scss new file mode 100644 index 000000000..ce74559e8 --- /dev/null +++ b/styles/main/PartyPreview.module.scss @@ -0,0 +1,32 @@ +@import 'styles/common.scss'; + +.block { + display: flex; + width: 100%; + height: 3rem; + margin-bottom: 0.5rem; + color: white; + // te + text-align: center; + // background: #6953db; + background: rgba(0, 0, 0, 0.33); + border-radius: 1rem; + justify-content: center; /* 수평 가운데 정렬 */ + align-items: center; /* 수직 가운데 정렬 */ + & > div { + display: flex; + justify-content: space-between; /* span 요소 사이에 공간을 일정하게 배분 */ + width: 100%; + } +} +.block span { + flex-grow: 0; /* 고정 크기 */ + flex-shrink: 0; /* 고정 크기 */ + flex-basis: 30%; /* 초기 크기 설정 (임의의 값) */ +} + +.container { + padding: 0.5rem; /* 컨테이너 안쪽 여백 설정 */ + background: linear-gradient(180deg, #8218e6 0%, #8110d7 100%); + border-radius: $small-radius; +} From faa79ee325d9e39dcad11d18b83bf6fb42377146 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Wed, 13 Mar 2024 20:53:26 +0900 Subject: [PATCH 23/67] =?UTF-8?q?[Feat]=ED=94=84=EB=A6=AC=EB=B7=B0?= =?UTF-8?q?=EB=A5=BC=20=EC=9C=84=ED=95=9C=20section=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EA=B2=BD=EB=A1=9C=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/main/Section.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/main/Section.tsx b/components/main/Section.tsx index 1c4019eca..67e561f73 100644 --- a/components/main/Section.tsx +++ b/components/main/Section.tsx @@ -5,6 +5,7 @@ import GameResult from 'components/game/GameResult'; import TournamentPreview from 'components/main/TournamentPreview'; import RankListMain from 'components/rank/topRank/RankListMain'; import styles from 'styles/main/Section.module.scss'; +import PartyPreview from './PartyPreview'; type SectionProps = { sectionTitle: string; @@ -18,6 +19,7 @@ export default function Section({ sectionTitle, path }: SectionProps) { const pathCheck: pathType = { game: , rank: , + party: , tournament: , }; From 5892840c567aaac6487f0edf0849f75f2dbf3811 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Fri, 15 Mar 2024 15:52:32 +0900 Subject: [PATCH 24/67] =?UTF-8?q?[Feat]=20pr=EC=9A=A9=20=ED=95=84=EC=9A=94?= =?UTF-8?q?=EC=97=86=EB=8A=94=20=ED=8C=8C=EC=9D=BC,=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=ED=95=9C=ED=8C=8C=EC=9D=BC=EB=A7=8C=20=EC=BB=A4=EB=B0=8B?= =?UTF-8?q?=ED=95=98=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{PartyReport.tsx => AdminPartyReport.tsx} | 2 +- components/admin/party/PartyCategory.tsx | 1 - components/admin/party/PartyNav.tsx | 8 +-- components/admin/party/PartyTemplate.tsx | 1 + components/modal/modalType/AdminModal.tsx | 1 - styles/party/PartyCreate.module.scss | 7 --- styles/party/ParytyRoomList.module.scss | 58 ------------------- types/admin/tableTypes.ts | 1 - types/modalTypes.ts | 6 +- types/partyTypes.ts | 35 ++++++----- 10 files changed, 26 insertions(+), 94 deletions(-) rename components/admin/party/{PartyReport.tsx => AdminPartyReport.tsx} (70%) delete mode 100644 styles/party/PartyCreate.module.scss delete mode 100644 styles/party/ParytyRoomList.module.scss diff --git a/components/admin/party/PartyReport.tsx b/components/admin/party/AdminPartyReport.tsx similarity index 70% rename from components/admin/party/PartyReport.tsx rename to components/admin/party/AdminPartyReport.tsx index d5b9d412c..4cec8237a 100644 --- a/components/admin/party/PartyReport.tsx +++ b/components/admin/party/AdminPartyReport.tsx @@ -1,5 +1,5 @@ import PartyReportNav from './PartyReportNav'; -export default function PartyReport() { +export default function AdminPartyReport() { return ( <> diff --git a/components/admin/party/PartyCategory.tsx b/components/admin/party/PartyCategory.tsx index 8368a04dc..befa452b4 100644 --- a/components/admin/party/PartyCategory.tsx +++ b/components/admin/party/PartyCategory.tsx @@ -26,7 +26,6 @@ export default function PartyCategories() { const handleConfirm = () => { if (newCategoryName.trim() !== '') { createCategory(newCategoryName); - console.log(newCategoryName); } }; diff --git a/components/admin/party/PartyNav.tsx b/components/admin/party/PartyNav.tsx index 13938cd3b..33aa3af92 100644 --- a/components/admin/party/PartyNav.tsx +++ b/components/admin/party/PartyNav.tsx @@ -1,9 +1,7 @@ import { useState } from 'react'; import styles from 'styles/party/PartyNav.module.scss'; +import AdminPartyReport from './AdminPartyReport'; import PartyCategory from './PartyCategory'; -import PartyPenalty from './PartyPenalty'; -import PartyReport from './PartyReport'; -import PartyRoomTable from './PartyRoomTable'; import PartyTemplate from './PartyTemplate'; export default function PartyNav() { @@ -29,9 +27,7 @@ export default function PartyNav() { - {navValue === 'penalty' && } - {navValue === 'report' && } - {navValue === 'room' && } + {navValue === 'report' && } {navValue === 'template' && } {navValue === 'category' && } diff --git a/components/admin/party/PartyTemplate.tsx b/components/admin/party/PartyTemplate.tsx index 0b158093b..fc71416ed 100644 --- a/components/admin/party/PartyTemplate.tsx +++ b/components/admin/party/PartyTemplate.tsx @@ -37,6 +37,7 @@ export default function PartyTemplate() { useEffect(() => { console.log('Render'); }, [templates]); + const handleEditTemplate = (template?: PartyGameTemplate) => { setModal({ modalName: 'ADMIN-PARTY_TEMPLATE', template }); }; diff --git a/components/modal/modalType/AdminModal.tsx b/components/modal/modalType/AdminModal.tsx index e1bdb96a9..8e9a026c0 100644 --- a/components/modal/modalType/AdminModal.tsx +++ b/components/modal/modalType/AdminModal.tsx @@ -18,7 +18,6 @@ import AdminSeasonEdit from 'components/modal/admin/SeasonEdit'; import TemplateModal from 'components/modal/Party/TemplateModal'; import AdminEditTournamentBraket from '../admin/AdminEditTournamentBraket'; import AdminTournamentParticipantEditModal from '../admin/AdminTournamentParticipantEditModal/AdminTournamentParticipantEditModal'; -import PartyRoomEditModal from '../Party/PartyRoomEditModal'; export default function AdminModal() { const { diff --git a/styles/party/PartyCreate.module.scss b/styles/party/PartyCreate.module.scss deleted file mode 100644 index 8957e25ce..000000000 --- a/styles/party/PartyCreate.module.scss +++ /dev/null @@ -1,7 +0,0 @@ -.detailForm { - form { - display: flex; - flex-direction: column; - align-items: center; - } -} diff --git a/styles/party/ParytyRoomList.module.scss b/styles/party/ParytyRoomList.module.scss deleted file mode 100644 index 8c07770fb..000000000 --- a/styles/party/ParytyRoomList.module.scss +++ /dev/null @@ -1,58 +0,0 @@ -@import 'styles/common.scss'; - -$dark-green: #024900; -$medium-green: #4f9237; -$light-green: #67a64a; - -.roomListWrap { - padding: 0.5em; - margin: 0; - background-color: $medium-green; - border-radius: $medium-radius; - - .roomItemWrap { - display: flex; - padding: 0.5em; - margin: 2px 0; - color: black; - background-color: $white2; - border-radius: $medium-radius; - justify-content: space-between; - align-items: center; - - .verticalLine { - width: 4px; - background-color: black; - } - - .roomItemDescWrap { - position: relative; - width: 100%; - .roomItemCategory { - font-size: $small-font; - font-weight: 400; - color: $dark-gray; - } - .roomItemTitle { - margin-left: 0.2em; - font-size: $big-font; - } - - &::after { - position: absolute; - top: 0; - right: 0; - box-sizing: border-box; - width: 0; - height: 100%; - content: ''; - border: 1px solid $medium-gray; - } - } - - .roomPeopleWrap { - margin-left: 0.5em; - letter-spacing: 0.1em; - } - } -} diff --git a/types/admin/tableTypes.ts b/types/admin/tableTypes.ts index 445547b9c..16ceadd6d 100644 --- a/types/admin/tableTypes.ts +++ b/types/admin/tableTypes.ts @@ -18,7 +18,6 @@ export type TableName = | 'coinPolicyHistory' | 'tournament' | 'tournamentCreate' - | 'partyRoom' | 'partyCategory' | 'partyTemplate' | 'partyNoshowReport' diff --git a/types/modalTypes.ts b/types/modalTypes.ts index e6853b851..24222fc88 100644 --- a/types/modalTypes.ts +++ b/types/modalTypes.ts @@ -36,8 +36,6 @@ type StoreModal = 'MANUAL' | 'COIN_HISTORY'; type TournamentModal = 'REGISTRY' | 'MANUAL'; -type PartyModal = 'REPORT'; - type AdminModal = | 'PROFILE' | 'USER-COIN' @@ -56,7 +54,6 @@ type AdminModal = | 'CHECK_SEND_NOTI' | 'TOURNAMENT_BRAKET_EDIT' | 'TOURNAMENT_PARTICIPANT_EDIT' - | 'PARTY_EDIT' | 'PARTY_TEMPLATE'; type ModalName = @@ -73,8 +70,7 @@ type ModalName = | `EDIT-ITEM-${EditItemModal}` | `STORE-${StoreModal}` | `PURCHASE-${PurchaseModal}` - | `TOURNAMENT-${TournamentModal}` - | `PARTY-${PartyModal}`; + | `TOURNAMENT-${TournamentModal}`; export interface Cancel { startTime: string; diff --git a/types/partyTypes.ts b/types/partyTypes.ts index d4b485042..4d1da2332 100644 --- a/types/partyTypes.ts +++ b/types/partyTypes.ts @@ -1,33 +1,40 @@ -export type PartyRoomStatus = 'OPEN' | 'START' | 'FINISH' | 'HIDDEN'; - +export type PartyRoomStatus = 'OPEN' | 'START' | 'FINISH' | 'HIDDEN' | 'FAIL'; +/** + * @typedef {Object} PartyRoom + * @property {string} [creatorIntraId] - adminAPI로 조회시 존재 + */ export type PartyRoom = { roomId: number; title: string; - categoryId: number; - currentPeople: number; - minPeople: number; - maxPeople: number; - dueDate: string; - createDate: string; - roomStatus: PartyRoomStatus; creatorIntraId?: string; }; +/** + * @typedef {Object} PartyRoomDetail + * @property {string | null} [myNickname] - Room 참여시 존재 + */ export type PartyRoomDetail = PartyRoom & { - myNickname: string | null; // 촉촉한 초코칩 - hostNickname: string; // 촉촉한 초코칩 + myNickname: string | null; + hostNickname: string; content: string; roomUsers: PartyRoomUser[]; comments: PartyComment[]; }; +/** + * @typedef {Object} PartyRoomUser + * @property {string | null} [intraId] - Room 시작시 or Admin으로 조회시 존재 + */ export type PartyRoomUser = { roomUserId: number; nickname: string; - intraId?: string; + intraId: string | null; }; -// 닉네임과 아이디를 가지고 있는 api를 만들어줌. 추가 필요. +/** + * @typedef {Object} PartyRoomDetail + * @property {string | null} [intraid] - Room 시작시 or Admin으로 조회시 존재 + */ export type PartyComment = { commentId: number; @@ -82,7 +89,7 @@ export type PartyCommentReport = { createdAt: string; }; -export type PartyForm = { +export type PartyCreateForm = { title: string; categoryId: number; minPeople: number; From 80a7aa848d62d56695a8c7ac3832ee3b6a607300 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Fri, 15 Mar 2024 18:39:40 +0900 Subject: [PATCH 25/67] =?UTF-8?q?[Fix]=20=ED=8C=8C=ED=8B=B0=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=EC=97=90=20deleteHandler=EB=8C=80?= =?UTF-8?q?=EC=8B=A0=20=EC=A7=81=EC=A0=91=EC=A0=81=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EC=A0=91=EA=B7=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/party/PartyCategory.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/components/admin/party/PartyCategory.tsx b/components/admin/party/PartyCategory.tsx index befa452b4..aac3f2824 100644 --- a/components/admin/party/PartyCategory.tsx +++ b/components/admin/party/PartyCategory.tsx @@ -29,10 +29,6 @@ export default function PartyCategories() { } }; - const deletehandler = (categoryId: number) => { - deleteCategory(categoryId); - }; - return (
@@ -65,7 +61,7 @@ export default function PartyCategories() { > {columnName === 'delete' ? ( + + +
+
+ + ); +} diff --git a/components/modal/modalType/AdminModal.tsx b/components/modal/modalType/AdminModal.tsx index 8e9a026c0..bdba560f1 100644 --- a/components/modal/modalType/AdminModal.tsx +++ b/components/modal/modalType/AdminModal.tsx @@ -9,13 +9,14 @@ import AdminEditItemModal from 'components/modal/admin/AdminEditItem'; import AdminFeedbackCheck from 'components/modal/admin/AdminFeedbackCheckModal'; import AdminModifyScoreModal from 'components/modal/admin/AdminModifyScoreModal'; import AdminNotiUserModal from 'components/modal/admin/AdminNotiUserModal'; +import AdminPartyPenaltyModal from 'components/modal/admin/AdminPartyPenaltyModal'; import AdminPenaltyModal from 'components/modal/admin/AdminPenaltyModal'; import AdminProfileModal from 'components/modal/admin/AdminProfileModal'; +import TemplateModal from 'components/modal/admin/AdminTemplateModal'; import AdminUserCoinModal from 'components/modal/admin/AdminUserCoinModal'; import DeletePenaltyModal from 'components/modal/admin/DeletePenaltyModal'; import DetailModal from 'components/modal/admin/DetailModal'; import AdminSeasonEdit from 'components/modal/admin/SeasonEdit'; -import TemplateModal from 'components/modal/Party/TemplateModal'; import AdminEditTournamentBraket from '../admin/AdminEditTournamentBraket'; import AdminTournamentParticipantEditModal from '../admin/AdminTournamentParticipantEditModal/AdminTournamentParticipantEditModal'; @@ -36,6 +37,7 @@ export default function AdminModal() { tournament, tournamentId, template, + partyPenalty, } = useRecoilValue(modalState); if (!modalName) { @@ -93,6 +95,9 @@ export default function AdminModal() { ) : null, 'ADMIN-PARTY_TEMPLATE': , + 'ADMIN-PARTY_ADMIN_PENALTY': ( + + ), }; return content[modalName]; diff --git a/types/modalTypes.ts b/types/modalTypes.ts index 5bf648122..85f1ef285 100644 --- a/types/modalTypes.ts +++ b/types/modalTypes.ts @@ -13,7 +13,7 @@ import { StoreManualMode } from 'types/storeTypes'; import { ICoin } from 'types/userTypes'; import { ITournament } from './admin/adminTournamentTypes'; import { GameMode } from './gameTypes'; -import { PartyGameTemplate } from './partyTypes'; +import { PartyGameTemplate, PartyPenaltyAdmin } from './partyTypes'; import { TournamentInfo } from './tournamentTypes'; type EventModal = 'WELCOME' | 'ANNOUNCEMENT'; @@ -54,7 +54,8 @@ type AdminModal = | 'CHECK_SEND_NOTI' | 'TOURNAMENT_BRAKET_EDIT' | 'TOURNAMENT_PARTICIPANT_EDIT' - | 'PARTY_TEMPLATE'; + | 'PARTY_TEMPLATE' + | 'PARTY_ADMIN_PENALTY'; type ModalName = | null @@ -145,4 +146,5 @@ export interface Modal { tournament?: ITournament; tournamentId?: number; template?: PartyGameTemplate; + partyPenalty?: PartyPenaltyAdmin; } diff --git a/types/partyTypes.ts b/types/partyTypes.ts index 5221ab523..9a0b2282d 100644 --- a/types/partyTypes.ts +++ b/types/partyTypes.ts @@ -122,9 +122,21 @@ export type PartyTemplateForm = { export type PartyPenaltyAdmin = { id: number; - user: object; + user: string; penaltyType: string; message: string; startTime: string; penaltyTime: number; }; + +export type PartyPenaltyAdminSubmit = { + penaltyType: string; + message: string; + penaltyTime: number; +}; + +export interface PartyPenaltyTable { + penaltyList: PartyPenaltyAdmin[]; + totalPage: number; + currentPage: number; +} From 7b560147cdd34da88244e0d551bcb178f2d41008 Mon Sep 17 00:00:00 2001 From: jaeywon Date: Mon, 18 Mar 2024 22:40:46 +0900 Subject: [PATCH 42/67] =?UTF-8?q?[Feat]=20=ED=8C=8C=ED=8B=B0=20=EC=96=B4?= =?UTF-8?q?=EB=93=9C=EB=AF=BC=20nav=EC=97=90=20=ED=8C=A8=EB=84=90=ED=8B=B0?= =?UTF-8?q?=20=ED=95=AD=EB=AA=A9=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/party/PartyNav.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/admin/party/PartyNav.tsx b/components/admin/party/PartyNav.tsx index 540e909c5..3ed0a36b8 100644 --- a/components/admin/party/PartyNav.tsx +++ b/components/admin/party/PartyNav.tsx @@ -1,5 +1,6 @@ import { useState } from 'react'; import styles from 'styles/party/PartyNav.module.scss'; +import PartyPenalty from './AdminPartyPenalty'; import PartyCategory from './PartyCategory'; import PartyReportNav from './PartyReportNav'; import PartyTemplate from './PartyTemplate'; @@ -30,6 +31,7 @@ export default function PartyNav() { {navValue === 'report' && } {navValue === 'template' && } {navValue === 'category' && } + {navValue === 'penalty' && } ); From 72ac99a364209020ef1e66c2da7af888d623678c Mon Sep 17 00:00:00 2001 From: juha Date: Tue, 19 Mar 2024 17:38:00 +0900 Subject: [PATCH 43/67] =?UTF-8?q?[Feat]=20=ED=8C=8C=ED=8B=B0=20=EB=94=94?= =?UTF-8?q?=ED=85=8C=EC=9D=BC=20=ED=8E=98=EC=9D=B4=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../party/roomDetail/PartyDetailButton.tsx | 144 ++++++++++++++ .../PartyDetailContentCommentBox.tsx | 111 +++++++++++ .../party/roomDetail/PartyDetailProfile.tsx | 156 +++++++++++++++ .../party/roomDetail/PartyDetailTitleBox.tsx | 38 ++++ pages/party/[roomId]/index.tsx | 50 +++++ styles/party/PartyDetailRoom.module.scss | 178 ++++++++++++++++++ 6 files changed, 677 insertions(+) create mode 100644 components/party/roomDetail/PartyDetailButton.tsx create mode 100644 components/party/roomDetail/PartyDetailContentCommentBox.tsx create mode 100644 components/party/roomDetail/PartyDetailProfile.tsx create mode 100644 components/party/roomDetail/PartyDetailTitleBox.tsx create mode 100644 pages/party/[roomId]/index.tsx create mode 100644 styles/party/PartyDetailRoom.module.scss diff --git a/components/party/roomDetail/PartyDetailButton.tsx b/components/party/roomDetail/PartyDetailButton.tsx new file mode 100644 index 000000000..d65153cf5 --- /dev/null +++ b/components/party/roomDetail/PartyDetailButton.tsx @@ -0,0 +1,144 @@ +import { useRouter } from 'next/router'; +import { useSetRecoilState } from 'recoil'; +import { CiShare2 } from 'react-icons/ci'; +import { PiSirenFill } from 'react-icons/pi'; +import { Snackbar } from '@mui/material'; +import { instance } from 'utils/axios'; +import { modalState } from 'utils/recoil/modal'; +import styles from 'styles/party/PartyDetailRoom.module.scss'; + +type ParytButtonProps = { + roomId?: number; + commentId?: number; +}; + +function ReportComment({ commentId }: ParytButtonProps) { + const setModal = useSetRecoilState(modalState); + + return ( + + ); +} + +function ReportRoom({ roomId }: ParytButtonProps) { + const setModal = useSetRecoilState(modalState); + + return ( + + ); +} + +function ShareRoom() { + const roomId = useRouter().query.roomId; + + return ( + + ); +} + +type ReprashProps = ParytButtonProps & { + fetchRoomDetail: () => void; +}; + +function JoinRoom({ roomId, fetchRoomDetail }: ReprashProps) { + const handlerJoin = async () => { + await instance.post(`/party/rooms/${roomId}/join`).catch((error) => { + ; + }); + fetchRoomDetail(); + }; + + return ( + + ); +} + +function LeaveRoom({ roomId, fetchRoomDetail }: ReprashProps) { + const handlerExit = async () => { + await instance.patch(`/party/rooms/${roomId}`).catch(() => { + ; + }); + fetchRoomDetail(); + }; + + return ( + + ); +} + +function StartRoom({ roomId }: { roomId: number }) { + return ( + + ); +} + +// TODO: 버튼에 css입히기 + +const PartyRoomDetailButton = { + ReportComment, + ReportRoom, + ShareRoom, + JoinRoom, + LeaveRoom, + StartRoom, +}; + +export default PartyRoomDetailButton; diff --git a/components/party/roomDetail/PartyDetailContentCommentBox.tsx b/components/party/roomDetail/PartyDetailContentCommentBox.tsx new file mode 100644 index 000000000..d456858d6 --- /dev/null +++ b/components/party/roomDetail/PartyDetailContentCommentBox.tsx @@ -0,0 +1,111 @@ +import { IoSendSharp } from 'react-icons/io5'; +import { + PartyComment, + PartyRoomDetail, + PartyRoomStatus, +} from 'types/partyTypes'; +import { instance } from 'utils/axios'; +import { getTimeAgo } from 'utils/handleTime'; +import styles from 'styles/party/PartyDetailRoom.module.scss'; +import PartyRoomDetailButton from './PartyDetailButton'; +type PartyRoomDetailProps = { + partyRoomDetail: PartyRoomDetail; + fetchRoomDetail: () => void; +}; + +type CommentCreateBarProps = { + roomId: number; + status: PartyRoomStatus; + myNickname: string | null; + fetchRoomDetail: () => void; +}; + +export default function PartyDetailContentCommentBox({ + partyRoomDetail, + fetchRoomDetail, +}: PartyRoomDetailProps) { + const totalComments = partyRoomDetail.comments.length; + + return ( + <> +
+
{partyRoomDetail.content}
+
댓글 ({totalComments})
+
+ +
+ + + ); +} + +function CommentLine({ comments }: { comments: PartyComment[] }) { + return ( + <> + {comments.map((comment) => + comment.isHidden ? ( +
+ 숨김 처리된 댓글입니다. +
+ ) : ( +
+
{comment.content}
+
+ {comment.nickname} + {` (${getTimeAgo(comment.createDate)})`} + +
+
+ ) + )} + + ); +} + +function CommentCreateBar({ + roomId, + status, + fetchRoomDetail, +}: CommentCreateBarProps) { + const handlerComments = async () => { + await instance.post(`/party/rooms/${roomId}/comments`); + fetchRoomDetail(); + }; + + if (status !== 'OPEN') { + return <> ; + } + + return ( +
+
+ + +
+
+ ); +} + +function nameToRGB(name: string): string { + let codeSum = 0; + for (let i = 0; i < name.length; i++) { + codeSum += name.charCodeAt(i) ** i * 10; + } + + const red = codeSum % 256; + const green = (codeSum * 2) % 256; + const blue = (codeSum * 3) % 256; + + return `rgb(${red}, ${green}, ${blue})`; +} diff --git a/components/party/roomDetail/PartyDetailProfile.tsx b/components/party/roomDetail/PartyDetailProfile.tsx new file mode 100644 index 000000000..c5e7da984 --- /dev/null +++ b/components/party/roomDetail/PartyDetailProfile.tsx @@ -0,0 +1,156 @@ +import Image from 'next/image'; +import { FaCrown } from 'react-icons/fa'; +import { + PartyRoomDetail, + PartyRoomStatus, + PartyRoomUser, +} from 'types/partyTypes'; +import { dateToStringShort } from 'utils/handleTime'; +import styles from 'styles/party/PartyDetailRoom.module.scss'; +import PartyRoomDetailButton from './PartyDetailButton'; + +type PartyDetailProfileProps = { + partyRoomDetail: PartyRoomDetail; + fetchRoomDetail: () => void; +}; + +export default function PartyDetailProfile({ + partyRoomDetail, + fetchRoomDetail, +}: PartyDetailProfileProps) { + const { + currentPeople, + maxPeople, + dueDate, + roomId, + status, + roomUsers, + hostNickname, + } = partyRoomDetail; + + return ( +
+
+ {`참여인원 (${currentPeople}/${maxPeople})`} + {`${dateToStringShort(new Date(dueDate))}`} +
+
+ +
+ +
+ ); +} + +/*------------------------profile------------------------------ */ + +type ProfileProps = { + roomUsers: PartyRoomUser[]; + hostNickname: string; +}; + +function Profile({ roomUsers, hostNickname }: ProfileProps) { + return ( +
    + {roomUsers.map(({ intraId, nickname, userImage }, i) => + intraId ? ( +
  • + {nickname === hostNickname && ( +
    + +
    + )} + {intraId} +
    {intraId}
    +
  • + ) : ( +
  • + {nickname === hostNickname && ( +
    + +
    + )} + {nickname} +
    {nickname}
    +
  • + ) + )} +
+ ); +} + +/*-----------------------button------------------------------ */ + +type ButtonProps = { + roomId: number; + status: PartyRoomStatus; + myNickname: string | null; + hostNickname: string; + fetchRoomDetail: () => void; +}; + +function ButtonHandler({ + status, + myNickname, + roomId, + hostNickname, + fetchRoomDetail, +}: ButtonProps) { + return status !== 'OPEN' ? ( + <> + ) : !myNickname ? ( + + ) : hostNickname !== myNickname ? ( +
+ +
+ ) : ( + <> + + + + ); +} + +function nameToRGB(name: string): string { + let codeSum = 0; + for (let i = 0; i < name.length; i++) { + codeSum += name.charCodeAt(i) ** i * 10; + } + + const red = codeSum % 256; + const green = (codeSum * 2) % 256; + const blue = (codeSum * 3) % 256; + + return `rgb(${red}, ${green}, ${blue})`; +} diff --git a/components/party/roomDetail/PartyDetailTitleBox.tsx b/components/party/roomDetail/PartyDetailTitleBox.tsx new file mode 100644 index 000000000..b535d783d --- /dev/null +++ b/components/party/roomDetail/PartyDetailTitleBox.tsx @@ -0,0 +1,38 @@ +import { getRemainTime } from 'utils/handleTime'; +import usePartyCategory from 'hooks/party/usePartyCategory'; +import styles from 'styles/party/PartyDetailRoom.module.scss'; +import PartyRoomDetailButton from './PartyDetailButton'; + +type PartyDetailTitleBoxProps = { + categoryId: number; + title: string; + roomId: number; + dueDate: string; +}; + +export default function PartyDetailTitleBox({ + categoryId, + title, + roomId, + dueDate, +}: PartyDetailTitleBoxProps) { + const category = usePartyCategory().categories.find( + (category) => category.categoryId === categoryId + )?.categoryName; + + return ( +
+
+
{`#${category}`}
+ +
+
{title}
+
+ + {getRemainTime({ targetTime: new Date(dueDate) })} + + +
+
+ ); +} diff --git a/pages/party/[roomId]/index.tsx b/pages/party/[roomId]/index.tsx new file mode 100644 index 000000000..7f9cd64a6 --- /dev/null +++ b/pages/party/[roomId]/index.tsx @@ -0,0 +1,50 @@ +import { useRouter } from 'next/router'; +import { useEffect, useState } from 'react'; +import { PartyRoomDetail } from 'types/partyTypes'; +import { instance } from 'utils/axios'; +import PartyDetailContentCommentBox from 'components/party/roomDetail/PartyDetailContentCommentBox'; +import PartyDetailProfile from 'components/party/roomDetail/PartyDetailProfile'; +import PartyDetailTitleBox from 'components/party/roomDetail/PartyDetailTitleBox'; +import styles from 'styles/party/PartyDetailRoom.module.scss'; + +export default function PartyDetailPage() { + const roomId = useRouter().query.roomId; + const router = useRouter(); + const [partyRoomDetail, setPartyRoomDetail] = useState< + PartyRoomDetail | undefined + >(undefined); + + useEffect(() => { + fetchRoomDetail(); + }, []); + + const fetchRoomDetail = () => { + instance + .get(`/party/rooms/${roomId}`) + .then(({ data }) => { + setPartyRoomDetail(data); + }) + .catch(() => { + alert('방 정보를 불러오는데 실패했습니다.'); + router.push('/party'); + }); + }; + + return partyRoomDetail && partyRoomDetail.status !== 'HIDDEN' ? ( +
+ + + +
+ ) : partyRoomDetail === undefined ? ( +
loading...
+ ) : ( +
방이 존재하지 않습니다.
+ ); +} diff --git a/styles/party/PartyDetailRoom.module.scss b/styles/party/PartyDetailRoom.module.scss new file mode 100644 index 000000000..9ea78bb5b --- /dev/null +++ b/styles/party/PartyDetailRoom.module.scss @@ -0,0 +1,178 @@ +@import 'styles/common.scss'; + +$detailCommonRem: 1rem; + +.detailPage { + @include pageWrap; + + .titleBox { + position: relative; + padding: $detailCommonRem; + background-color: white; + border-radius: $mini-radius; + + .titleLine { + display: flex; + justify-content: space-between; + width: 100%; + + .titleCategory { + font-size: $small-font; + } + + .shareBtn { + position: relative; + text-align: right; + background-color: inherit; + border: none; + } + + .reportRoomBtn { + position: relative; + text-align: right; + background-color: inherit; + border: none; + } + } + .titleContent { + max-width: 100; + margin: 0.3rem 0; + font-size: $big-font; + font-weight: bold; + } + + .remainTime { + padding: 0.2rem; + margin-top: 0.2rem; + font-size: $small-font; + color: aliceblue; + background-color: $pp-gray; + border-radius: $medium-radius; + } + } + + .profile { + position: relative; + width: 100%; + margin-top: $detailCommonRem; + color: white; + + .profileItem { + text-align: center; + li { + display: inline-block; + margin-right: 0.5rem; + } + .crown { + position: relative; + top: 0.4rem; + left: -0.8rem; + transform: rotate(-30deg); + } + + .profileImg { + text-align: center; + border-radius: $big-radius; + } + } + + .joinBtn { + width: 50%; + height: 3rem; + margin-bottom: $detailCommonRem; + font-size: $big-font; + border-radius: $small-radius; + } + + .btnContainer { + text-align: right; + .leaveBtn { + width: 50%; + height: 3rem; + margin-bottom: $detailCommonRem; + font-size: $big-font; + border-radius: $small-radius; + } + + .startBtn { + width: 50%; + height: 3rem; + margin-bottom: $detailCommonRem; + font-size: $big-font; + border-radius: $small-radius; + } + } + + .line { + display: flex; + justify-content: space-between; + width: 100%; + } + + .user { + border: 0.5rem; + } + } + + .contentCommentBox { + position: relative; + width: 100%; + padding: $detailCommonRem; + background-color: white; + border-radius: $mini-radius; + + .content { + min-height: 13rem; + margin-bottom: $detailCommonRem; + } + + .comment { + margin-top: $detailCommonRem * 2; + margin-bottom: 0.3; + } + + .commentHidden { + margin-top: $detailCommonRem * 2; + margin-bottom: 0.3; + color: gray; + opacity: 0.7; + } + + .commentInfo { + text-align: right; + + .commentBtn { + position: relative; + text-align: right; + background-color: inherit; + border: none; + } + } + } + + .commentCreateBar { + padding: 0.01rem; + margin-top: $detailCommonRem * 0.5; + background-color: white; + border-radius: $big-radius; + + form { + display: flex; + align-items: center; + + .textBar { + margin-left: 0.5rem; + font-size: $medium-font; + border: none; + } + + .inputBtn { + display: flex; + font-size: $small-font; + background-color: inherit; + border: none; + align-items: center; + } + } + } +} From 79f0b3a79dc95c670882eac75a73ef2c106b2a04 Mon Sep 17 00:00:00 2001 From: juha Date: Tue, 19 Mar 2024 17:42:45 +0900 Subject: [PATCH 44/67] =?UTF-8?q?[Feat]=20=ED=8C=8C=ED=8B=B0=20=EB=94=94?= =?UTF-8?q?=ED=85=8C=EC=9D=BC=20=EB=AA=A8=EB=8B=AC=20=EA=B4=80=EB=A0=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/modal/Party/PartyReportModal.tsx | 83 +++++++++++++++++++++ types/modalTypes.ts | 14 +++- 2 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 components/modal/Party/PartyReportModal.tsx diff --git a/components/modal/Party/PartyReportModal.tsx b/components/modal/Party/PartyReportModal.tsx new file mode 100644 index 000000000..228fc3e29 --- /dev/null +++ b/components/modal/Party/PartyReportModal.tsx @@ -0,0 +1,83 @@ +import { useState } from 'react'; +import { useSetRecoilState } from 'recoil'; +import { Modal, PartyReportModalData } from 'types/modalTypes'; +import { instance } from 'utils/axios'; +import { modalState } from 'utils/recoil/modal'; +import styles from 'styles/modal/menu/ReportModal.module.scss'; +import { ModalButton, ModalButtonContainer } from '../ModalButton'; + +export function PartyReportModal({ report }: { report: PartyReportModalData }) { + const [isLoading, setIsLoading] = useState(false); + const [content, setContent] = useState(''); + const setModal = useSetRecoilState(modalState); + + const reportHandler = async () => { + const reportResponse: { [key: string]: string } = { + SUCCESS: '신고해주셔서 감사합니다 ❤️', + REJECT: '내용을 적어주세요 ❤️', + }; + + try { + if (!content.replace(/^\s+|\s+$/g, '')) { + throw new Error('칸을 입력하지 않았습니다.'); + } + switch (report.name) { + case 'COMMENT': + await instance.post(`/party/reports/comments/${report.commentId}`); + break; + case 'ROOM': + await instance.post(`/party/reports/rooms/${report.roomId}`); + break; + case 'NOSHOW': + await instance.post( + `/party/reports/rooms/${report.roomId}/users/${report.userIntraId}` + ); + break; + } + setModal({ modalName: null }); + alert(reportResponse.SUCCESS); + } catch (e) { + alert(reportResponse.REJECT); + throw new Error('REJECT'); + } + }; + + const handleReport = () => { + setIsLoading(true); + reportHandler().catch(() => setIsLoading(false)); + }; + + return ( +
+
+
42GG
+
{report.name}
+
+
+
+
+