Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 App폴더 하위 디렉토리 구조 변경 #139

Merged
merged 4 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand Down Expand Up @@ -41,7 +42,7 @@ export default function CertificationPage() {
};
const onClickModalConfirm = () => {
logEvent('click/confrim', 'certification', { remark });
router.push('/');
router.push(ROUTER.HOME);
};

const isButtonDisabled = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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) => {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/select/page.tsx → src/app/mission/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { css } from '@styled-system/css';

import MissionRegistration from './MissionRegistration';

export default function SelectPage() {
export default function MissionNewPage() {
return (
<main className={mainWrapperCss}>
<Header title={'미션 등록'} />
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<main className={mainWrapperCss}>
Expand Down
3 changes: 2 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -17,7 +18,7 @@ export default function Home() {
<LogoIcon />
<h1 className={MainTitleCss}>하루 10분의 변화를 경험하세요.</h1>
</div>
<Link className={LinkCss} href={'/select'} onClick={handleLogin}>
<Link className={LinkCss} href={ROUTER.MISSION.NEW} onClick={handleLogin}>
<button type={'button'} className={LoginButtonCss}>
게스트 로그인
</button>
Expand Down
8 changes: 6 additions & 2 deletions src/constants/router.ts
Original file line number Diff line number Diff line change
@@ -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`,
},
};
Loading