Skip to content

Commit

Permalink
Merge pull request #127 from prgrms-web-devcourse-final-project/feature/
Browse files Browse the repository at this point in the history
#126-TestSet

Feature: test ํ™˜๊ฒฝ ์…‹ํŒ…
  • Loading branch information
minjeongss authored Dec 9, 2024
2 parents 43d16e6 + 3f8202f commit 40d7e6a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
5 changes: 1 addition & 4 deletions app/game/[roomId]/[round]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ const GamePage = ({ params }: GamePageProps) => {
}
};

// ๋””๋ฒ„๊น…์šฉ ์ฝ˜์†” ๋กœ๊ทธ ์ถ”๊ฐ€
console.log('ํ˜„์žฌ gameState:', gameState);
console.log('contentUrls:', gameState.roundState?.contentUrls);
return (
<>
<PageWrapper>
Expand All @@ -126,7 +123,7 @@ const GamePage = ({ params }: GamePageProps) => {
isMapView={isMapView}
onBackClick={handleBackClick}
/>
<Timer initialTime={60} onTimeEnd={handleNextRound} />
<Timer initialTime={30} onTimeEnd={handleNextRound} />

{/* ๊ธฐ๋ณธ ๋ทฐ (์Šค์™€์ดํผ์™€ ํžŒํŠธ) */}
{isMapView ? (
Expand Down
10 changes: 5 additions & 5 deletions app/game/[roomId]/[round]/roundRank/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const RoundRank = ({
}) => {
const router = useRouter();
const currentRound = Number(params.round) || 1;
const maxRounds = 3;
const maxRounds = 2;
const messages = useWebSocketStore((state) => state.messages);
const [currentRoundData, setCurrentRoundData] = useState<
'thisRound' | 'totalRound'
Expand All @@ -54,8 +54,8 @@ const RoundRank = ({
? b.score - a.score
: b.totalScore - a.totalScore
)
.map((coord) => ({
rank: 0,
.map((coord, index) => ({
rank: index + 1,
name: coord.nickname,
score:
currentRoundData === 'thisRound' ? coord.score : coord.totalScore,
Expand All @@ -80,7 +80,7 @@ const RoundRank = ({
<PageWrapper>
<TopBar NavType="game" label={`${currentRound} ๋ผ์šด๋“œ`} />
{currentRound < maxRounds && (
<Timer initialTime={15} onTimeEnd={handleNextRound} />
<Timer initialTime={10} onTimeEnd={handleNextRound} />
)}
<MapComponent
mode="rank"
Expand All @@ -96,7 +96,7 @@ const RoundRank = ({
/>
{currentRound >= maxRounds && (
<Footer>
<CountdownButton initialTime={15} onTimeEnd={handleNextRound} />
<CountdownButton initialTime={10} onTimeEnd={handleNextRound} />
</Footer>
)}
</PageWrapper>
Expand Down
28 changes: 24 additions & 4 deletions components/Layout/Game/GoogleMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,24 @@ const MapComponent: React.FC<MapComponentProps> = ({
}
};

// ๋ถ€๋“œ๋Ÿฌ์šด ์คŒ์„ ์œ„ํ•œ ํ•จ์ˆ˜ ์ถ”๊ฐ€
const smoothZoom = (
map: google.maps.Map,
targetZoom: number,
currentZoom: number
) => {
if (currentZoom !== targetZoom) {
const nextZoom =
currentZoom < targetZoom ? currentZoom + 1 : currentZoom - 1;
google.maps.event.addListenerOnce(map, 'zoom_changed', () => {
setTimeout(() => {
smoothZoom(map, targetZoom, nextZoom);
}, 180); // ์คŒ ์†๋„ ์กฐ์ ˆ
});
map.setZoom(nextZoom);
}
};

// ์ •๋‹ต ์ขŒํ‘œ ๋ฐ ์œ ์ € ์ขŒํ‘œ ๋งˆ์ปค ๋ฐฐ์น˜ ํ•จ์ˆ˜
const placeMarkers = () => {
if (!mapRef.current) return;
Expand All @@ -136,13 +154,15 @@ const MapComponent: React.FC<MapComponentProps> = ({
});
markerRefs.current.push(answerMarker);

// ๋” ์ž์—ฐ์Šค๋Ÿฌ์šด ์คŒ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์œ„ํ•œ ์ˆœ์ฐจ์  ์‹คํ–‰
mapRef.current.setZoom(12); // ๋จผ์ € ๋„“์€ ์‹œ์•ผ๋กœ ์คŒ ์•„์›ƒ
// ๋” ์ž์—ฐ์Šค๋Ÿฌ์šด ์คŒ ์• ๋‹ˆ๋ฉ”์ด์…˜
mapRef.current.setZoom(7); // ๋จผ์ € ๋„“์€ ์‹œ์•ผ๋กœ ์คŒ ์•„์›ƒ
setTimeout(() => {
mapRef.current?.panTo(answerCoordinate); // ์œ„์น˜๋กœ ์ด๋™
setTimeout(() => {
mapRef.current?.setZoom(15); // ๋ถ€๋“œ๋Ÿฝ๊ฒŒ ์คŒ์ธ
}, 1000);
if (mapRef.current) {
smoothZoom(mapRef.current, 15, 7); // ๋ถ€๋“œ๋Ÿฝ๊ฒŒ ์คŒ์ธ (7์—์„œ 15๊นŒ์ง€)
}
}, 500);
}, 100);
}

Expand Down
1 change: 0 additions & 1 deletion lib/websocket/gameWebsocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import useUserStore from '@/stores/useUserStore';
import toast from 'react-hot-toast';
import { API_URL_CONFIG } from '@/config/apiEndPointConfig';

// ์ธํ„ฐํŽ˜์ด์Šค ์ •์˜ ๋ถ€๋ถ„์€ ๋ณ€๊ฒฝ ์—†์Œ
export interface RoundCreateRequest {
gameId: number;
roundNum: number;
Expand Down
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,
compiler: {
styledComponents: {
displayName: true,
Expand Down

0 comments on commit 40d7e6a

Please sign in to comment.