From 6bceb0c9796ea6148d24666e9cd17ef9481ffe0e Mon Sep 17 00:00:00 2001 From: yoouyeon Date: Sun, 22 Dec 2024 23:51:07 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Fix:=20/game=20url=EC=9D=84=20/takgu/game?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 탁구 페이지의 url이 / 에서 /takgu로 변경됨 --- components/takgu/game/GameResultList.tsx | 6 +++++- components/takgu/mode/modeWraps/GameModeWrap.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/takgu/game/GameResultList.tsx b/components/takgu/game/GameResultList.tsx index d36f36f03..dbfcc765e 100644 --- a/components/takgu/game/GameResultList.tsx +++ b/components/takgu/game/GameResultList.tsx @@ -21,7 +21,11 @@ export default function GameResultList({ useGameResultList(path); const page = - pathName === '/' ? 'main' : pathName === '/game' ? 'game' : 'profile'; + pathName === '/takgu' + ? 'main' + : pathName === '/takgu/game' + ? 'game' + : 'profile'; if (status === 'loading') return ; diff --git a/components/takgu/mode/modeWraps/GameModeWrap.tsx b/components/takgu/mode/modeWraps/GameModeWrap.tsx index ebfa0a25e..a2a17281a 100644 --- a/components/takgu/mode/modeWraps/GameModeWrap.tsx +++ b/components/takgu/mode/modeWraps/GameModeWrap.tsx @@ -40,7 +40,7 @@ export default function GameModeWrap({ setRadioMode(e.target.value as SeasonMode); }; - const isGamePage = useRouter().pathname === '/game'; + const isGamePage = useRouter().pathname === '/takgu/game'; return (
From 8c49be9f62120c9adadb4272a91e5a949e76b5ad Mon Sep 17 00:00:00 2001 From: yoouyeon Date: Sun, 22 Dec 2024 23:51:07 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Fix:=20/game=20url=EC=9D=84=20/takgu/game?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 탁구 페이지의 url이 / 에서 /takgu로 변경됨 --- components/takgu/game/GameResultList.tsx | 6 +++++- components/takgu/mode/modeWraps/GameModeWrap.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/takgu/game/GameResultList.tsx b/components/takgu/game/GameResultList.tsx index d36f36f03..dbfcc765e 100644 --- a/components/takgu/game/GameResultList.tsx +++ b/components/takgu/game/GameResultList.tsx @@ -21,7 +21,11 @@ export default function GameResultList({ useGameResultList(path); const page = - pathName === '/' ? 'main' : pathName === '/game' ? 'game' : 'profile'; + pathName === '/takgu' + ? 'main' + : pathName === '/takgu/game' + ? 'game' + : 'profile'; if (status === 'loading') return ; diff --git a/components/takgu/mode/modeWraps/GameModeWrap.tsx b/components/takgu/mode/modeWraps/GameModeWrap.tsx index ebfa0a25e..a2a17281a 100644 --- a/components/takgu/mode/modeWraps/GameModeWrap.tsx +++ b/components/takgu/mode/modeWraps/GameModeWrap.tsx @@ -40,7 +40,7 @@ export default function GameModeWrap({ setRadioMode(e.target.value as SeasonMode); }; - const isGamePage = useRouter().pathname === '/game'; + const isGamePage = useRouter().pathname === '/takgu/game'; return (
From 5a3351b28780ff7ecf63c58721203553b3578ff9 Mon Sep 17 00:00:00 2001 From: yoouyeon Date: Sat, 28 Dec 2024 00:28:10 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Refactor:=20page=20=EA=B2=B0=EC=A0=95=20?= =?UTF-8?q?=EC=82=BC=ED=95=AD=EC=97=B0=EC=82=B0=EC=9E=90=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 유지보수 용이성을 위해서 삼항연산자 대신 객체로 페이지 타입을 관리하도록 수정 --- components/takgu/game/GameResultList.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/takgu/game/GameResultList.tsx b/components/takgu/game/GameResultList.tsx index dbfcc765e..07d443711 100644 --- a/components/takgu/game/GameResultList.tsx +++ b/components/takgu/game/GameResultList.tsx @@ -13,6 +13,13 @@ interface GameResultListProps { radioMode?: SeasonMode; } +type pageType = 'main' | 'game' | 'profile'; + +const pageTypeMap: Record = { + '/takgu': 'main', + '/takgu/game': 'game', +}; + export default function GameResultList({ path, radioMode, @@ -20,12 +27,7 @@ export default function GameResultList({ const { data, status, fetchNextPage, isLast, clickedGameItem, pathName } = useGameResultList(path); - const page = - pathName === '/takgu' - ? 'main' - : pathName === '/takgu/game' - ? 'game' - : 'profile'; + const page: pageType = pageTypeMap[pathName] || 'profile'; if (status === 'loading') return ;