-
Notifications
You must be signed in to change notification settings - Fork 0
[cherry-pick] 신규 회원 온보딩 모달 구현 #689
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f619848
[onboarding] hotfix : [onBoarding] feat : feat(store): 온보딩 모달 Zustand…
HA-SEUNG-JEONG ed11154
[onboarding] hotfix : [onBoarding] feat : fix(onboarding): 모달 4단계 크리티…
HA-SEUNG-JEONG 7da11c0
[onboarding] hotfix : [onBoarding] feat : fix(class): useSearchParams…
HA-SEUNG-JEONG 72d0b4e
[onboarding] hotfix : [onBoarding] fix : JPEG MIME 누락·noopener 미적용·업로…
HA-SEUNG-JEONG c19256e
[onboarding] hotfix : [onBoarding] feat : OAuth 신규 회원 온보딩 플로우 리다이렉트 연결
HA-SEUNG-JEONG cc00cf1
[onboarding] hotfix : [onBoarding] feat : fix(e2e): LOGIN_ONLY 결제 CTA…
HA-SEUNG-JEONG 858fdcd
[onboarding] hotfix : [onBoarding] feat : fix(e2e): 그룹스터디 개설 테스트 썸네일 …
HA-SEUNG-JEONG a706d9f
[onboarding] hotfix : [onBoarding] feat : test(e2e): 그룹/멘토스터디 개설 테스트 …
HA-SEUNG-JEONG 63953ec
[onboarding] fix : [onBoarding] PR #689 리뷰 수정 — param 보존·disabled·toa…
HA-SEUNG-JEONG 77739de
[onboarding] style : markdown-editor prettier 포맷 정리
HA-SEUNG-JEONG 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 hidden or 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 hidden or 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 hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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
164 changes: 164 additions & 0 deletions
164
src/components/auth/modals/onboarding-modal/onboarding-modal.tsx
This file contains hidden or 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,164 @@ | ||
| 'use client'; | ||
|
|
||
| import { X } from 'lucide-react'; | ||
| import { useEffect, useState } from 'react'; | ||
| import { createPortal } from 'react-dom'; | ||
| import { cn } from '@/components/common/ui/(shadcn)/lib/utils'; | ||
| import { useOnboardingStore } from '@/stores/use-onboarding-store'; | ||
| import { Step1Nickname } from './steps/step-1-nickname'; | ||
| import { Step2Job } from './steps/step-2-job'; | ||
| import { Step3Goals } from './steps/step-3-goals'; | ||
| import { Step4Completion } from './steps/step-4-completion'; | ||
|
|
||
| type Step = 1 | 2 | 3 | 4; | ||
|
|
||
| interface OnboardingData { | ||
| nickname: string; | ||
| profileImageUrl?: string; | ||
| profileImageFile?: File; | ||
| career?: string; | ||
| job?: string; | ||
| goals: string[]; | ||
| goalEtcText?: string; | ||
| termsAgreed: boolean; | ||
| privacyAgreed: boolean; | ||
| marketingAgreed: boolean; | ||
| } | ||
|
|
||
| export function OnboardingModal() { | ||
| const { isOpen, close } = useOnboardingStore(); | ||
| const [mounted, setMounted] = useState(false); | ||
| const [currentStep, setCurrentStep] = useState<Step>(1); | ||
| const [isSubmitting, setIsSubmitting] = useState(false); | ||
| const [data, setData] = useState<OnboardingData>({ | ||
| nickname: '', | ||
| goals: [], | ||
| termsAgreed: false, | ||
| privacyAgreed: false, | ||
| marketingAgreed: false, | ||
| }); | ||
|
|
||
| useEffect(() => { | ||
| setMounted(true); | ||
| return () => setMounted(false); | ||
| }, []); | ||
|
|
||
| useEffect(() => { | ||
| if (isOpen) { | ||
| setCurrentStep(1); | ||
| setData({ | ||
| nickname: '', | ||
| goals: [], | ||
| termsAgreed: false, | ||
| privacyAgreed: false, | ||
| marketingAgreed: false, | ||
| }); | ||
| } | ||
| }, [isOpen]); | ||
|
|
||
| const updateData = (field: keyof OnboardingData, value: unknown) => { | ||
| setData((prev) => ({ ...prev, [field]: value })); | ||
| }; | ||
|
|
||
| const handleNext = () => { | ||
| if (currentStep < 4) setCurrentStep((prev) => (prev + 1) as Step); | ||
| }; | ||
|
|
||
| const handleBack = () => { | ||
| if (currentStep > 1) setCurrentStep((prev) => (prev - 1) as Step); | ||
| }; | ||
|
|
||
| if (!mounted || !isOpen) return null; | ||
|
|
||
| const renderStep = () => { | ||
| switch (currentStep) { | ||
| case 1: | ||
| return ( | ||
| <Step1Nickname | ||
| data={data} | ||
| updateData={updateData} | ||
| onNext={handleNext} | ||
| /> | ||
| ); | ||
| case 2: | ||
| return ( | ||
| <Step2Job data={data} updateData={updateData} onNext={handleNext} /> | ||
| ); | ||
| case 3: | ||
| return ( | ||
| <Step3Goals data={data} updateData={updateData} onNext={handleNext} /> | ||
| ); | ||
| case 4: | ||
| return ( | ||
| <Step4Completion data={data} onSubmittingChange={setIsSubmitting} /> | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| return createPortal( | ||
| <div className="fixed inset-0 z-50 flex items-center justify-center px-300"> | ||
| {/* Backdrop */} | ||
| <div | ||
| className="absolute inset-0 bg-black/40" | ||
| onClick={isSubmitting ? undefined : close} | ||
| aria-hidden="true" | ||
| /> | ||
|
|
||
| {/* Modal panel */} | ||
| <div className="relative flex max-h-[90vh] w-full max-w-7500 flex-col overflow-hidden rounded-200 bg-white"> | ||
| {/* Header */} | ||
| <div className="flex items-center justify-between px-500 pt-400 pb-300"> | ||
| {/* Back button */} | ||
| {currentStep > 1 ? ( | ||
| <button | ||
| type="button" | ||
| onClick={handleBack} | ||
| disabled={isSubmitting} | ||
| className="rounded-100 p-100 text-gray-500 transition-colors hover:bg-gray-100" | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| aria-label="이전" | ||
| > | ||
| <X className="h-300 w-300 rotate-[135deg]" /> | ||
| </button> | ||
| ) : ( | ||
| <div className="size-500" /> | ||
| )} | ||
|
|
||
| {/* Step indicator */} | ||
| <div className="flex items-center gap-100"> | ||
| {([1, 2, 3, 4] as Step[]).map((step) => ( | ||
| <div | ||
| key={step} | ||
| className={cn( | ||
| 'rounded-full bg-gray-300 transition-all duration-300', | ||
| step === currentStep ? 'h-125 w-350 bg-rose-500' : 'size-125', | ||
| )} | ||
| /> | ||
| ))} | ||
| </div> | ||
|
|
||
| {/* Close button */} | ||
| <button | ||
| type="button" | ||
| onClick={close} | ||
| disabled={isSubmitting} | ||
| className="rounded-100 p-100 text-gray-500 transition-colors hover:bg-gray-100" | ||
| aria-label="닫기" | ||
| > | ||
| <X className="h-300 w-300" /> | ||
| </button> | ||
| </div> | ||
|
|
||
| {/* Content */} | ||
| <div className="overflow-y-auto px-500 pb-500"> | ||
| <div | ||
| key={currentStep} | ||
| className="animate-in slide-in-from-right-4 fade-in fill-mode-forwards flex flex-col duration-300" | ||
| > | ||
| {renderStep()} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div>, | ||
| document.body, | ||
| ); | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.