-
Notifications
You must be signed in to change notification settings - Fork 1
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
[#581] [모임 생성] 모임 생성 퍼널 페이지 작성 #582
Merged
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
99d7899
chore: 책 선택 스텝 경로 수정
hanyugeon 38eff66
feat: useFunnel 커스텀훅에 currentStep 조회 기능 추가
hanyugeon 19fdc9c
feat: 모임 생성 퍼널 작성
hanyugeon 487ec05
feat: 모임 상세 퍼널 뒤로가기 버튼 기능 구현
hanyugeon 81ba6c6
refactor: Funnel.tsx 경로 변경 및 공통 interface 정의
hanyugeon 8b87b30
refactor: 모임 생성 퍼널 코드 스플리팅
hanyugeon 02555be
chore: 모임 생성 퍼널 스텝 stories 경로 변경
hanyugeon 76cdcd6
refactor: index 파일 정리
hanyugeon 8882f87
refactor: formValues 타입 정리
hanyugeon aad87bf
chore: 스토리북 import 경로 수정
hanyugeon 37f8739
feat: 모임 생성 mutation 함수 작성
hanyugeon 1f37409
feat: 독서 모임 생성 기능 구현
hanyugeon 5550b61
chore: import문 수정
hanyugeon 4fd5a25
refactor: StepFormValues 타입명 통일 (리뷰 반영)
hanyugeon 2b61fff
feat: SwitchIsPublicField에서 isComment 값에 따른 안내 문구 표시
hanyugeon 2994ada
chore: CreateBookGroupFunnel 컴포넌트 이름 수정
hanyugeon cf0cd13
feat: 독서 모임 생성시 독서 모임 상세 페이지로 이동
hanyugeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,7 @@ | ||
'use client'; | ||
import CreateBookGroupFunnel from '@/v1/bookGroup/create/CreateBookGroupFunnel'; | ||
|
||
import AddGroupForm from '@/ui/Group/AddGroupForm'; | ||
import { VStack } from '@chakra-ui/react'; | ||
import TopNavigation from '@/ui/common/TopNavigation'; | ||
import AuthRequired from '@/ui/AuthRequired'; | ||
|
||
const GroupCreatePage = () => { | ||
return ( | ||
<AuthRequired> | ||
<VStack justify="center" align="center"> | ||
<TopNavigation pageTitle="모임 생성" /> | ||
<AddGroupForm /> | ||
</VStack> | ||
</AuthRequired> | ||
); | ||
const GroupCreateFunnelPage = () => { | ||
return <CreateBookGroupFunnel />; | ||
}; | ||
|
||
export default GroupCreatePage; | ||
export default GroupCreateFunnelPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
'use client'; | ||
|
||
import { useEffect, useMemo, useRef } from 'react'; | ||
import { usePathname, useRouter, useSearchParams } from 'next/navigation'; | ||
|
||
import type { FunnelProps, StepProps } from '@/v1/base/Funnel/Funnel'; | ||
import { assert } from '@/utils/assert'; | ||
|
||
import { Funnel, Step } from '@/v1/base/Funnel/Funnel'; | ||
import { usePathname, useRouter, useSearchParams } from 'next/navigation'; | ||
import type { FunnelProps, StepProps } from '@/v1/base/Funnel'; | ||
import { Funnel, Step } from '@/v1/base/Funnel'; | ||
|
||
export type NonEmptyArray<T> = readonly [T, ...T[]]; | ||
|
||
|
@@ -34,7 +34,11 @@ export const useFunnel = <Steps extends NonEmptyArray<string>>( | |
initialStep?: Steps[number]; | ||
onStepChange?: (name: Steps[number]) => void; | ||
} | ||
): readonly [FunnelComponent<Steps>, (step: Steps[number]) => void] => { | ||
): readonly [ | ||
FunnelComponent<Steps>, | ||
(step: Steps[number]) => void, | ||
Steps[number] | ||
] => { | ||
const router = useRouter(); | ||
const searchParams = useSearchParams(); | ||
const pathname = usePathname(); | ||
|
@@ -78,11 +82,12 @@ export const useFunnel = <Steps extends NonEmptyArray<string>>( | |
const params = new URLSearchParams(searchParams.toString()); | ||
params.set('funnel-step', `${step}`); | ||
|
||
return router.replace(`?${params.toString()}`); | ||
return router.replace(`?${params.toString()}`, { shallow: true }); | ||
}; | ||
|
||
return [FunnelComponent, setStep] as unknown as readonly [ | ||
return [FunnelComponent, setStep, step] as unknown as readonly [ | ||
FunnelComponent<Steps>, | ||
(step: Steps[number]) => Promise<void> | ||
(step: Steps[number]) => Promise<void>, | ||
Steps[number] | ||
Comment on lines
+88
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment; 이제 const [Funnel, setStep, currentStep] = useFunnel(FUNNEL_STEPS, {
initialStep: 'SelectBook',
}); |
||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
|
||
import type { APICreateGroup } from '@/types/group'; | ||
import groupAPI from '@/apis/group'; | ||
|
||
const useCreateBookGroupMutation = () => { | ||
return useMutation({ | ||
mutationFn: (formData: APICreateGroup) => | ||
groupAPI.createGroup(formData).then(({ data }) => data), | ||
}); | ||
}; | ||
|
||
export default useCreateBookGroupMutation; |
9 changes: 4 additions & 5 deletions
9
.../create/funnel/EnterTitleStep.stories.tsx → ...p/create/steps/EnterTitleStep.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment;
관련 문서를 보면 해당
{ shallow: true }
옵션을 통해 url의 query가 바뀌어도 페이지가 교체되지 않는다고 합니다 🤔