diff --git a/src/app/certification/layout.tsx b/src/app/mission/[id]/record/layout.tsx similarity index 100% rename from src/app/certification/layout.tsx rename to src/app/mission/[id]/record/layout.tsx diff --git a/src/app/certification/page.tsx b/src/app/mission/[id]/record/page.tsx similarity index 98% rename from src/app/certification/page.tsx rename to src/app/mission/[id]/record/page.tsx index 57f6d7bb..ed43545c 100644 --- a/src/app/certification/page.tsx +++ b/src/app/mission/[id]/record/page.tsx @@ -6,11 +6,12 @@ import { useRouter } from 'next/navigation'; import Button from '@/components/Button/Button'; import Dialog from '@/components/Dialog/Dialog'; import Icon from '@/components/Icon'; +import { ROUTER } from '@/constants/router'; import useModal from '@/hooks/useModal'; import { logEvent } from '@/utils'; import { css } from '@styled-system/css'; -export default function CertificationPage() { +export default function MissionRecordPage() { const router = useRouter(); const { isOpen, openModal, closeModal } = useModal(); const [remark, setRemark] = useState(''); @@ -41,7 +42,7 @@ export default function CertificationPage() { }; const onClickModalConfirm = () => { logEvent('click/confrim', 'certification', { remark }); - router.push('/'); + router.push(ROUTER.HOME); }; const isButtonDisabled = () => { diff --git a/src/app/stopwatch/layout.tsx b/src/app/mission/[id]/stopwatch/layout.tsx similarity index 100% rename from src/app/stopwatch/layout.tsx rename to src/app/mission/[id]/stopwatch/layout.tsx diff --git a/src/app/stopwatch/page.tsx b/src/app/mission/[id]/stopwatch/page.tsx similarity index 94% rename from src/app/stopwatch/page.tsx rename to src/app/mission/[id]/stopwatch/page.tsx index 70004dd5..b7585fdd 100644 --- a/src/app/stopwatch/page.tsx +++ b/src/app/mission/[id]/stopwatch/page.tsx @@ -1,11 +1,12 @@ 'use client'; import { useRouter } from 'next/navigation'; -import useStopwatch from '@/app/stopwatch/useStopwatch'; -import useStopwatchStatus from '@/app/stopwatch/useStopwatchStatus'; +import useStopwatch from '@/app/mission/[id]/stopwatch/useStopwatch'; +import useStopwatchStatus from '@/app/mission/[id]/stopwatch/useStopwatchStatus'; import Button from '@/components/Button/Button'; import Dialog from '@/components/Dialog/Dialog'; import Stopwatch from '@/components/Stopwatch/Stopwatch'; +import { ROUTER } from '@/constants/router'; import useModal from '@/hooks/useModal'; import useSearchParamsTypedValue from '@/hooks/useSearchParamsTypedValue'; import { logEvent } from '@/utils'; @@ -29,7 +30,7 @@ export default function StopwatchPage() { const onFinish = () => { logEvent('click/finish', 'stopwatch', { category, finishTime: Number(minutes) * 60 + Number(seconds) }); // TODO: 끝내기 후 로직 추가 - router.push('/certification'); + router.push(ROUTER.MISSION.SUCCESS); }; const onCancel = () => { diff --git a/src/app/stopwatch/useStopwatch.ts b/src/app/mission/[id]/stopwatch/useStopwatch.ts similarity index 94% rename from src/app/stopwatch/useStopwatch.ts rename to src/app/mission/[id]/stopwatch/useStopwatch.ts index 38672dba..ec60f02c 100644 --- a/src/app/stopwatch/useStopwatch.ts +++ b/src/app/mission/[id]/stopwatch/useStopwatch.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import { type StepType } from '@/app/stopwatch/useStopwatchStatus'; +import { type StepType } from '@/app/mission/[id]/stopwatch/useStopwatchStatus'; const INIT_SECONDS = 0; const MAX_SECONDS = 60 * 60; // max 1 hour diff --git a/src/app/stopwatch/useStopwatchStatus.ts b/src/app/mission/[id]/stopwatch/useStopwatchStatus.ts similarity index 100% rename from src/app/stopwatch/useStopwatchStatus.ts rename to src/app/mission/[id]/stopwatch/useStopwatchStatus.ts diff --git a/src/app/select/CategoryBottomSheet.tsx b/src/app/mission/new/CategoryBottomSheet.tsx similarity index 100% rename from src/app/select/CategoryBottomSheet.tsx rename to src/app/mission/new/CategoryBottomSheet.tsx diff --git a/src/app/select/MissionRegistration.tsx b/src/app/mission/new/MissionRegistration.tsx similarity index 93% rename from src/app/select/MissionRegistration.tsx rename to src/app/mission/new/MissionRegistration.tsx index f4c36b65..7f78e56b 100644 --- a/src/app/select/MissionRegistration.tsx +++ b/src/app/mission/new/MissionRegistration.tsx @@ -2,14 +2,16 @@ import { useState } from 'react'; import { useRouter } from 'next/navigation'; -import CategoryBottomSheet from '@/app/select/CategoryBottomSheet'; -import PublicBottomSheet from '@/app/select/PublicBottomSheet'; +import CategoryBottomSheet from '@/app/mission/new/CategoryBottomSheet'; +import PublicBottomSheet from '@/app/mission/new/PublicBottomSheet'; import Button from '@/components/Button/Button'; import Icon from '@/components/Icon'; import Input from '@/components/Input/Input'; +import { ROUTER } from '@/constants/router'; import useToggle from '@/hooks/useToggle'; import { css } from '@/styled-system/css'; import { token } from '@/styled-system/tokens'; +import { withQueryString } from '@/utils'; export default function MissionRegistration() { const router = useRouter(); @@ -43,7 +45,7 @@ export default function MissionRegistration() { const handleSubmit = () => { if (!missionCategory) return; - router.push(`/stopwatch?category=${missionCategory}`); + router.push(withQueryString(ROUTER.MISSION.STOP_WATCH('dummy'), { category: missionCategory })); }; return ( diff --git a/src/app/select/PublicBottomSheet.tsx b/src/app/mission/new/PublicBottomSheet.tsx similarity index 100% rename from src/app/select/PublicBottomSheet.tsx rename to src/app/mission/new/PublicBottomSheet.tsx diff --git a/src/app/select/RadioInputWithImg.tsx b/src/app/mission/new/RadioInputWithImg.tsx similarity index 100% rename from src/app/select/RadioInputWithImg.tsx rename to src/app/mission/new/RadioInputWithImg.tsx diff --git a/src/app/select/SelectMissionForm.tsx b/src/app/mission/new/SelectMissionForm.tsx similarity index 87% rename from src/app/select/SelectMissionForm.tsx rename to src/app/mission/new/SelectMissionForm.tsx index 97cd0bee..5fbe2e01 100644 --- a/src/app/select/SelectMissionForm.tsx +++ b/src/app/mission/new/SelectMissionForm.tsx @@ -2,8 +2,8 @@ import { useState } from 'react'; import { useRouter } from 'next/navigation'; -import RadioInputWithImg from '@/app/select/RadioInputWithImg'; -import { MISSION_CATEGORIES } from '@/app/select/select.constants'; +import RadioInputWithImg from '@/app/mission/new/RadioInputWithImg'; +import { MISSION_CATEGORIES } from '@/app/mission/new/select.constants'; import Button from '@/components/Button/Button'; import { ROUTER } from '@/constants/router'; import { logEvent, withQueryString } from '@/utils'; @@ -21,7 +21,7 @@ export default function SelectMissionForm() { return; } - push(withQueryString(ROUTER.STOPWATCH, { category: selectedCategory })); + push(withQueryString(ROUTER.MISSION.STOP_WATCH('dummy'), { category: selectedCategory })); }; const handleRadioChange = (value: string) => { diff --git a/src/app/complete/layout.tsx b/src/app/mission/new/layout.tsx similarity index 100% rename from src/app/complete/layout.tsx rename to src/app/mission/new/layout.tsx diff --git a/src/app/select/page.tsx b/src/app/mission/new/page.tsx similarity index 95% rename from src/app/select/page.tsx rename to src/app/mission/new/page.tsx index 893ea362..67051144 100644 --- a/src/app/select/page.tsx +++ b/src/app/mission/new/page.tsx @@ -3,7 +3,7 @@ import { css } from '@styled-system/css'; import MissionRegistration from './MissionRegistration'; -export default function SelectPage() { +export default function MissionNewPage() { return (
diff --git a/src/app/select/select.constants.ts b/src/app/mission/new/select.constants.ts similarity index 100% rename from src/app/select/select.constants.ts rename to src/app/mission/new/select.constants.ts diff --git a/src/app/select/layout.tsx b/src/app/mission/success/layout.tsx similarity index 100% rename from src/app/select/layout.tsx rename to src/app/mission/success/layout.tsx diff --git a/src/app/complete/page.tsx b/src/app/mission/success/page.tsx similarity index 92% rename from src/app/complete/page.tsx rename to src/app/mission/success/page.tsx index e2276e01..e9838cbf 100644 --- a/src/app/complete/page.tsx +++ b/src/app/mission/success/page.tsx @@ -2,12 +2,13 @@ import { useRouter } from 'next/navigation'; import lottieJson from '@/assets/lotties/lottieExample.json'; import Button from '@/components/Button/Button'; +import { ROUTER } from '@/constants/router'; import { css } from '@styled-system/css'; import Lottie from 'react-lottie-player'; -export default function CompletePage() { +export default function MissionSuccessPage() { const router = useRouter(); - const onClickConfirmButton = () => router.push('/'); + const onClickConfirmButton = () => router.push(ROUTER.HOME); return (
diff --git a/src/app/page.tsx b/src/app/page.tsx index f045d0cb..daadfea8 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,6 +2,7 @@ import Link from 'next/link'; import LogoIcon from '@/app/LogoIcon'; +import { ROUTER } from '@/constants/router'; import { logEvent } from '@/utils'; import { css } from '@styled-system/css'; import { flex } from '@styled-system/patterns'; @@ -17,7 +18,7 @@ export default function Home() {

하루 10분의 변화를 경험하세요.

- + diff --git a/src/constants/router.ts b/src/constants/router.ts index 11a86b3f..9071554b 100644 --- a/src/constants/router.ts +++ b/src/constants/router.ts @@ -1,5 +1,9 @@ export const ROUTER = { HOME: '/', - SELECT: '/select', - STOPWATCH: '/stopwatch', + MISSION: { + NEW: '/mission/new', + SUCCESS: `/mission/success`, + RECORD: (id: string) => `/mission/${id}/stopwatch`, + STOP_WATCH: (id: string) => `/mission/${id}/stopwatch`, + }, };