From 8d7f6d5e75881fea8c45ea74ea815be5364564d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Tue, 17 Oct 2023 11:05:48 +0900 Subject: [PATCH 1/6] =?UTF-8?q?Feat:=20=EB=B0=94=EB=A1=9C=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@types/icon.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/@types/icon.ts b/src/@types/icon.ts index 4f8e383..f536a7d 100644 --- a/src/@types/icon.ts +++ b/src/@types/icon.ts @@ -12,4 +12,5 @@ export type IconKind = | 'sendEmail' | 'modify' | 'setting' - | 'cancel'; + | 'cancel' + | 'shortcut'; From bf2910f0d5abb02cc4fdac74bc958a1242a9c7f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Tue, 17 Oct 2023 11:06:05 +0900 Subject: [PATCH 2/6] =?UTF-8?q?Feat:=20=EB=B0=94=EB=A1=9C=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Icon/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/Icon/index.tsx b/src/components/Icon/index.tsx index 7aabb28..6fed6d7 100644 --- a/src/components/Icon/index.tsx +++ b/src/components/Icon/index.tsx @@ -15,6 +15,7 @@ import { MdModeEdit, MdSettings, MdCancel, + MdOutlineShortcut, } from 'react-icons/md'; import { MouseEventHandler } from 'react'; @@ -33,6 +34,7 @@ const ICON: { [key in IconKind]: IconType } = { modify: MdModeEdit, setting: MdSettings, cancel: MdCancel, + shortcut: MdOutlineShortcut, }; interface IconProps { From 101a4d94b61568bd1aa58235332e739774069a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Tue, 17 Oct 2023 11:06:28 +0900 Subject: [PATCH 3/6] =?UTF-8?q?Feat:=20MatchInfo=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __mocks__/constants/matchRoundMock.ts | 514 +++----------------------- src/@types/bracket.ts | 5 +- 2 files changed, 62 insertions(+), 457 deletions(-) diff --git a/__mocks__/constants/matchRoundMock.ts b/__mocks__/constants/matchRoundMock.ts index f151511..05055ec 100644 --- a/__mocks__/constants/matchRoundMock.ts +++ b/__mocks__/constants/matchRoundMock.ts @@ -10,11 +10,12 @@ export const matchRoundMock: mockRoundData = { matchInfoDtoList: [ { matchName: 'Group A', - matchLink: '10-8878-debc6c12b149', + matchId: 5345, matchStatus: 'READY', matchRound: 64, - matchRoundCount: 0, - matchRoundMaxCount: 1, + matchCurrentSet: 2, + matchSetCurrent: 3, + alarm: true, matchPlayerInfoList: [ { gameId: '더미8', @@ -69,173 +70,79 @@ export const matchRoundMock: mockRoundData = { }, { matchName: 'Group B', - matchLink: '48-96cb-a4f9c58ce387', + matchId: 53454, matchStatus: 'READY', matchRound: 64, - matchRoundCount: 0, - matchRoundMaxCount: 1, + matchCurrentSet: 2, + matchSetCurrent: 3, + alarm: true, matchPlayerInfoList: [ { - gameId: '더미7', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'participantGameId3', - gameTier: 'iron ii', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미10', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미3', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미11', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'DummyGameId1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - ], - }, - { - matchName: 'Group C', - matchLink: '48-96cb-a4f9c58ce387', - matchStatus: 'READY', - matchRound: 64, - matchRoundCount: 0, - matchRoundMaxCount: 1, - matchPlayerInfoList: [ - { - gameId: '더미7', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'participantGameId3', - gameTier: 'iron ii', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미10', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미3', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미11', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미1', + gameId: '더미8', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, + profileSrc: '/profileTest.jpg', }, { - gameId: 'DummyGameId1', + gameId: '더미0', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, - ], - }, - { - matchName: 'Group D', - matchLink: '48-96cb-a4f9c58ce387', - matchStatus: 'READY', - matchRound: 64, - matchRoundCount: 0, - matchRoundMaxCount: 1, - matchPlayerInfoList: [ { - gameId: '더미7', + gameId: '더미6', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, { - gameId: 'participantGameId3', - gameTier: 'iron ii', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미10', + gameId: '더미4', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, { - gameId: '더미3', + gameId: '더미9', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, { - gameId: '더미11', + gameId: '더미2', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, { - gameId: '더미1', + gameId: '더미5', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, { - gameId: 'DummyGameId1', - gameTier: 'platinum', + gameId: 'participantGameId2', + gameTier: 'platinum ii', playerStatus: 'WAITING', score: 0, }, ], }, { - matchName: 'Group E', - matchLink: '10-8878-debc6c12b149', + matchName: 'Group C', + matchId: 535145, matchStatus: 'READY', matchRound: 64, - matchRoundCount: 0, - matchRoundMaxCount: 1, + matchCurrentSet: 2, + matchSetCurrent: 3, + alarm: true, matchPlayerInfoList: [ { gameId: '더미8', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, + profileSrc: '/profileTest.jpg', }, { gameId: '더미0', @@ -282,156 +189,60 @@ export const matchRoundMock: mockRoundData = { ], }, { - matchName: 'Group F', - matchLink: '48-96cb-a4f9c58ce387', - matchStatus: 'READY', - matchRound: 32, - matchRoundCount: 0, - matchRoundMaxCount: 1, - matchPlayerInfoList: [ - { - gameId: '더미7', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'participantGameId3', - gameTier: 'iron ii', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미10', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미3', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미11', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'DummyGameId1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - ], - }, - { - matchName: 'Group G', - matchLink: '48-96cb-a4f9c58ce387', + matchName: 'Group D', + matchId: 534655, matchStatus: 'READY', - matchRound: 32, - matchRoundCount: 0, - matchRoundMaxCount: 1, + matchRound: 64, + matchCurrentSet: 2, + matchSetCurrent: 3, + alarm: true, matchPlayerInfoList: [ { - gameId: '더미7', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'participantGameId3', - gameTier: 'iron ii', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미10', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미3', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미11', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미1', + gameId: '더미8', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, + profileSrc: '/profileTest.jpg', }, { - gameId: 'DummyGameId1', + gameId: '더미0', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, - ], - }, - { - matchName: 'Group H', - matchLink: '48-96cb-a4f9c58ce387', - matchStatus: 'READY', - matchRound: 32, - matchRoundCount: 0, - matchRoundMaxCount: 1, - matchPlayerInfoList: [ { - gameId: '더미7', + gameId: '더미6', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, { - gameId: 'participantGameId3', - gameTier: 'iron ii', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미10', + gameId: '더미4', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, { - gameId: '더미3', + gameId: '더미9', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, { - gameId: '더미11', + gameId: '더미2', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, { - gameId: '더미1', + gameId: '더미5', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, }, { - gameId: 'DummyGameId1', - gameTier: 'platinum', + gameId: 'participantGameId2', + gameTier: 'platinum ii', playerStatus: 'WAITING', score: 0, }, @@ -444,17 +255,19 @@ export const matchRoundMock: mockRoundData = { matchInfoDtoList: [ { matchName: 'Group A', - matchLink: '10-8878-debc6c12b149', + matchId: 5345, matchStatus: 'READY', - matchRound: 32, - matchRoundCount: 0, - matchRoundMaxCount: 1, + matchRound: 64, + matchCurrentSet: 2, + matchSetCurrent: 3, + alarm: true, matchPlayerInfoList: [ { gameId: '더미8', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, + profileSrc: '/profileTest.jpg', }, { gameId: '더미0', @@ -502,178 +315,19 @@ export const matchRoundMock: mockRoundData = { }, { matchName: 'Group B', - matchLink: '48-96cb-a4f9c58ce387', - matchStatus: 'READY', - matchRound: 32, - matchRoundCount: 0, - matchRoundMaxCount: 1, - matchPlayerInfoList: [ - { - gameId: '더미7', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'participantGameId3', - gameTier: 'iron ii', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미10', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미3', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미11', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'DummyGameId1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - ], - }, - { - matchName: 'Group C', - matchLink: '48-96cb-a4f9c58ce387', + matchId: 53454, matchStatus: 'READY', - matchRound: 32, - matchRoundCount: 0, - matchRoundMaxCount: 1, - matchPlayerInfoList: [ - { - gameId: '더미7', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'participantGameId3', - gameTier: 'iron ii', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미10', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미3', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미11', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'DummyGameId1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - ], - }, - { - matchName: 'Group D', - matchLink: '48-96cb-a4f9c58ce387', - matchStatus: 'READY', - matchRound: 32, - matchRoundCount: 0, - matchRoundMaxCount: 1, - matchPlayerInfoList: [ - { - gameId: '더미7', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'participantGameId3', - gameTier: 'iron ii', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미10', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미3', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미11', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'DummyGameId1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - ], - }, - ], - }, - 3: { - myGameId: 'NO_DATA', - matchInfoDtoList: [ - { - matchName: 'Group A', - matchLink: '10-8878-debc6c12b149', - matchStatus: 'READY', - matchRound: 16, - matchRoundCount: 0, - matchRoundMaxCount: 1, + matchRound: 64, + matchCurrentSet: 2, + matchSetCurrent: 3, + alarm: true, matchPlayerInfoList: [ { gameId: '더미8', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, + profileSrc: '/profileTest.jpg', }, { gameId: '더미0', @@ -719,76 +373,26 @@ export const matchRoundMock: mockRoundData = { }, ], }, - { - matchName: 'Group B', - matchLink: '48-96cb-a4f9c58ce387', - matchStatus: 'READY', - matchRound: 16, - matchRoundCount: 0, - matchRoundMaxCount: 1, - matchPlayerInfoList: [ - { - gameId: '더미7', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'participantGameId3', - gameTier: 'iron ii', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미10', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미3', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미11', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: '더미1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - { - gameId: 'DummyGameId1', - gameTier: 'platinum', - playerStatus: 'WAITING', - score: 0, - }, - ], - }, ], }, - 4: { + 3: { myGameId: 'NO_DATA', matchInfoDtoList: [ { matchName: 'Group A', - matchLink: '10-8878-debc6c12b149', + matchId: 5345, matchStatus: 'READY', - matchRound: 8, - matchRoundCount: 0, - matchRoundMaxCount: 1, + matchRound: 64, + matchCurrentSet: 2, + matchSetCurrent: 3, + alarm: true, matchPlayerInfoList: [ { gameId: '더미8', gameTier: 'platinum', playerStatus: 'WAITING', score: 0, + profileSrc: '/profileTest.jpg', }, { gameId: '더미0', diff --git a/src/@types/bracket.ts b/src/@types/bracket.ts index 851ec29..280aa0d 100644 --- a/src/@types/bracket.ts +++ b/src/@types/bracket.ts @@ -12,12 +12,13 @@ interface PlayerInfo { } interface MatchInfo { matchName: string; - matchStatus: string; + matchId: number; + matchStatus: 'READY' | 'PROGRESS' | 'END'; matchRound: number; matchCurrentSet: number; matchSetCurrent: number; matchPlayerInfoList: PlayerInfo[]; - matchId: number; + alarm: boolean; } export interface BracketContents { From ddbc3bc8cb030c807ae668493f36c4c01e8117e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Tue, 17 Oct 2023 11:08:43 +0900 Subject: [PATCH 4/6] =?UTF-8?q?=EC=96=B4=EB=93=9C=EB=AF=BC=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=97=90=20=EC=95=8C=EB=A6=BC=EC=9D=84=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8A=94=20?= =?UTF-8?q?=EB=9D=BC=EC=9A=B4=EB=93=9C=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/contents/[channelLink]/admin.tsx | 110 +++++++++++++++++---- 1 file changed, 92 insertions(+), 18 deletions(-) diff --git a/src/pages/contents/[channelLink]/admin.tsx b/src/pages/contents/[channelLink]/admin.tsx index 896166a..c176aa2 100644 --- a/src/pages/contents/[channelLink]/admin.tsx +++ b/src/pages/contents/[channelLink]/admin.tsx @@ -12,19 +12,75 @@ import useModals from '@hooks/useModals'; import { SERVER_URL } from '@config/index'; import { parse } from 'cookie'; +import { useEffect, useState } from 'react'; +import { connectToStomp } from '@config/stomp'; +import { Client, StompSubscription } from '@stomp/stompjs'; +import { useQuery } from '@tanstack/react-query'; +import authAPI from '@apis/authAPI'; +import { BracketHeader } from '@type/bracket'; +import RoundAlarmHeader from '@components/RoundAlarm/RoundAlarmHeader'; +import RoundAlarmBody from '@components/RoundAlarm/RoundAlarmBody'; +import { CallAdmin } from '@type/admin'; interface Props { role: string; } +const fetchRoundInfo = async (channelLink: string): Promise => { + const res = await authAPI({ method: 'get', url: `/api/match/${channelLink}` }); + return res.data; +}; + const Admin = ({ role }: Props) => { const router = useRouter(); + const [client, setClient] = useState(); + + const [curRound, setCurRound] = useState(); + + const [alramInfo, setAlramInfo] = useState(); const { openModal, closeModal } = useModals(); + const { data, isSuccess } = useQuery({ + queryKey: ['roundInfos'], + queryFn: () => { + setCurRound(1); + return fetchRoundInfo(router.query.channelLink as string); + }, + }); + if (!role) { router.push('/'); } + const isMySelfAlarm = () => { + return curRound === alramInfo?.matchRound; + }; + + useEffect(() => { + const tmpClient = connectToStomp(); + tmpClient.activate(); + + let checkInSubscription: StompSubscription; + + tmpClient.onConnect = () => { + setClient(tmpClient); + checkInSubscription = tmpClient.subscribe( + `/match/${router.query.channelLink as string}`, + (data) => { + setAlramInfo(JSON.parse(data.body)); + }, + ); + }; + return () => { + if (!client) return; + if (checkInSubscription) checkInSubscription.unsubscribe(); + client.deactivate(); + }; + }, []); + + if (isSuccess) { + } + return (
대회 설정
@@ -41,25 +97,37 @@ const Admin = ({ role }: Props) => { > 대회 관리하기 + + +
대회 알림
+ + + {data?.roundList.map((ele) => { + return ; + })} + -
채널 정보 설정
- + {curRound && ( +
+ +
+ )}
); }; @@ -82,6 +150,12 @@ const BracketContainer = styled.div` column-gap: 3rem; `; +const RoundList = styled.div` + display: flex; + align-items: center; + column-gap: 2rem; +`; + export const getServerSideProps: GetServerSideProps = async (context) => { try { const cookies = parse(context.req.headers.cookie || 'no-cookie'); From e410d3f4a26347febc6adce9f0df9787ad970a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Tue, 17 Oct 2023 11:09:04 +0900 Subject: [PATCH 5/6] =?UTF-8?q?Feat:=20=EC=96=B4=EB=93=9C=EB=AF=BC?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=EC=84=9C=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=20=EB=9D=BC=EC=9A=B4=EB=93=9C=20=EB=A6=AC=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=ED=99=95=EC=9D=B8=ED=95=98=EB=8A=94=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/RoundAlarm/RoundAlarmBody.tsx | 91 +++++++++++++++++++ .../RoundAlarm/RoundAlarmHeader.tsx | 52 +++++++++++ 2 files changed, 143 insertions(+) create mode 100644 src/components/RoundAlarm/RoundAlarmBody.tsx create mode 100644 src/components/RoundAlarm/RoundAlarmHeader.tsx diff --git a/src/components/RoundAlarm/RoundAlarmBody.tsx b/src/components/RoundAlarm/RoundAlarmBody.tsx new file mode 100644 index 0000000..e90b930 --- /dev/null +++ b/src/components/RoundAlarm/RoundAlarmBody.tsx @@ -0,0 +1,91 @@ +import authAPI from '@apis/authAPI'; +import Icon from '@components/Icon'; +import styled from '@emotion/styled'; +import { BracketContents } from '@type/bracket'; +import { useRouter } from 'next/router'; +import { useEffect, useState } from 'react'; + +interface Props { + curRound: number; + havingAlarm: boolean; +} + +const RoundAlarmBody = ({ curRound, havingAlarm }: Props) => { + const router = useRouter(); + + console.log(havingAlarm); + + const [roundInfo, setRoundInfo] = useState(); + + useEffect(() => { + const getRoundInfo = async () => { + try { + const res = await authAPI({ + method: 'get', + url: `/api/match/${router.query.channelLink as string}/${curRound}`, + }); + + setRoundInfo(res.data); + } catch (error) {} + }; + + getRoundInfo(); + }, []); + + const moveToCheckIn = (matchId: number) => { + authAPI({ + method: 'post', + url: `/api/match/${router.query.channelLink as string}/${matchId}/call-off`, + }); + + router.push(`/contents/${router.query.channelLink as string}/checkIn/${matchId}`); + }; + + return ( + + {roundInfo?.matchInfoDtoList.map((match) => { + return ( + moveToCheckIn(match.matchId)}> + {match.matchName} + + + {(match.alarm || havingAlarm) && } + + ); + })} + + ); +}; + +const Ground = styled.div` + margin: 2rem 0; +`; + +const GroupContainer = styled.div` + width: 15rem; + height: 4rem; + display: flex; + align-items: center; + border: 0.2rem solid #132043; + + justify-content: space-around; + + position: relative; + + cursor: pointer; +`; + +const GroupTitle = styled.div` + font-size: 2rem; +`; + +const AlarmCircle = styled.div` + position: absolute; + width: 0.8rem; + height: 0.8rem; + right: 0.4rem; + background-color: #c70039; + border-radius: 0.4rem; +`; + +export default RoundAlarmBody; diff --git a/src/components/RoundAlarm/RoundAlarmHeader.tsx b/src/components/RoundAlarm/RoundAlarmHeader.tsx new file mode 100644 index 0000000..7987467 --- /dev/null +++ b/src/components/RoundAlarm/RoundAlarmHeader.tsx @@ -0,0 +1,52 @@ +import styled from '@emotion/styled'; + +interface Props { + liveRound: number; + curRound: number; +} + +type bracketStatus = 'PAST' | 'PRESENT' | 'FUTURE'; + +const RoundAlarmHeader = ({ liveRound, curRound }: Props) => { + return ( + <> + {liveRound > curRound && } + {liveRound === curRound && } + {liveRound < curRound && } + + ); +}; + +const Button = styled.button<{ status: bracketStatus }>` + width: 12rem; + height: 4rem; + border: none; + padding: 0; + margin: 0; + + font-size: 1.6rem; + color: white; + + ${(prop) => + prop.status === 'PAST' && + ` + background-color : #7C81AD; + cursor: pointer; + `} + + ${(prop) => + prop.status === 'PRESENT' && + ` + background-color : #4B527E; + cursor: pointer; + `} + + ${(prop) => + prop.status === 'FUTURE' && + ` + background-color : #2E4374; + cursor: not-allowed + `} +`; + +export default RoundAlarmHeader; From 3e8606ee86b84f32ad4ee33b0f55b59957f48214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Tue, 17 Oct 2023 11:10:29 +0900 Subject: [PATCH 6/6] =?UTF-8?q?Feat:=20Call-Admin=20=ED=83=80=EC=9E=85=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 --- src/@types/admin.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/@types/admin.ts diff --git a/src/@types/admin.ts b/src/@types/admin.ts new file mode 100644 index 0000000..c4c4837 --- /dev/null +++ b/src/@types/admin.ts @@ -0,0 +1,5 @@ +export interface CallAdmin { + matchRound: number; + matchName: string; + callName: string; +}