-
Notifications
You must be signed in to change notification settings - Fork 1
Feat: 온보딩 UI #10
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
Feat: 온보딩 UI #10
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
d9d9659
feat:온보딩 step
idid10 81222b9
feat: 프로필 업로드 ui
idid10 f4a9e4a
feat: loading 모달 추가
idid10 4f7e2c5
style: 프로필 업로드 훅 분리
idid10 de71818
design: 수정사항 반영
idid10 b2bcc6d
design:프로필 이미지 영역을 ProfileImagePicker로 분리
idid10 74cb410
design:이름 입력 인풋 너비 자동 조정
idid10 9243742
Merge branch 'develop' of https://github.com/IT-Cotato/12th-SimTok-FE…
idid10 2499166
refactor: loading gif삭제하고 직접 구현
idid10 f522b7d
refactor: 회원가입 -> 온보딩 -> 홈
idid10 d80c9e7
refactor: 비밀번호 valid 로직 변경사항 반영
idid10 8c7048d
refactor: agree type, constants분리
idid10 3b7dc44
fix: onboardingfunnelsteps object
idid10 a4d14e0
fix: 온보딩 배경 width
idid10 1483d0c
refactor: redirect 홈화면으로 수정
idid10 3e4517f
refactor: handlefilechange 동일한 파일 재선택 가능하도록 수정
idid10 f0e0b67
refactor: 모달 접근성 개선
idid10 2b1e02d
refactor: 이미지 업로드 에러 처리
idid10 059fed1
refactor: 프로필 업로드 중단 로직 추가
idid10 6317409
refactor: useFunnel 삭제
idid10 14cfb75
Merge brahcn 'develop' into feat/6-onboarding'
idid10 f1559ac
refactor: FullButton import 변경
idid10 142e82d
refactor: full button 코드 수정
58563bc
design: 하루한컷 피드 box-shadow 수정
63e143b
feat: w-full 적용
idid10 14e162c
refactor: 반응형 화면 수정
idid10 8a4aa56
refactor: 새 이미지 업로드시 이전 blob URL 해제
idid10 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
Some comments aren't visible on the classic Files Changed page.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| "use client"; | ||
|
|
||
| import { useRouter } from "next/navigation"; | ||
|
|
||
| import { useState } from "react"; | ||
|
|
||
| import OnboardingStep from "@/components/onboarding/OnboardingStep"; | ||
| import ProgressDots from "@/components/onboarding/ProgressDots"; | ||
|
|
||
| import { | ||
| ONBOARDING_STEPS, | ||
| type OnboardingStepName, | ||
| } from "@/constants/onboardingSteps"; | ||
|
|
||
| const OnboardingPage = () => { | ||
| const router = useRouter(); | ||
| const [currentStepIndex, setCurrentStepIndex] = useState(0); | ||
|
|
||
| const currentStepName = ONBOARDING_STEPS[ | ||
| currentStepIndex | ||
| ] as OnboardingStepName; | ||
| const isLastStep = currentStepIndex === ONBOARDING_STEPS.length - 1; | ||
|
|
||
| const goNext = () => { | ||
| const nextIndex = currentStepIndex + 1; | ||
|
|
||
| if (nextIndex >= ONBOARDING_STEPS.length) { | ||
| if (typeof window !== "undefined") { | ||
| localStorage.setItem("onboardingDone", "true"); | ||
| } | ||
| router.push("/onboarding/profile"); | ||
| return; | ||
| } | ||
|
|
||
| setCurrentStepIndex(nextIndex); | ||
| }; | ||
|
|
||
| return ( | ||
| <section className="flex min-h-dvh justify-center"> | ||
| <div className="relative mt-[73px] flex h-full flex-col"> | ||
idid10 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <div className="z-10"> | ||
| <ProgressDots | ||
| total={ONBOARDING_STEPS.length} | ||
| current={currentStepIndex} | ||
| /> | ||
| </div> | ||
|
|
||
| <OnboardingStep | ||
| stepName={currentStepName} | ||
| isLastStep={isLastStep} | ||
| onNext={goNext} | ||
| /> | ||
| </div> | ||
| </section> | ||
| ); | ||
| }; | ||
|
|
||
| export default OnboardingPage; | ||
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,6 @@ | ||
| import OnboardingProfileClient from "@/components/onboarding/OnboardingProfile"; | ||
|
|
||
| const OnboardingProfilePage = () => { | ||
| return <OnboardingProfileClient />; | ||
| }; | ||
| export default OnboardingProfilePage; |
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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| export default function Home() { | ||
| return <div>홈화면</div>; | ||
| export default function HomePage() { | ||
| return <div>홈 화면</div>; | ||
| } |
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.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| "use client"; | ||
|
|
||
| import { useEffect, useRef, useState } from "react"; | ||
|
|
||
| interface NameInputProps { | ||
| value: string; | ||
| onChange: (value: string) => void; | ||
| } | ||
|
|
||
| const PLACEHOLDER = "이름을 입력해주세요"; | ||
|
|
||
| const INITIAL_WIDTH = 204; | ||
| const NameInput = ({ value, onChange }: NameInputProps) => { | ||
idid10 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const spanRef = useRef<HTMLSpanElement>(null); | ||
| const [inputWidth, setInputWidth] = useState<number>(INITIAL_WIDTH); | ||
|
|
||
| useEffect(() => { | ||
| if (!spanRef.current) return; | ||
|
|
||
| const spanWidth = spanRef.current.offsetWidth; | ||
| setInputWidth(spanWidth + 36); | ||
| }, [value]); | ||
|
|
||
| return ( | ||
| <div className="flex justify-center"> | ||
| <span ref={spanRef} className="text-d3 invisible absolute whitespace-pre"> | ||
| {value || PLACEHOLDER} | ||
| </span> | ||
|
|
||
| <input | ||
| type="text" | ||
| value={value} | ||
| onChange={e => onChange(e.target.value)} | ||
| placeholder={PLACEHOLDER} | ||
| style={{ width: inputWidth }} | ||
| className="border-mint-01 text-d3 text-neutral-01 placeholder:text-neutral-07 rounded-2xl border px-4 py-2 text-center transition-[width] duration-150 ease-out outline-none" | ||
| /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default NameInput; | ||
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,102 @@ | ||
| "use client"; | ||
|
|
||
| import { useRouter } from "next/navigation"; | ||
|
|
||
| import { useState } from "react"; | ||
|
|
||
| import { FullButton } from "@/components/common/FullButton"; | ||
| import LoadingModal from "@/components/common/LoadingModal"; | ||
| import NameInput from "@/components/common/NameInput"; | ||
| import ProfileImagePicker from "@/components/onboarding/ProfileImagePicker"; | ||
| import UploadButton from "@/components/onboarding/UploadButton"; | ||
|
|
||
| import { useProfileImageUpload } from "@/hooks/useProfileImageUpload"; | ||
|
|
||
| const OnboardingProfileClient = () => { | ||
| const router = useRouter(); | ||
|
|
||
| const [name, setName] = useState(""); | ||
| const [isUploadOpen, setIsUploadOpen] = useState(false); | ||
|
|
||
| const isNameValid = name.trim().length > 0; | ||
|
|
||
| const { profileImage, isLoading, uploadImage, resetImage, cancelUpload } = | ||
| useProfileImageUpload(); | ||
idid10 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const handleCreateProfile = async () => { | ||
| if (!isNameValid) return; | ||
|
|
||
| // 1) 프로필 데이터 저장 (지금은 임시로 localStorage 예시) | ||
| const profile = { | ||
| name: name.trim(), | ||
| imageUrl: profileImage ?? null, | ||
| }; | ||
| try { | ||
| // TODO: 실제 API로 교체 | ||
| // await fetch("/api/profile", { method: "POST", body: JSON.stringify(profile) }); | ||
| localStorage.setItem("onboardingProfile", JSON.stringify(profile)); | ||
| } catch (e) { | ||
| // 에러 처리 | ||
| console.error(e); | ||
| return; | ||
| } | ||
| // 2) 저장이 끝난 뒤에만 페이지 이동 | ||
| router.replace("/login"); | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <main className="flex min-h-dvh justify-center"> | ||
| <div className="relative mt-[13px] flex h-full w-[440px] flex-col"> | ||
| <section className="mt-[123px] px-4 py-2.5"> | ||
| <p className="text-d2 text-neutral-02 whitespace-pre-line"> | ||
| 가족들에게 보여줄{"\n"}내 프로필을 만들어주세요 | ||
| </p> | ||
| </section> | ||
| <section className="mt-[86px] flex flex-col items-center"> | ||
| <ProfileImagePicker | ||
| imageUrl={profileImage} | ||
| onClick={() => setIsUploadOpen(true)} | ||
| /> | ||
| <div className="mt-4 w-full px-[118px]"> | ||
| <NameInput value={name} onChange={setName} /> | ||
| </div> | ||
| </section> | ||
idid10 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <section className="absolute right-0 bottom-[42px] left-0 px-4 py-2.5"> | ||
| <FullButton isActive={isNameValid} onClick={handleCreateProfile}> | ||
| 프로필생성하기 | ||
| </FullButton> | ||
idid10 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </section> | ||
| </div> | ||
| </main> | ||
| <UploadButton | ||
| isOpen={isUploadOpen} | ||
| onClose={() => setIsUploadOpen(false)} | ||
| onSelectAlbum={async file => { | ||
| try { | ||
| await uploadImage(file); | ||
| setIsUploadOpen(false); | ||
| } catch (error) { | ||
| console.error("이미지 업로드 실패:", error); | ||
| } | ||
| }} | ||
| onSelectDefault={() => { | ||
| resetImage(); | ||
| setIsUploadOpen(false); | ||
| }} | ||
| /> | ||
|
|
||
| <LoadingModal | ||
| isOpen={isLoading} | ||
| title="로딩중" | ||
| confirmLabel="취소하기" | ||
| isLoading | ||
| backdrop="blur" | ||
| onClose={cancelUpload} | ||
| /> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default OnboardingProfileClient; | ||
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.
browser라서 일단 funnel/next 코드 지워주세요오...!
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.
내가 지움Vv
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.
감사합니다