diff --git a/src/app/(board)/board/[boardId]/loading.tsx b/src/app/(board)/board/[boardId]/loading.tsx deleted file mode 100644 index 4595954..0000000 --- a/src/app/(board)/board/[boardId]/loading.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import Loader from '@/components/Loading' - -const Loading = () => { - return ( -
- -
- ) -} - -export default Loading diff --git a/src/app/(home)/_components/CreateBoardBtn.tsx b/src/app/(home)/_components/CreateBoardBtn.tsx index 04226dd..d40fe03 100644 --- a/src/app/(home)/_components/CreateBoardBtn.tsx +++ b/src/app/(home)/_components/CreateBoardBtn.tsx @@ -27,7 +27,7 @@ const CreateBoardBtn = () => { className="mb-3 shadow-[0px_0px_20px_0px_rgba(255,255,255,0.6)]" onClick={handleClick} > - 시작하기 + 보드 만들기 { />
- 지금 폴라보와 함께 추억을 담아보세요! + 지금 폴라보와 함께 추억을 공유해보세요!
diff --git a/src/app/(onboarding)/signup/_components/contexts/ProfileContext.tsx b/src/app/(onboarding)/signup/_components/contexts/ProfileContext.tsx index a427d3e..3433644 100644 --- a/src/app/(onboarding)/signup/_components/contexts/ProfileContext.tsx +++ b/src/app/(onboarding)/signup/_components/contexts/ProfileContext.tsx @@ -9,6 +9,7 @@ import { useContext, useMemo, useState, + useEffect, } from 'react' interface ProfileContextProps { @@ -16,8 +17,8 @@ interface ProfileContextProps { newBirthDt: UserProfile['birthDt'] newGender: UserProfile['gender'] setNewName: Dispatch> - setBirthDt: Dispatch> - setGender: Dispatch> + setNewBirthDt: Dispatch> + setNewGender: Dispatch> } const ProfileContext = createContext(undefined) @@ -28,11 +29,15 @@ export const ProfileProvider = ({ children: React.ReactNode }) => { const { data: session } = useSession() - const [newName, setNewName] = useState( - session?.profile.nickName ?? '', - ) - const [newBirthDt, setBirthDt] = useState(undefined) - const [newGender, setGender] = useState('NONE') + const [newName, setNewName] = useState('') + const [newBirthDt, setNewBirthDt] = + useState(undefined) + const [newGender, setNewGender] = useState('NONE') + + useEffect(() => { + setNewName(session?.profile.nickName ?? '') + setNewBirthDt(session?.profile.birthDt) + }, [session]) const value = useMemo( () => ({ @@ -40,8 +45,8 @@ export const ProfileProvider = ({ newBirthDt, newGender, setNewName, - setBirthDt, - setGender, + setNewBirthDt, + setNewGender, }), [newName, newBirthDt, newGender], ) diff --git a/src/app/(onboarding)/signup/_components/steps/BirthDtForm.tsx b/src/app/(onboarding)/signup/_components/steps/BirthDtForm.tsx index 881e1e0..25a70d2 100644 --- a/src/app/(onboarding)/signup/_components/steps/BirthDtForm.tsx +++ b/src/app/(onboarding)/signup/_components/steps/BirthDtForm.tsx @@ -12,18 +12,19 @@ const BirthDtForm = ({ }: { handleSubmit: (profile: UserProfile) => Promise }) => { - const { newName, newBirthDt, setBirthDt, newGender } = useProfile() + const { newName, newBirthDt, setNewBirthDt, newGender } = useProfile() const { nextStep } = useStep() const [hasError, setHasError] = useState(false) const [modalOpen, setModalOpen] = useState(false) const onSubmit = async () => { if (newBirthDt) { - if (validateBirthDt(newBirthDt) === false) { + if (!validateBirthDt(newBirthDt)) { setModalOpen(true) return } } + await handleSubmit({ nickName: newName, birthDt: newBirthDt, @@ -37,7 +38,7 @@ const BirthDtForm = ({
{newName} - {'님의 \n 생일을 입력해주세요!'} + {'님의\n생일을 입력해주세요!'}

추가 정보를 입력하시면 나에게 딱 맞는 보드 주제를 추천해드려요 :) @@ -45,7 +46,8 @@ const BirthDtForm = ({

diff --git a/src/app/(onboarding)/signup/_components/steps/NicknameForm.tsx b/src/app/(onboarding)/signup/_components/steps/NicknameForm.tsx index 105c85d..127fecf 100644 --- a/src/app/(onboarding)/signup/_components/steps/NicknameForm.tsx +++ b/src/app/(onboarding)/signup/_components/steps/NicknameForm.tsx @@ -14,14 +14,12 @@ const NicknameForm = ({ handleSubmit: (profile: UserProfile) => Promise }) => { const { newName, setNewName, newBirthDt, newGender } = useProfile() - const [nickname, setNickname] = useState('') const [hasError, setHasError] = useState(false) - const isEmpty = nickname.length === 0 + const isEmpty = newName.length === 0 const { nextStep } = useStep() const createNickname = async () => { - setNewName(nickname) await handleSubmit({ nickName: newName, birthDt: newBirthDt, @@ -37,8 +35,8 @@ const NicknameForm = ({
} /> diff --git a/src/app/(onboarding)/signup/page.tsx b/src/app/(onboarding)/signup/page.tsx index 335412c..b236852 100644 --- a/src/app/(onboarding)/signup/page.tsx +++ b/src/app/(onboarding)/signup/page.tsx @@ -8,7 +8,7 @@ const SignUpPage = async () => { const session = await auth() if (session && !session.newUser) { - redirect('/board/create') + redirect('/') } return (
diff --git a/src/app/mypage/boards/components/BoardEditPopup.tsx b/src/app/mypage/boards/_components/BoardList/BoardEditPopup.tsx similarity index 100% rename from src/app/mypage/boards/components/BoardEditPopup.tsx rename to src/app/mypage/boards/_components/BoardList/BoardEditPopup.tsx diff --git a/src/app/mypage/boards/components/BoardList/BoardItem.tsx b/src/app/mypage/boards/_components/BoardList/BoardItem.tsx similarity index 91% rename from src/app/mypage/boards/components/BoardList/BoardItem.tsx rename to src/app/mypage/boards/_components/BoardList/BoardItem.tsx index 7f2682e..f202702 100644 --- a/src/app/mypage/boards/components/BoardList/BoardItem.tsx +++ b/src/app/mypage/boards/_components/BoardList/BoardItem.tsx @@ -1,7 +1,7 @@ import EllipsisIcon from 'public/icons/ellipsis.svg' -import BoardEditPopup from '@/app/mypage/boards/components/BoardEditPopup' import React, { useState } from 'react' -import DeleteBoardModal from '@/app/mypage/boards/components/DeleteBoardModal' +import DeleteBoardModal from './DeleteBoardModal' +import BoardEditPopup from './BoardEditPopup' interface BoardListProps { title: string diff --git a/src/app/mypage/boards/components/BoardList/BoardPagination.tsx b/src/app/mypage/boards/_components/BoardList/BoardPagination.tsx similarity index 100% rename from src/app/mypage/boards/components/BoardList/BoardPagination.tsx rename to src/app/mypage/boards/_components/BoardList/BoardPagination.tsx diff --git a/src/app/mypage/boards/components/DeleteBoardModal.tsx b/src/app/mypage/boards/_components/BoardList/DeleteBoardModal.tsx similarity index 100% rename from src/app/mypage/boards/components/DeleteBoardModal.tsx rename to src/app/mypage/boards/_components/BoardList/DeleteBoardModal.tsx diff --git a/src/app/mypage/boards/components/BoardList/index.tsx b/src/app/mypage/boards/_components/BoardList/index.tsx similarity index 100% rename from src/app/mypage/boards/components/BoardList/index.tsx rename to src/app/mypage/boards/_components/BoardList/index.tsx diff --git a/src/app/mypage/boards/components/EmptyBoardList.tsx b/src/app/mypage/boards/_components/EmptyBoardList.tsx similarity index 100% rename from src/app/mypage/boards/components/EmptyBoardList.tsx rename to src/app/mypage/boards/_components/EmptyBoardList.tsx diff --git a/src/app/mypage/boards/page.tsx b/src/app/mypage/boards/page.tsx index 2080ad2..b030642 100644 --- a/src/app/mypage/boards/page.tsx +++ b/src/app/mypage/boards/page.tsx @@ -1,7 +1,7 @@ import Header from '@/components/Header' import { getMyBoards } from '@/lib/api/myBoard' -import EmptyBoardList from './components/EmptyBoardList' -import BoardList from './components/BoardList' +import EmptyBoardList from './_components/EmptyBoardList' +import BoardList from './_components/BoardList' const Page = async () => { const { pagination } = await getMyBoards() diff --git a/src/app/mypage/leave/page.tsx b/src/app/mypage/leave/page.tsx index e432829..1319881 100644 --- a/src/app/mypage/leave/page.tsx +++ b/src/app/mypage/leave/page.tsx @@ -6,7 +6,7 @@ const Page = () => { const leaveCheckTitle = '탈퇴전 꼭 확인해주세요.' const leaveReasonTitle = '탈퇴하려는 이유를 알려주세요.' const leaveDescription = - '계정을 삭제하면 복구가 불가능하며, 같은 계정으로\n재가입이 어려워요. 회원정보 및 보드가 모두\n삭제되며, 삭제된 데이터는 복구가 불가능해요.' + '계정을 삭제하면 복구가 불가능하며\n회원정보 및 보드가 모두 삭제돼요. \n또한, 삭제된 데이터는 복구가 불가능해요.' return (
diff --git a/src/app/mypage/profileEdit/_components/ProfileForm.tsx b/src/app/mypage/profileEdit/_components/ProfileForm.tsx index 626fb55..19c10b9 100644 --- a/src/app/mypage/profileEdit/_components/ProfileForm.tsx +++ b/src/app/mypage/profileEdit/_components/ProfileForm.tsx @@ -29,6 +29,14 @@ const ProfileForm = ({ children }: { children: ReactNode }) => { const [unChanged, setUnChanged] = useState(true) const [modalOpen, setModalOpen] = useState(false) + useEffect(() => { + if (session?.profile) { + setNewName(session?.profile.nickName) + setNewBirthDt(session?.profile.birthDt) + setNewGender(session?.profile.gender) + } + }, [session]) + useEffect(() => { if ( session?.profile.nickName === newName && @@ -86,6 +94,7 @@ const ProfileForm = ({ children }: { children: ReactNode }) => {
생년월일 > setHasError: Dispatch> className?: React.ComponentProps<'div'>['className'] } const BirthDateInput = ({ + value, setBirthDt, setHasError, className = '', @@ -26,16 +27,14 @@ const BirthDateInput = ({ const [month, setMonth] = useState('') const [day, setDay] = useState('') - const { data: session } = useSession() - useEffect(() => { - if (!session || !session.profile.birthDt) return + if (!value) return - const [y, m, d] = session.profile.birthDt.split('-') + const [y, m, d] = value.split('-') setYear(y) setMonth(m) setDay(d) - }, [session]) + }, [value]) useEffect(() => { if (!year && !month && !day) { @@ -51,23 +50,23 @@ const BirthDateInput = ({ }, [year, month, day]) const handleYearChange = (e: ChangeEvent) => { - const { value } = e.target - if (/^\d{0,4}$/.test(value)) { - setYear(value) + const { value: inputValue } = e.target + if (/^\d{0,4}$/.test(inputValue)) { + setYear(inputValue) } } const handleMonthChange = (e: ChangeEvent) => { - const { value } = e.target - if (/^\d{0,2}$/.test(value) && +value <= 12) { - setMonth(value) + const { value: inputValue } = e.target + if (/^\d{0,2}$/.test(inputValue) && +inputValue <= 12) { + setMonth(inputValue) } } const handleDayChange = (e: ChangeEvent) => { - const { value } = e.target - if (/^\d{0,2}$/.test(value) && +value <= 31) { - setDay(value) + const { value: inputValue } = e.target + if (/^\d{0,2}$/.test(inputValue) && +inputValue <= 31) { + setDay(inputValue) } } return ( diff --git a/src/components/TextInput/NicknameInput.tsx b/src/components/TextInput/NicknameInput.tsx index 0a002e5..5c041a9 100644 --- a/src/components/TextInput/NicknameInput.tsx +++ b/src/components/TextInput/NicknameInput.tsx @@ -8,7 +8,6 @@ import { useEffect, useState, } from 'react' -import { useSession } from 'next-auth/react' import TextInput from '.' const MAX_NICKNAME_LENGTH = 10 @@ -29,14 +28,6 @@ const NicknameInput = ({ }: NicknameInputProps) => { const [errorMessage, setErrorMessage] = useState('') - const { data: session } = useSession() - - useEffect(() => { - if (session) { - setValue(session.profile.nickName) - } - }, [session]) - useEffect(() => { setHasError(errorMessage.length > 0) }, [errorMessage]) diff --git a/src/lib/api/board.ts b/src/lib/api/board.ts index 357e916..fea9ed9 100644 --- a/src/lib/api/board.ts +++ b/src/lib/api/board.ts @@ -23,9 +23,7 @@ export const postBoard = async ( export const getTotalBoards = async (): Promise => { const res = await get('/api/v1/boards/total-count', { - next: { - revalidate: 60 * 60, // 1 hour - }, + cache: 'no-cache', }) return res.data