diff --git a/src/pages/Game2048/Game/Game.tsx b/src/pages/Game2048/Game/Game.tsx index b750519f8..0686529f5 100644 --- a/src/pages/Game2048/Game/Game.tsx +++ b/src/pages/Game2048/Game/Game.tsx @@ -16,12 +16,13 @@ import { } from './Score'; import refreshGameUrl from 'assets/svg/game2048/refresh_game.svg'; import { useAnalytics } from 'services/analytics'; -import { useUserData } from 'hooks'; +import { useMini, useUserData } from 'hooks'; export const Game: React.FC = () => { const analytics = useAnalytics(); const { isTop } = useCurrentScreen(); const minigameApi = useMinigameApi(); + const { isInWebEnvironment } = useMini(); const { userId, setUserInfo } = useUserData(); const { score: myBestScore, highestScore, gameType } = useMyGame2048Data(); const { @@ -49,6 +50,10 @@ export const Game: React.FC = () => { resetGame(); }; const handleGameEnd = async () => { + if (isInWebEnvironment) { + setIsGameOver(true); + return; + } analytics.logEvent('click_game_end_button', { game_type: '2048_puzzle', button_type: 'game_end', diff --git a/src/pages/Game2048/Home/Home.tsx b/src/pages/Game2048/Home/Home.tsx index 0edb2f915..4d0959f6e 100644 --- a/src/pages/Game2048/Home/Home.tsx +++ b/src/pages/Game2048/Home/Home.tsx @@ -208,7 +208,10 @@ export const Home = () => { }); if (response !== undefined) { setLastWeekTopDistrict({ - townName1: response[0].name1, + townName1: response[0].name1.replace( + /(특별시|광역시|특별자치시|특별자치도)$/, + '' + ), townName2: response[0].name2, score: response[0].score, }); @@ -253,11 +256,18 @@ export const Home = () => { 1000 ); if (data) { - const indexedDistrictRankData = data.map((item: any, index: number) => ({ - rank: index + 1, + const indexedUserRankData = data.map((item: any, index: number) => ({ ...item, + rank: index + 1, + town: { + ...item.town, + name1: item.town.name1.replace( + /(특별시|광역시|특별자치시|특별자치도)$/, + '' + ), + }, })); - setUserLeaderboardData(indexedDistrictRankData); + setUserLeaderboardData(indexedUserRankData); } }, [gameType, minigameApi]); const getDistrictLeaderboardData = useCallback(async () => { @@ -266,8 +276,9 @@ export const Home = () => { } = await minigameApi.gameTownApi.getLeaderBoardByTownUsingGET(gameType); if (data) { const indexedDistrictRankData = data.map((item: any, index: number) => ({ - rank: index + 1, ...item, + rank: index + 1, + name1: item.name1.replace(/(특별시|광역시|특별자치시|특별자치도)$/, ''), })); setDistrictLeaderboardData(indexedDistrictRankData); } diff --git a/src/pages/Game2048/Home/LastWeekWinner/LastWeekWinner.tsx b/src/pages/Game2048/Home/LastWeekWinner/LastWeekWinner.tsx index c687260a8..c245c522b 100644 --- a/src/pages/Game2048/Home/LastWeekWinner/LastWeekWinner.tsx +++ b/src/pages/Game2048/Home/LastWeekWinner/LastWeekWinner.tsx @@ -16,7 +16,7 @@ const LastWeekTopDistrict: React.FC = (props) => { 지난 주 1등 동네 - {props.townName1.slice(0, 2)} {props.townName2} + {props.townName1} {props.townName2} {commafy(props.score)}점 diff --git a/src/pages/Game2048/Leaderboard/Leaderboard.tsx b/src/pages/Game2048/Leaderboard/Leaderboard.tsx index 086c791f0..cb3fef554 100644 --- a/src/pages/Game2048/Leaderboard/Leaderboard.tsx +++ b/src/pages/Game2048/Leaderboard/Leaderboard.tsx @@ -94,8 +94,15 @@ export const Leaderboard = () => { ); if (data) { const indexedUserRankData = data.map((item: any, index: number) => ({ - rank: index + 1, ...item, + rank: index + 1, + town: { + ...item.town, + name1: item.town.name1.replace( + /(특별시|광역시|특별자치시|특별자치도)$/, + '' + ), + }, })); setUserLeaderboardData(() => indexedUserRankData); } @@ -107,8 +114,9 @@ export const Leaderboard = () => { } = await minigameApi.gameTownApi.getLeaderBoardByTownUsingGET(gameType); if (data) { const indexedDistrictRankData = data.map((item: any, index: number) => ({ - rank: index + 1, ...item, + rank: index + 1, + name1: item.name1.replace(/(특별시|광역시|특별자치시|특별자치도)$/, ''), })); setDistrictLeaderboardData(() => indexedDistrictRankData); diff --git a/src/pages/Game2048/Leaderboard/LeaderboardTabs/LeaderboardTabs.tsx b/src/pages/Game2048/Leaderboard/LeaderboardTabs/LeaderboardTabs.tsx index 0556370de..475491b5a 100644 --- a/src/pages/Game2048/Leaderboard/LeaderboardTabs/LeaderboardTabs.tsx +++ b/src/pages/Game2048/Leaderboard/LeaderboardTabs/LeaderboardTabs.tsx @@ -16,6 +16,7 @@ type Props = { isRanked: boolean; }; const LeaderboardTabs: React.FC = (props) => { + console.log(props.userLeaderboardData); const { isTop } = useCurrentScreen(); const [activeTabKey, setActiveTabKey] = useState('district'); const handleTabChange = (key: string) => { diff --git a/src/pages/Game2048/Leaderboard/LeaderboardTabs/Row/DefaultRow.tsx b/src/pages/Game2048/Leaderboard/LeaderboardTabs/Row/DefaultRow.tsx index 5cec01d06..f4c72b62c 100644 --- a/src/pages/Game2048/Leaderboard/LeaderboardTabs/Row/DefaultRow.tsx +++ b/src/pages/Game2048/Leaderboard/LeaderboardTabs/Row/DefaultRow.tsx @@ -22,7 +22,7 @@ export const DefaultUserRow: React.FC = (props) => { {props.nickname} - {props.cityName.slice(0, 2)} {props.districtName} + {props.cityName} {props.districtName} {commafy(props.score)} @@ -49,7 +49,7 @@ export const DefaultDistrictRow: React.FC = ( - {props.cityName.slice(0, 2)} {props.districtName} + {props.cityName} {props.districtName} {commafy(props.score)} diff --git a/src/pages/Game2048/Leaderboard/LeaderboardTabs/Row/TopRow.tsx b/src/pages/Game2048/Leaderboard/LeaderboardTabs/Row/TopRow.tsx index a711e2ab8..9b2b1cdba 100644 --- a/src/pages/Game2048/Leaderboard/LeaderboardTabs/Row/TopRow.tsx +++ b/src/pages/Game2048/Leaderboard/LeaderboardTabs/Row/TopRow.tsx @@ -30,7 +30,7 @@ export const TopUserRow: React.FC = (props) => { {props.nickname} - {props.cityName.slice(0, 2)} {props.districtName} + {props.cityName} {props.districtName} {commafy(props.score)} @@ -56,7 +56,7 @@ export const TopDistrictRow: React.FC = (props) => { - {props.cityName.slice(0, 2)} {props.districtName} + {props.cityName} {props.districtName} {commafy(props.score)} diff --git a/src/pages/Game2048/Leaderboard/MyInfo/MyInfo.tsx b/src/pages/Game2048/Leaderboard/MyInfo/MyInfo.tsx index 0819b3c63..a4db2505d 100644 --- a/src/pages/Game2048/Leaderboard/MyInfo/MyInfo.tsx +++ b/src/pages/Game2048/Leaderboard/MyInfo/MyInfo.tsx @@ -21,7 +21,8 @@ export const MyInfo: React.FC = () => { {nickname} - {cityName.slice(0, 2)} {districtName} + {cityName.replace(/(특별시|광역시|특별자치시|특별자치도)$/, '')} +  {districtName} diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 9382a0385..961fe6644 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -346,8 +346,15 @@ export const Home: React.FC = () => { }); const indexedResponse2048Puzzle = response?.map( (item: any, index: number) => ({ - rank: index + 1, ...item, + rank: index + 1, + town: { + ...item.town, + name1: item.town.name1.replace( + /(특별시|광역시|특별자치시|특별자치도)$/, + '' + ), + }, }) ); setTop2048PuzzleUsers(indexedResponse2048Puzzle); @@ -359,8 +366,15 @@ export const Home: React.FC = () => { }); const indexedResponseKarrotClicker = response?.map( (item: any, index: number) => ({ - rank: index + 1, ...item, + rank: index + 1, + town: { + ...item.town, + name1: item.town.name1.replace( + /(특별시|광역시|특별자치시|특별자치도)$/, + '' + ), + }, }) ); setTopKarrotClickerUsers(indexedResponseKarrotClicker); @@ -497,7 +511,6 @@ export const Home: React.FC = () => { className="mySwiper" > {top2048PuzzleUsers?.map((user, i) => { - console.log(top2048PuzzleUsers, i); if (user.comment === '' || user.comment === null) { user.comment = `${user.town.name2} 파이팅!`; } @@ -513,7 +526,7 @@ export const Home: React.FC = () => { {user.rank}등 {user.nickname}

- {user.town.name1.slice(0, 2)} {user.town.name2} + {user.town.name1} {user.town.name2}

{user.comment}

@@ -555,7 +568,7 @@ export const Home: React.FC = () => { {user.rank}등 {user.nickname}

- {user.town.name1.slice(0, 2)} {user.town.name2} + {user.town.name1} {user.town.name2}

{user.comment}

diff --git a/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Leaderboard/DistrictLeaderboard.tsx b/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Leaderboard/DistrictLeaderboard.tsx index fe3815f99..be69e37c8 100644 --- a/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Leaderboard/DistrictLeaderboard.tsx +++ b/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Leaderboard/DistrictLeaderboard.tsx @@ -23,8 +23,12 @@ export const DistrictLeaderboard: React.FC = () => { if (data) { const indexedDistrictRankData = data.map( (item: any, index: number) => ({ - rank: index + 1, ...item, + rank: index + 1, + name1: item.name1.replace( + /(특별시|광역시|특별자치시|특별자치도)$/, + '' + ), }) ); setDistrictRankData(indexedDistrictRankData); diff --git a/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Leaderboard/IndividualLeaderboard.tsx b/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Leaderboard/IndividualLeaderboard.tsx index 67871db06..6e50202a0 100644 --- a/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Leaderboard/IndividualLeaderboard.tsx +++ b/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Leaderboard/IndividualLeaderboard.tsx @@ -43,8 +43,15 @@ export const IndividualLeaderboard: React.FC = () => { if (data) { const indexedindividualRankData = data.map( (item: any, index: number) => ({ - rank: index + 1, ...item, + rank: index + 1, + town: { + ...item.town, + name1: item.town.name1.replace( + /(특별시|광역시|특별자치시|특별자치도)$/, + '' + ), + }, }) ); setIndividualRankData(() => indexedindividualRankData); diff --git a/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Row/DefaultRow.tsx b/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Row/DefaultRow.tsx index 3a28367f0..a81175391 100644 --- a/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Row/DefaultRow.tsx +++ b/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Row/DefaultRow.tsx @@ -25,7 +25,7 @@ export const DefaultUserRow: React.FC = (props) => { - {props.districtName.slice(0, -1)} + {props.districtName} {props.nickname} @@ -45,7 +45,7 @@ export const DefaultDistrictRow: React.FC = ( - {props.cityName.slice(0, -3)} {props.districtName} + {props.cityName} {props.districtName} {commafy(props.score)} diff --git a/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Row/TopRow.tsx b/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Row/TopRow.tsx index 0a53ab9e0..f7dc8f1a8 100644 --- a/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Row/TopRow.tsx +++ b/src/pages/KarrotClicker/Leaderboard/LeaderboardTabs/Row/TopRow.tsx @@ -36,7 +36,7 @@ export const TopUserRow: React.FC = (props) => { - {props.districtName.slice(0, -1)} + {props.districtName} {props.nickname} @@ -55,7 +55,7 @@ export const TopDistrictRow: React.FC = (props) => { - {props.cityName.slice(0, 2)} {props.districtName} + {props.cityName} {props.districtName} {commafy(props.score)}