diff --git a/src/app/mypage/page.tsx b/src/app/mypage/page.tsx index e0e8b437..e80eeea3 100644 --- a/src/app/mypage/page.tsx +++ b/src/app/mypage/page.tsx @@ -1,13 +1,17 @@ import Header from '@/components/Common/Hedaer'; +import MypageContainer from '@/domain/mypage/container'; import MainLayout from '@/layouts/MainLayout'; -import MypageContainer from '@/container/mypaeg/container'; -export default function Mypage() { +import { getLoginUserCookiesData } from '@/utils/common/cookies'; + +export default async function Mypage() { + const { nickName } = await getLoginUserCookiesData(); + return ( <>
- + ); diff --git a/src/app/wishes/create/page.tsx b/src/app/wishes/create/page.tsx index 89ca3ca7..17c8fd23 100644 --- a/src/app/wishes/create/page.tsx +++ b/src/app/wishes/create/page.tsx @@ -50,7 +50,6 @@ export default async function WishesCreatePage({ <> 입금받을 계좌 입력하기 - {/* */} ), done: ( diff --git a/src/constant/snsList.ts b/src/constant/snsList.ts index acde0d06..55747355 100644 --- a/src/constant/snsList.ts +++ b/src/constant/snsList.ts @@ -1,26 +1,26 @@ import { SNSListType } from '@/types/snsListType'; import { - FacebookLogoImg, - InstaLogoImg, - KaKaoLogoImg, - TwitterLogoImg, + ShareFacebookLogoImg, + ShareInstaLogoImg, + ShareKaKaoLogoImg, + ShareTwitterLogoImg, } from '../../public/assets/images'; export const SNS_LIST: SNSListType[] = [ { name: 'KakaoTalk', - logo: KaKaoLogoImg, + logo: ShareKaKaoLogoImg, }, { name: 'Instagram', - logo: InstaLogoImg, + logo: ShareInstaLogoImg, }, { name: 'FaceBook', - logo: FacebookLogoImg, + logo: ShareFacebookLogoImg, }, { name: 'Twitter', - logo: TwitterLogoImg, + logo: ShareTwitterLogoImg, }, ]; diff --git a/src/container/mypaeg/container.tsx b/src/container/mypaeg/container.tsx deleted file mode 100644 index 3be8e229..00000000 --- a/src/container/mypaeg/container.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { MypageAuthButtons, MypageMenuButtons } from './client'; -import { MypageUserName } from './server'; - -export default function MypageContainer() { - return ( - <> - - - - - ); -} diff --git a/src/container/present/checkPresentItem.tsx b/src/container/present/checkPresentItem.tsx deleted file mode 100644 index 0204fdfb..00000000 --- a/src/container/present/checkPresentItem.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { presentListArray } from '@/constant/model/present'; -import { convertMoneyText } from '@/utils/common/convert'; - -export default function CheckPresentItem({ - giverName, - presentId, -}: { - giverName: string; - presentId: number; -}) { - return ( - <> -

- 주문 확인 내역 -

- - - {`${giverName}님\n${presentListArray[presentId].itemName} ${convertMoneyText( - presentListArray[presentId].price.toString(), - )}원을\n선물하시겠어요?`} - - - ); -} diff --git a/src/container/present/client.tsx b/src/container/present/client.tsx deleted file mode 100644 index ad3f286d..00000000 --- a/src/container/present/client.tsx +++ /dev/null @@ -1,135 +0,0 @@ -// 'use client'; - -// import { useForm } from 'react-hook-form'; -// import Button from '@/components/Common/Button'; -// import dynamic from 'next/dynamic'; -// import { ReactNode } from 'react'; -// import useToggle from '@/hooks/common/useToggle'; -// import { PresentStepType } from '@/app/present/[wishId]/page'; -// import { useRouter } from 'next/navigation'; -// import Image from 'next/image'; -// import { AccountCopyCakeImg } from '../../../public/assets/images'; -// import { presentDataResolver, PresentDataResolverType } from '@/validation/present.validate'; -// import { presentDataInputInit } from '@/constant/init'; -// import { yupResolver } from '@hookform/resolvers/yup'; -// import { postPublicCakes } from '@/api/public'; -// import PresentGiverInfoInputForm from './presentGiverInfoInputForm'; -// import SelectPayment from './selectPayment'; - -// const CheckPresentItem = dynamic(() => import('./checkPresentItem')); - -// export default function GivePresentPageStateContainer({ -// wishId, -// avatarCakeId, -// wantsGift, -// presentStep, -// presentId, -// children, -// account, -// }: { -// wishId: string; -// avatarCakeId: string; -// wantsGift: boolean; -// presentStep: PresentStepType; -// presentId: string; -// children: ReactNode; -// account: string; -// }) { -// const methods = useForm({ -// mode: 'onChange', -// defaultValues: { -// ...presentDataInputInit, -// cakeId: Number(avatarCakeId), -// }, -// resolver: yupResolver(presentDataResolver), -// }); - -// const isValid = methods.formState.isValid; - -// const router = useRouter(); - -// const { state: messageOnlyOption, changeState: changeMessageOnlyOption } = useToggle(); - -// function handleGivePresent() { -// if (!wantsGift || messageOnlyOption) { -// GivePresentMessageOnly(); -// return; -// } - -// handleNextToPaymentStep(); -// } - -// function GivePresentMessageOnly() { -// try { -// const data = methods.getValues(); -// postPublicCakes({ ...data, wishId: wishId }); -// } catch (error) {} -// } - -// function handleNextToPaymentStep() { -// const giftMenuId = methods.getValues('giftMenuId'); - -// router.push(`/present/${wishId}?presentStep=payment&presentId=${giftMenuId}`); -// } - -// async function handleAccountCopy() { -// try { -// await navigator.clipboard.writeText(account); -// alert('계좌번호가 복사됐어요!'); -// } catch (error) {} -// } - -// return ( -// <> -// {children} -// { -// { -// present: ( -// -// ), -// payment: ( -//
-// -// 계좌번호 복사하기 이미지 - -// -//
-// ), -// }[presentStep] -// } -// {presentStep === 'present' && ( -// -// )} - -// {presentStep === 'payment' && ( -// -// )} -// -// ); -// } - -// function PresentMessageButton({ -// handleClick, -// disabled, -// }: { -// handleClick: () => void; -// disabled: boolean; -// }) { -// return ( -// -// ); -// } diff --git a/src/container/present/container.tsx b/src/container/present/container.tsx deleted file mode 100644 index c0687067..00000000 --- a/src/container/present/container.tsx +++ /dev/null @@ -1,72 +0,0 @@ -// import { getPublicWishes } from '@/api/public'; -// import GivePresentPageStateContainer from './client'; -// import Box from '@/components/Common/Box'; -// import { colors } from '@/styles/styles'; -// import { UploadImageBox } from '@/components/UI/UploadImageBox'; -// import { PublicWishesDataType } from '@/types/api/response'; -// import { PresentStepType } from '@/app/present/[wishId]/page'; - -// export default async function GivePresentPageContainer({ -// wishId, -// avatarCakeId, -// presentId, -// presentStep, -// }: { -// wishId: string; -// avatarCakeId?: string; -// presentId?: string; -// presentStep: PresentStepType; -// }) { -// const publicWishesData = await getPublicWishes(wishId); - -// const account = `${publicWishesData.accountNumber} ${publicWishesData.bank}`; - -// return ( -// -// {presentStep === 'present' && } -// -// ); -// } - -// function MessageFromWisheMaker({ publicWishesData }: { publicWishesData: PublicWishesDataType }) { -// return ( -// <> -//
-//

-// {publicWishesData?.title} -//

- -// -// {`D-${publicWishesData?.dayCount}`} -// -//
- -// {/* 이미지값 넣어줘야해요! */} -//
-// -//
- -// -// {publicWishesData?.hint} -// -// -// ); -// } diff --git a/src/container/present/presentGiverInfoInputForm.tsx b/src/container/present/presentGiverInfoInputForm.tsx deleted file mode 100644 index 5faf51ba..00000000 --- a/src/container/present/presentGiverInfoInputForm.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import Box from '@/components/Common/Box'; -import InputText from '@/components/Common/Input/inputText'; -import CheckBox from '@/components/UI/CheckBox'; -import InputForm from '@/components/UI/InputForm'; -import InputTextForm from '@/components/UI/InputTextForm'; -import PresentList from '@/components/UI/PresentList'; -import { MAX_TEXTAREA_LENGTH } from '@/constant/input'; -import { PresentDataResolverType } from '@/validation/present.validate'; -import { UseFormReturn } from 'react-hook-form'; - -export default function PresentGiverInfoInputForm({ - methods, - wantsGift, - messageOnlyOption, - changeMessageOnlyOption, -}: { - methods: UseFormReturn; - wantsGift?: boolean; - messageOnlyOption: boolean; - changeMessageOnlyOption: (state: boolean) => void; -}) { - function changeGiftMenutId(id: number) { - methods.setValue('giftMenuId', id); - } - - function changeCheckedState(state: boolean) { - changeMessageOnlyOption(state); - } - - return ( - <> - - - - - {!wantsGift && ( - - {!messageOnlyOption && } - - - checkBoxText="편지만 보낼게요" - changeCheckedState={changeCheckedState} - /> - - - )} - - - - - - ); -} diff --git a/src/container/present/server.tsx b/src/container/present/server.tsx deleted file mode 100644 index 454c8beb..00000000 --- a/src/container/present/server.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import Box from '@/components/Common/Box'; -import { colors } from '@/styles/styles'; -import { UploadImageBox } from '@/components/UI/UploadImageBox'; - -export function MessageFromWisheMaker() { - return ( - <> -
-

- {/* {publicWishesData?.title} */} -

- - - {/* {`D-${publicWishesData?.dayCount}`} */} - -
- - - {/* {publicWishesData?.hint} */} - - - {/* 이미지값 넣어줘야해요! */} -
- -
- - ); -} diff --git a/src/container/mypaeg/server.tsx b/src/domain/mypage/component.tsx similarity index 72% rename from src/container/mypaeg/server.tsx rename to src/domain/mypage/component.tsx index f7bccc01..355493ef 100644 --- a/src/container/mypaeg/server.tsx +++ b/src/domain/mypage/component.tsx @@ -1,10 +1,7 @@ import Image from 'next/image'; import { MypageDefaultCakeImg } from '../../../public/assets/images'; -import { getLoginUserCookiesData } from '@/utils/common/cookies'; - -export async function MypageUserName() { - const { nickName } = await getLoginUserCookiesData(); +export function MypageUserName({ nickName }: { nickName: string }) { return (
+ + + + + ); +} + +function MypageMenuButtons() { const test = () => {}; - const router = useRouter(); + + const { handleRouter } = useRouters(); return (
    { - router.push('/mypage/wishes/edit'); + handleRouter('/mypage/wishes/edit'); }} >
  • 로그아웃
  • diff --git a/src/domain/mypage/service.tsx b/src/domain/mypage/service.tsx new file mode 100644 index 00000000..e69de29b diff --git a/src/container/mypaeg/wishes/edit/container.tsx b/src/domain/mypage/wishes/edit/container.tsx similarity index 100% rename from src/container/mypaeg/wishes/edit/container.tsx rename to src/domain/mypage/wishes/edit/container.tsx diff --git a/src/domain/present/[wishId]/component.tsx b/src/domain/present/[wishId]/component.tsx index a63c3e4b..71bc8d9e 100644 --- a/src/domain/present/[wishId]/component.tsx +++ b/src/domain/present/[wishId]/component.tsx @@ -2,9 +2,33 @@ import Box from '@/components/Common/Box'; import Button from '@/components/Common/Button'; import { FixedBottomButtonWrapper } from '@/components/Common/Button/FixedBottomButton'; import { UploadImageBox } from '@/components/UI/UploadImageBox'; +import { presentListArray } from '@/constant/model/present'; import { useRouters } from '@/hooks/common/useRouters'; import { colors } from '@/styles/styles'; import { PublicWishesDataType } from '@/types/api/response'; +import { convertMoneyText } from '@/utils/common/convert'; + +export function CheckPresentItem({ + giverName, + presentId, +}: { + giverName: string; + presentId: number; +}) { + return ( + <> +

    + 주문 확인 내역 +

    + + + {`${giverName}님\n${presentListArray[presentId].itemName} ${convertMoneyText( + presentListArray[presentId].price.toString(), + )}원을\n선물하시겠어요?`} + + + ); +} export function MessageBox({ message }: { message: string }) { return ( diff --git a/src/domain/present/[wishId]/payment.tsx b/src/domain/present/[wishId]/payment.tsx index d455bf26..196b06ed 100644 --- a/src/domain/present/[wishId]/payment.tsx +++ b/src/domain/present/[wishId]/payment.tsx @@ -1,11 +1,11 @@ 'use client'; -import CheckPresentItem from '@/container/present/checkPresentItem'; import { PresentDataResolverType } from '@/validation/present.validate'; import Image from 'next/image'; import { useFormContext } from 'react-hook-form'; import { AccountCopyCakeImg } from '../../../../public/assets/images'; -import SelectPayment from '@/container/present/selectPayment'; +import SelectPayment from './selectPayment'; +import { CheckPresentItem } from './component'; export default function Payment({ account }: { account: string }) { const { watch } = useFormContext(); diff --git a/src/domain/present/[wishId]/presentGiverInfoInputForm.tsx b/src/domain/present/[wishId]/presentGiverInfoInputForm.tsx index 2d4b11bf..974d2144 100644 --- a/src/domain/present/[wishId]/presentGiverInfoInputForm.tsx +++ b/src/domain/present/[wishId]/presentGiverInfoInputForm.tsx @@ -4,7 +4,7 @@ import InputTextForm from '@/components/UI/InputTextForm'; import { MAX_TEXTAREA_LENGTH } from '@/constant/input'; import { PresentDataResolverType } from '@/validation/present.validate'; import { PropsWithChildren } from 'react'; -import { useFormContext, UseFormReturn } from 'react-hook-form'; +import { useFormContext } from 'react-hook-form'; export default function PresentGiverInfoInputForm({ children }: PropsWithChildren) { const { register, control } = useFormContext(); diff --git a/src/container/present/selectPayment.tsx b/src/domain/present/[wishId]/selectPayment.tsx similarity index 100% rename from src/container/present/selectPayment.tsx rename to src/domain/present/[wishId]/selectPayment.tsx diff --git a/src/hooks/common/useRouters.tsx b/src/hooks/common/useRouters.tsx index 339d7c09..6822c4a5 100644 --- a/src/hooks/common/useRouters.tsx +++ b/src/hooks/common/useRouters.tsx @@ -7,6 +7,7 @@ export type RouterPathsType = | '/wishes' | `/wishes/${string}` | '/mypage' + | `/mypage/${string}` | '/present' | `/present/${string}`;