From e4720ba32f252be648d0bddea2a92f03300626c9 Mon Sep 17 00:00:00 2001 From: myeongheonhong Date: Thu, 21 Dec 2023 17:20:49 +0900 Subject: [PATCH 1/7] =?UTF-8?q?[=20refactor=20]=20API=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EB=A6=AC=EC=95=A1=ED=8A=B8=EC=BF=BC=EB=A6=AC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/auth.ts | 17 ++ api/cakes.ts | 35 ++++ api/cakes/cakesAPI.ts | 53 ------ api/common/axios.ts | 1 - api/file.ts | 25 +++ api/letters/getCakeLetters.ts | 20 -- api/letters/getCakesCount.ts | 16 -- api/links/deleteWishLinks.ts | 20 -- api/links/getOneWish.ts | 17 -- api/links/getWishLinks.ts | 17 -- api/login/sendCodeToServer.ts | 19 -- api/main/getProgressData.ts | 17 -- api/mypage/mypageAPI.ts | 45 ----- api/path.ts | 40 ++++ api/user.ts | 54 ++++++ api/wishes.ts | 174 ++++++++++++++++++ api/wishes/wishesAPI.ts | 122 ------------ hooks/{ => common}/useDate.ts | 0 hooks/{ => common}/useKakaoShare.ts | 0 .../{login/useAuthKakao.ts => auth.ts} | 6 +- hooks/queries/cakes.ts | 53 ++++++ hooks/queries/cakes/useRequestPayReady.ts | 11 -- hooks/queries/letters/useGetCakeLetters.ts | 24 --- hooks/queries/letters/useGetCakesCount.ts | 33 ---- hooks/queries/links/useDeleteWishLinks.ts | 8 - hooks/queries/links/useGetOneWish.ts | 23 --- hooks/queries/links/useGetWishLinks.ts | 27 --- hooks/queries/main/useGetProgressData.ts | 26 --- hooks/queries/mypage/useEditWishesInfo.tsx | 16 -- hooks/queries/user.ts | 22 +++ hooks/queries/wishes.ts | 127 +++++++++++++ hooks/queries/wishes/useCreateWishesLink.ts | 21 --- hooks/queries/wishes/useGetItemInfo.ts | 29 --- .../api/request.ts | 0 types/api/response.ts | 18 ++ types/mypage/editWishesInfoDataType.ts | 13 -- types/wishesType.ts | 33 ++++ utils/common/token.ts | 6 + 38 files changed, 607 insertions(+), 581 deletions(-) create mode 100644 api/auth.ts create mode 100644 api/cakes.ts delete mode 100644 api/cakes/cakesAPI.ts create mode 100644 api/file.ts delete mode 100644 api/letters/getCakeLetters.ts delete mode 100644 api/letters/getCakesCount.ts delete mode 100644 api/links/deleteWishLinks.ts delete mode 100644 api/links/getOneWish.ts delete mode 100644 api/links/getWishLinks.ts delete mode 100644 api/login/sendCodeToServer.ts delete mode 100644 api/main/getProgressData.ts delete mode 100644 api/mypage/mypageAPI.ts create mode 100644 api/path.ts create mode 100644 api/user.ts create mode 100644 api/wishes.ts delete mode 100644 api/wishes/wishesAPI.ts rename hooks/{ => common}/useDate.ts (100%) rename hooks/{ => common}/useKakaoShare.ts (100%) rename hooks/queries/{login/useAuthKakao.ts => auth.ts} (86%) create mode 100644 hooks/queries/cakes.ts delete mode 100644 hooks/queries/cakes/useRequestPayReady.ts delete mode 100644 hooks/queries/letters/useGetCakeLetters.ts delete mode 100644 hooks/queries/letters/useGetCakesCount.ts delete mode 100644 hooks/queries/links/useDeleteWishLinks.ts delete mode 100644 hooks/queries/links/useGetOneWish.ts delete mode 100644 hooks/queries/links/useGetWishLinks.ts delete mode 100644 hooks/queries/main/useGetProgressData.ts delete mode 100644 hooks/queries/mypage/useEditWishesInfo.tsx create mode 100644 hooks/queries/user.ts create mode 100644 hooks/queries/wishes.ts delete mode 100644 hooks/queries/wishes/useCreateWishesLink.ts delete mode 100644 hooks/queries/wishes/useGetItemInfo.ts rename hooks/queries/wishes/useGetUserAccount.tsx => types/api/request.ts (100%) create mode 100644 types/api/response.ts delete mode 100644 types/mypage/editWishesInfoDataType.ts create mode 100644 types/wishesType.ts create mode 100644 utils/common/token.ts diff --git a/api/auth.ts b/api/auth.ts new file mode 100644 index 00000000..99107af8 --- /dev/null +++ b/api/auth.ts @@ -0,0 +1,17 @@ +import { API_VERSION_01, PATH_AUTH } from './path'; +import { client } from './common/axios'; + +export const postAuthKakao = async (code: string) => { + const data = await client.post( + `${API_VERSION_01}${PATH_AUTH.KAKAO}?redirectUri=${process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URI}`, + {}, + { + headers: { + 'Content-Type': 'application/json', + code: `${code}`, + }, + }, + ); + + return data.data.data; +}; diff --git a/api/cakes.ts b/api/cakes.ts new file mode 100644 index 00000000..0aef6936 --- /dev/null +++ b/api/cakes.ts @@ -0,0 +1,35 @@ +import { getAccessToken } from '@/utils/common/token'; +import { client } from './common/axios'; +import { API_VERSION_01, PATH_CAKES } from './path'; + +const ACCESS_TOKEN = getAccessToken(); + +/** + * 해당 소원에 대한 케이크 조회 + */ +export const getCakesInfo = async ( + wishId: string | string[] | undefined, + cakeId: string | string[] | undefined, +) => { + const data = await client.get(`${API_VERSION_01}${PATH_CAKES.GET_CAKES_INFO(wishId, cakeId)}`, { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }); + + return data.data.data; +}; + +/** + * 해당 소원에 대한 모든 케이크 리스트 결과 조회 + */ +export const getCakesResult = async (wishId: string | string[] | undefined) => { + const data = await client.get(`${API_VERSION_01}${PATH_CAKES.GET_CAKES_RESULT(wishId)}`, { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }); + return data.data.data; +}; diff --git a/api/cakes/cakesAPI.ts b/api/cakes/cakesAPI.ts deleted file mode 100644 index aa85129a..00000000 --- a/api/cakes/cakesAPI.ts +++ /dev/null @@ -1,53 +0,0 @@ -import PATH from '../../constant/path'; -import { client } from '../common/axios'; -import { CakesDataType } from '@/types/cakes/cakesDataType'; - -export const getWishesData = async () => { - const pathname = window.location.pathname.replace('/cakes/', ''); - const wishesNumber = pathname.replace('/wishes/', ''); - - const data = await client.get( - `${PATH.API}/${PATH.V1}/${PATH.PUBLIC}/${PATH.WISHES}/${wishesNumber}`, - ); - return data.data.data; -}; - -export const requestPayApprove = async (cakesData: CakesDataType | undefined) => { - const data = await client.post( - `${PATH.API}/${PATH.V1}/${PATH.PUBLIC}/${PATH.PAY}/${PATH.APPROVE}`, - { - pgToken: cakesData?.pgToken, - tid: cakesData?.tid, - partnerOrderId: process.env.NEXT_PUBLIC_ORDER_ID, - partnerUserId: process.env.NEXT_PUBLIC_USER_ID, - name: cakesData?.giverName, - cakeId: cakesData?.selectedCake.cakeNumber, - message: cakesData?.message, - wishId: cakesData?.wishId, - }, - { - headers: {}, - }, - ); - - return data.data.data; -}; - -export const requestPayReady = async (wishId: number, cakeNumber: number) => { - return await client.post( - `${PATH.API}/${PATH.V1}/${PATH.PUBLIC}/${PATH.PAY}/${PATH.READY}`, - { - partnerOrderId: process.env.NEXT_PUBLIC_ORDER_ID, - partnerUserId: process.env.NEXT_PUBLIC_USER_ID, - cake: cakeNumber, - taxFreeAmount: '200', - vatAmount: '1', - approvalUrl: `${process.env.NEXT_PUBLIC_KAKAOPAY_REDIRECT_URI}`, - cancelUrl: `https://sunmulzu.store/cakes/${wishId}`, - failUrl: `https://sunmulzu.store/cakes/${wishId}`, - }, - { - headers: {}, - }, - ); -}; diff --git a/api/common/axios.ts b/api/common/axios.ts index 30fbc359..594e4019 100644 --- a/api/common/axios.ts +++ b/api/common/axios.ts @@ -1,4 +1,3 @@ -import PATH from '@/constant/path'; import axios from 'axios'; //서버통신 함수 diff --git a/api/file.ts b/api/file.ts new file mode 100644 index 00000000..f326622a --- /dev/null +++ b/api/file.ts @@ -0,0 +1,25 @@ +import axios from 'axios'; +import { client } from './common/axios'; +import { API_VERSION_01 } from './path'; +import { getAccessToken } from '@/utils/common/token'; + +export const uploadPresignedURL = async (signedURL: string, file: File | Blob | null) => { + const data = await axios.put(signedURL, file, { + headers: { + 'Content-Type': file?.type, + }, + }); + + return data; +}; + +export const getPresignedURL = async (fileName: string | undefined) => { + const data = await client.get(`${API_VERSION_01}/file?fileName=${fileName}`, { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${getAccessToken()}`, + }, + }); + + return data; +}; diff --git a/api/letters/getCakeLetters.ts b/api/letters/getCakeLetters.ts deleted file mode 100644 index 1a5ebf0d..00000000 --- a/api/letters/getCakeLetters.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { client } from '@/api/common/axios'; -import PATH from '@/constant/path'; - -export const getCakesLetters = async ( - wishId: string | string[] | undefined, - cakeId: string | string[] | undefined, -) => { - const accessToken = localStorage.getItem('accessToken'); - - const url = `${PATH.API}/${PATH.V1}/${PATH.CAKES}/${wishId}/${cakeId}`; - - const data = await client.get(url, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }); - - return data.data.data; -}; diff --git a/api/letters/getCakesCount.ts b/api/letters/getCakesCount.ts deleted file mode 100644 index a3dcbc02..00000000 --- a/api/letters/getCakesCount.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { client } from '@/api/common/axios'; -import PATH from '@/constant/path'; - -export const getCakesCount = async (wishId: string | string[] | undefined) => { - const accessToken = localStorage.getItem('accessToken'); - - const url = `${PATH.API}/${PATH.V1}/${PATH.CAKES}/${wishId}`; - - const data = await client.get(url, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }); - return data.data.data; -}; diff --git a/api/links/deleteWishLinks.ts b/api/links/deleteWishLinks.ts deleted file mode 100644 index 7725bb3c..00000000 --- a/api/links/deleteWishLinks.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { client } from '@/api/common/axios'; -import PATH from '@/constant/path'; - -export const deleteWishLinks = async (wishesData: number[]) => { - const accessToken = localStorage.getItem('accessToken'); - - const url = `${PATH.API}/${PATH.V1}/${PATH.WISHES}`; - - const data = await client.delete(url, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - data: { - wishes: wishesData, - }, - }); - - return data; -}; diff --git a/api/links/getOneWish.ts b/api/links/getOneWish.ts deleted file mode 100644 index c5598ad9..00000000 --- a/api/links/getOneWish.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { client } from '@/api/common/axios'; -import PATH from '@/constant/path'; - -export const getOneWish = async (wishId: string | string[] | undefined) => { - const accessToken = localStorage.getItem('accessToken'); - - const url = `${PATH.API}/${PATH.V1}/${PATH.WISHES}/${wishId}`; - - const data = await client.get(url, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }); - - return data.data.data; -}; diff --git a/api/links/getWishLinks.ts b/api/links/getWishLinks.ts deleted file mode 100644 index 356bd3cc..00000000 --- a/api/links/getWishLinks.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { client } from '@/api/common/axios'; -import PATH from '@/constant/path'; - -export const getWishLinks = async () => { - const accessToken = localStorage.getItem('accessToken'); - - const url = `${PATH.API}/${PATH.V1}/${PATH.WISHES}`; - - const data = await client.get(url, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }); - - return data.data.data.wishes; -}; diff --git a/api/login/sendCodeToServer.ts b/api/login/sendCodeToServer.ts deleted file mode 100644 index eeae44c4..00000000 --- a/api/login/sendCodeToServer.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { client } from '@/api/common/axios'; -import PATH from '../../constant/path'; - -export const sendCodeToServer = async (code: string) => { - const url = `${PATH.API}/${PATH.V1}/${PATH.AUTH}/${PATH.KAKAO}/${PATH.CALLBACK}?${PATH.REDIRECT_URI}=${process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URI}`; - - const data = await client.post( - url, - {}, - { - headers: { - 'Content-Type': 'application/json', - code: `${code}`, - }, - }, - ); - - return data.data.data; -}; diff --git a/api/main/getProgressData.ts b/api/main/getProgressData.ts deleted file mode 100644 index b0054204..00000000 --- a/api/main/getProgressData.ts +++ /dev/null @@ -1,17 +0,0 @@ -import PATH from '../../constant/path'; -import { client } from '../common/axios'; - -export const getProgressData = async () => { - const accessToken = localStorage.getItem('accessToken'); - - const url = `${PATH.API}/${PATH.V1}/${PATH.WISHES}/${PATH.MAIN}`; - - const data = await client.get(url, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }); - - return data.data.data; -}; diff --git a/api/mypage/mypageAPI.ts b/api/mypage/mypageAPI.ts deleted file mode 100644 index ce121fe7..00000000 --- a/api/mypage/mypageAPI.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { client } from '../common/axios'; -import PATH from '../../constant/path'; -import { EditWishesInfoDataType } from '@/types/mypage/editWishesInfoDataType'; - -export const getEditWishesInfo = async () => { - const accessToken = localStorage.getItem('accessToken'); - - const data = await client.get(`${PATH.API}/${PATH.V1}/${PATH.WISHES}/${PATH.PROGRESS}`, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }); - - return data.data.data; -}; - -export const editWishesInfo = async (editWishesInfoData: EditWishesInfoDataType) => { - const accessToken = localStorage.getItem('accessToken'); - - const data = await client.put( - `${PATH.API}/${PATH.V1}/${PATH.WISHES}/${PATH.PROGRESS}`, - editWishesInfoData, - { - headers: { - Authorization: `Bearer ${accessToken}`, - }, - }, - ); - - return data.data.data; -}; - -export const deleteUserInfo = async () => { - const accessToken = localStorage.getItem('accessToken'); - - const data = await client.delete(`${PATH.API}/${PATH.V1}/${PATH.USER}`, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }); - - return data; -}; diff --git a/api/path.ts b/api/path.ts new file mode 100644 index 00000000..f97855bf --- /dev/null +++ b/api/path.ts @@ -0,0 +1,40 @@ +export const API_VERSION_01 = '/api/v1'; + +const PATH = { + auth: '/auth', + user: '/user', + wishes: '/wishes', + public: '/public', + cakes: '/cakes', +}; + +export const PATH_AUTH = { + TOKEN: `${PATH.auth}/token`, + KAKAO: `${PATH.auth}/kakao/callback`, +}; + +export const PATH_USER = { + DEFAULT: PATH.user, + ACCOUNT: `${PATH.user}/account`, + ACCOUNT_VERIFY: `${PATH.user}/verify-account`, + ABUSE: `${PATH.user}/abuse`, +}; + +export const PATH_WISHES = { + DEFAULT: PATH.wishes, + PROGRESS: `${PATH.wishes}/progress`, + GET_SINGLE_WISH_INFO: (wishId: string | string[] | undefined) => `${PATH.wishes}/${wishId}`, + PRESENT_LINK_INFO: `${PATH.wishes}/present/info`, + MAIN: `${PATH.wishes}/main`, +}; + +export const PATH_PUBLIC = { + CAKES: `${PATH.public}/cakes`, + GET_INFO: (wishId: number) => `${PATH.public}${PATH.wishes}/${wishId}`, +}; + +export const PATH_CAKES = { + GET_CAKES_RESULT: (wishId: string | string[] | undefined) => `${PATH.cakes}/${wishId}`, + GET_CAKES_INFO: (wishId: string | string[] | undefined, cakeId: string | string[] | undefined) => + `${PATH.cakes}/${wishId}/${cakeId}`, +}; diff --git a/api/user.ts b/api/user.ts new file mode 100644 index 00000000..cde5ecbb --- /dev/null +++ b/api/user.ts @@ -0,0 +1,54 @@ +import { getAccessToken } from '@/utils/common/token'; +import { client } from './common/axios'; +import { API_VERSION_01, PATH_USER } from './path'; +import { UseFormReturn } from 'react-hook-form'; +import { WishesDataInputType } from '@/types/common/input/wishesInput'; +import { UserAccountDataResponseType } from '@/types/api/response'; + +const ACCESS_TOKEN = getAccessToken(); + +export const patchUserAccount = async ( + methods: UseFormReturn, +) => { + const data = await client.put( + `${API_VERSION_01}${PATH_USER.ACCOUNT}`, + { + accountInfo: { + name: methods.getValues('name'), + bank: methods.getValues('bank'), + account: methods.getValues('account'), + }, + }, + { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }, + ); + return data; +}; + +export const getUserAccount = async () => { + const data = await client.get( + `${API_VERSION_01}${PATH_USER.ACCOUNT}`, + { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }, + ); + return data?.data.data; +}; + +export const deleteUserInfo = async () => { + const data = await client.delete(`${API_VERSION_01}${PATH_USER.DEFAULT}`, { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }); + + return data; +}; diff --git a/api/wishes.ts b/api/wishes.ts new file mode 100644 index 00000000..64c53e12 --- /dev/null +++ b/api/wishes.ts @@ -0,0 +1,174 @@ +import { MainProgressDataResponseType, WishesProgressDataResponseType } from '@/types/api/response'; +import { client } from './common/axios'; +import { getAccessToken } from '@/utils/common/token'; +import { API_VERSION_01, PATH_WISHES } from './path'; +import { WishesDataInputType } from '@/types/common/input/wishesInput'; +import { UseFormReturn } from 'react-hook-form'; +import { SiteDataType } from '@/types/siteDataType'; + +const ACCESS_TOKEN = getAccessToken(); + +/** + * 진행중인 소원 조회 + */ +export const getMainProgressData = async () => { + const data = await client.get( + `${API_VERSION_01}${PATH_WISHES.MAIN}`, + { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }, + ); + + return data.data.data; +}; + +/** + * 모든 소원리스트 조회 + */ +export const getWishes = async () => { + const data = await client.get(`${API_VERSION_01}${PATH_WISHES.DEFAULT}`, { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }); + + return data.data.data.wishes; +}; + +/** + * 소원링크 생성 + */ +export const postWishes = async (methods: UseFormReturn) => { + const data = await client.post( + `${API_VERSION_01}${PATH_WISHES.DEFAULT}`, + { + imageUrl: methods.getValues('imageUrl'), + price: methods.getValues('price'), + title: methods.getValues('title'), + hint: methods.getValues('hint'), + initial: methods.getValues('initial'), + startDate: methods.getValues('startDate'), + endDate: methods.getValues('endDate'), + }, + { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }, + ); + return data; +}; + +/** + * 소원링크 삭제 + */ +export const deleteWishes = async (wishesData: number[]) => { + const data = await client.delete(`${API_VERSION_01}${PATH_WISHES.DEFAULT}`, { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + data: { + wishes: wishesData, + }, + }); + + return data; +}; + +/** + * 29cm에서 파싱한 데이터 + */ +export const getPresentLinkInfo = async (link: string, siteData: SiteDataType | undefined) => { + const imageTag = + siteData && + (await client.get( + `${API_VERSION_01}${PATH_WISHES.PRESENT_LINK_INFO}?url=${link}&tag=${siteData.IMAGE_TAG}`, + { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }, + )); + + const priceTag = + siteData && + (await client.get( + `${API_VERSION_01}${PATH_WISHES.PRESENT_LINK_INFO}?url=${link}&tag=${siteData.PRICE_TAG}`, + { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }, + )); + return { imageTag, priceTag }; +}; + +/** + * 진행중인 소원 정보 조회 + */ +export const getProgressWishInfo = async () => { + const data = await client.get( + `${API_VERSION_01}${PATH_WISHES.PROGRESS}`, + { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }, + ); + + return data.data.data; +}; + +/** + * 진행중인 소원 정보 수정 + */ +export const patchProgressWishInfo = async ( + methods: UseFormReturn, +) => { + const data = await client.put( + `${API_VERSION_01}${PATH_WISHES.PROGRESS}`, + { + title: methods.getValues('title'), + hint: methods.getValues('hint'), + initial: methods.getValues('initial'), + imageUrl: methods.getValues('imageUrl'), + phone: methods.getValues('phone'), + account: methods.getValues('account'), + bank: methods.getValues('bank'), + name: methods.getValues('name'), + startDate: methods.getValues('startDate'), + endDate: methods.getValues('endDate'), + }, + { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }, + ); + + return data.data.data; +}; + +/** + * 소원 단건 조회 + */ +export const getSingleWishInfo = async (wishId: string | string[] | undefined) => { + const data = await client.get(`${API_VERSION_01}${PATH_WISHES.GET_SINGLE_WISH_INFO(wishId)}`, { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${ACCESS_TOKEN}`, + }, + }); + + return data.data.data; +}; diff --git a/api/wishes/wishesAPI.ts b/api/wishes/wishesAPI.ts deleted file mode 100644 index a397291d..00000000 --- a/api/wishes/wishesAPI.ts +++ /dev/null @@ -1,122 +0,0 @@ -import PATH from '../../constant/path'; -import { client } from '../common/axios'; -import axios from 'axios'; -import { SiteDataType } from '@/types/siteDataType'; -import { - AccountInfoType, - BankInfoInputsType, - WishesDataInputType, -} from '@/types/common/input/wishesInput'; -import { UseFormReturn } from 'react-hook-form'; - -const ACCESS_TOKEN = localStorage.getItem('accessToken'); - -export const createWishesLink = async (wishesData: WishesDataInputType) => { - const data = await client.post( - `${PATH.API}/${PATH.V1}/${PATH.WISHES}`, - { - imageUrl: wishesData.imageURL, - price: wishesData.price, - title: wishesData.title, - hint: wishesData.hint, - initial: wishesData.initial, - startDate: wishesData.startDate, - endDate: wishesData.endDate, - }, - { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${ACCESS_TOKEN}`, - }, - }, - ); - return data; -}; - -export const editUserAccount = async ( - methods: UseFormReturn, -) => { - const data = await client.put( - `${PATH.API}/${PATH.V1}/${PATH.USER}/${PATH.ACCOUNT}`, - { - accountInfo: { - name: methods.getValues('name'), - bank: methods.getValues('bankName'), - account: methods.getValues('account'), - }, - }, - { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${ACCESS_TOKEN}`, - }, - }, - ); - return data; -}; - -export const getItemInfo = async (link: string, siteData: SiteDataType | undefined) => { - const accessToken = localStorage.getItem('accessToken'); - - const imageTag = - siteData && - (await client.get( - `${PATH.API}/${PATH.V1}/${PATH.WISHES}/${PATH.PRESENT}/${PATH.INFO}?url=${link}&tag=${siteData.IMAGE_TAG}`, - { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }, - )); - - const priceTag = - siteData && - (await client.get( - `${PATH.API}/${PATH.V1}/${PATH.WISHES}/${PATH.PRESENT}/${PATH.INFO}?url=${link}&tag=${siteData.PRICE_TAG}`, - { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }, - )); - return { imageTag, priceTag }; -}; - -export const getUserAccount = async () => { - const accessToken = localStorage.getItem('accessToken'); - - const data = await client.get(`${PATH.API}/${PATH.V1}/${PATH.USER}/${PATH.ACCOUNT}`, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }); - return data?.data; -}; - -export const getPresignedURL = async (fileName: string | undefined) => { - const accessToken = localStorage.getItem('accessToken'); - const data = await client.get( - `${PATH.API}/${PATH.V1}/${PATH.FILE}?${PATH.FILE_NAME}=${fileName}`, - { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken}`, - }, - }, - ); - - return data; -}; - -export const uploadPresignedURL = async (signedURL: string, file: File | Blob | null) => { - const data = await axios.put(signedURL, file, { - headers: { - 'Content-Type': file?.type, - }, - }); - - return data; -}; diff --git a/hooks/useDate.ts b/hooks/common/useDate.ts similarity index 100% rename from hooks/useDate.ts rename to hooks/common/useDate.ts diff --git a/hooks/useKakaoShare.ts b/hooks/common/useKakaoShare.ts similarity index 100% rename from hooks/useKakaoShare.ts rename to hooks/common/useKakaoShare.ts diff --git a/hooks/queries/login/useAuthKakao.ts b/hooks/queries/auth.ts similarity index 86% rename from hooks/queries/login/useAuthKakao.ts rename to hooks/queries/auth.ts index cefd2069..0425339d 100644 --- a/hooks/queries/login/useAuthKakao.ts +++ b/hooks/queries/auth.ts @@ -1,11 +1,11 @@ import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; -import { sendCodeToServer } from '@/api/login/sendCodeToServer'; import { useMutation } from 'react-query'; import { useSetRecoilState } from 'recoil'; import { LoginUserInfo } from '@/recoil/auth/loginUserInfo'; +import { postAuthKakao } from '@/api/auth'; -export default function useAuthKakao() { +export function useAuthKakao() { const [accessToken, setAccessToken] = useState(''); const [refreshToken, setRefreshToken] = useState(''); const [nickName, setNickname] = useState(''); @@ -15,7 +15,7 @@ export default function useAuthKakao() { const router = useRouter(); const { code: authCode } = router.query; - const { mutate: kakaoLoginMutate } = useMutation(() => sendCodeToServer(authCode as string), { + const { mutate: kakaoLoginMutate } = useMutation(() => postAuthKakao(authCode as string), { onSuccess: (data) => { const { nickName, accessToken, refreshToken } = data; diff --git a/hooks/queries/cakes.ts b/hooks/queries/cakes.ts new file mode 100644 index 00000000..bda08be4 --- /dev/null +++ b/hooks/queries/cakes.ts @@ -0,0 +1,53 @@ +import { getCakesInfo, getCakesResult } from '@/api/cakes'; +import { QUERY_KEY } from '@/constant/queryKey'; +import { CakeLettersType } from '@/types/letters/cakeLettersType'; +import { useState } from 'react'; +import { useQuery } from 'react-query'; + +/** + * 해당 소원에 대한 케이크 조회 + */ +export function useGetCakesInfo( + wishId: string | string[] | undefined, + cakeId: string | string[] | undefined, +) { + const [lettersData, setLettersData] = useState([]); + + const { data } = useQuery(QUERY_KEY.CAKE_LETTERS, async () => getCakesInfo(wishId, cakeId), { + onSuccess: (data) => { + setLettersData(data); + }, + enabled: wishId !== '' && cakeId !== '', + }); + + const lettersSum = lettersData ? lettersData.length : 0; + + return { data, lettersData, lettersSum }; +} + +/** + * 해당 소원에 대한 모든 케이크 리스트 결과 조회 + */ + +export function useGetCakesResult(wishId: string | string[] | undefined) { + const [total, setTotal] = useState(0); + // const setCakesCountData = useSetRecoilState(CakesCountData); + + const { data: cakesCount } = useQuery(QUERY_KEY.CAKES_COUNT, async () => getCakesResult(wishId), { + onSuccess: (data) => { + // setCakesCountData(data); + if (Array.isArray(data)) { + const cakesTotal = calculateTotal(data.map((cake: { count: number }) => cake.count)); + setTotal(cakesTotal); + } + }, + enabled: wishId !== '', + }); + + const calculateTotal = (cakeCounts: number[]): number => { + const total = cakeCounts.reduce((sum, count) => sum + count, 0); + return total; + }; + + return { cakesCount, total }; +} diff --git a/hooks/queries/cakes/useRequestPayReady.ts b/hooks/queries/cakes/useRequestPayReady.ts deleted file mode 100644 index 3f2b1b81..00000000 --- a/hooks/queries/cakes/useRequestPayReady.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { requestPayReady } from '@/api/cakes/cakesAPI'; -import { QUERY_KEY } from '@/constant/queryKey'; -import { useMutation } from 'react-query'; - -export default function useRequestPayReady(wishId: number, cakeNumber: number) { - const { data, mutate, isSuccess } = useMutation(QUERY_KEY.PAYREADY, () => - requestPayReady(wishId, cakeNumber), - ); - - return { data, mutate, isSuccess }; -} diff --git a/hooks/queries/letters/useGetCakeLetters.ts b/hooks/queries/letters/useGetCakeLetters.ts deleted file mode 100644 index 18dc8609..00000000 --- a/hooks/queries/letters/useGetCakeLetters.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { useQuery } from 'react-query'; -import { QUERY_KEY } from '@/constant/queryKey'; -import { CakeLettersType } from '@/types/letters/cakeLettersType'; -import { getCakesLetters } from '@/api/letters/getCakeLetters'; -import { useState } from 'react'; - -export function useGetCakesLetters(wishId: string | string[] | undefined, cakeId: string | string[] | undefined) { - const [lettersData, setLettersData] = useState([]); - - const { data } = useQuery( - QUERY_KEY.CAKE_LETTERS, - async () => getCakesLetters(wishId, cakeId), - { - onSuccess: (data) => { - setLettersData(data); - }, - enabled: wishId !== '' && cakeId !== '' - } - ); - - const lettersSum = lettersData ? lettersData.length : 0; - - return { data, lettersData, lettersSum }; -} \ No newline at end of file diff --git a/hooks/queries/letters/useGetCakesCount.ts b/hooks/queries/letters/useGetCakesCount.ts deleted file mode 100644 index 90567b1d..00000000 --- a/hooks/queries/letters/useGetCakesCount.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { useQuery } from 'react-query'; -import { QUERY_KEY } from '@/constant/queryKey'; -import { getCakesCount } from '@/api/letters/getCakesCount'; -// import { CakesCountData } from '@/recoil/cakesCountData'; -// import { useSetRecoilState } from 'recoil'; -import { useState } from 'react'; - -export function useGetCakesCount(wishId: string | string[] | undefined) { - const [total, setTotal] = useState(0); - // const setCakesCountData = useSetRecoilState(CakesCountData); - - const { data: cakesCount } = useQuery( - QUERY_KEY.CAKES_COUNT, - async () => getCakesCount(wishId), - { - onSuccess: (data) => { - // setCakesCountData(data); - if (Array.isArray(data)) { - const cakesTotal = calculateTotal(data.map((cake: { count: number }) => cake.count)); - setTotal(cakesTotal); - } - }, - enabled: wishId !== '', - } - ); - - const calculateTotal = (cakeCounts: number[]): number => { - const total = cakeCounts.reduce((sum, count) => sum + count, 0); - return total; - }; - - return { cakesCount, total }; -} diff --git a/hooks/queries/links/useDeleteWishLinks.ts b/hooks/queries/links/useDeleteWishLinks.ts deleted file mode 100644 index 7e51e25a..00000000 --- a/hooks/queries/links/useDeleteWishLinks.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { deleteWishLinks } from '@/api/links/deleteWishLinks'; -import { useMutation } from 'react-query'; - -export function useDeleteWishLinks() { - const mutation = useMutation((wishesData: number[]) => deleteWishLinks(wishesData)); - - return mutation; -} \ No newline at end of file diff --git a/hooks/queries/links/useGetOneWish.ts b/hooks/queries/links/useGetOneWish.ts deleted file mode 100644 index b0fcba8b..00000000 --- a/hooks/queries/links/useGetOneWish.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { useQuery } from 'react-query'; -import { QUERY_KEY } from '@/constant/queryKey'; -import { getOneWish } from '@/api/links/getOneWish'; -import router from 'next/router'; - -export function useGetOneWish(wishId: string | string[] | undefined) { - const { data: wishData } = useQuery( - QUERY_KEY.ONE_WISH, - async () => getOneWish(wishId), - { - onError: (error: any) => { - if (error.response && error.response.status === 403) { - alert('해당 소원에 접근할 수 없습니다.'); - router.back(); - } - }, - enabled: wishId !== '', - } - ); - - - return { wishData }; -} diff --git a/hooks/queries/links/useGetWishLinks.ts b/hooks/queries/links/useGetWishLinks.ts deleted file mode 100644 index 27b8651e..00000000 --- a/hooks/queries/links/useGetWishLinks.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { useQuery } from 'react-query'; -import { QUERY_KEY } from '@/constant/queryKey'; -import { getWishLinks } from '@/api/links/getWishLinks'; -import { WishLinksType } from '@/types/links/wishLinksType'; -import { useState } from 'react'; - -export function useGetWishLinks() { - const [noWishes, setNoWishes] = useState(true); - const [wishLinks, setWishLinks] = useState([]); - - const { data, isSuccess } = useQuery( - QUERY_KEY.WISH_LINKS, - async () => getWishLinks(), - { - onSuccess: (wishLinks) => { - if (wishLinks.length > 0) { - setNoWishes(false); - } - - setWishLinks(wishLinks); - }, - } - ); - - - return { wishLinks, isSuccess, noWishes }; -} diff --git a/hooks/queries/main/useGetProgressData.ts b/hooks/queries/main/useGetProgressData.ts deleted file mode 100644 index a56349b5..00000000 --- a/hooks/queries/main/useGetProgressData.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { getProgressData } from '@/api/main/getProgressData'; -import { QUERY_KEY } from '@/constant/queryKey'; -import { useState } from 'react'; -import { useQuery } from 'react-query'; - -export default function useGetProgressData() { - const [wishStatus, setWishStatus] = useState(''); - - const { data: progressData, isSuccess } = useQuery(QUERY_KEY.PROGRESS, getProgressData, { - onSuccess: (data) => { - if (data) { - if (data.status === 'WHILE') { - setWishStatus('while'); - } else if (data.status === 'END') { - setWishStatus('end'); - } else if (data.status === 'BEFORE') { - setWishStatus('before'); - } - } else { - setWishStatus('none'); - } - }, - }); - - return { progressData, wishStatus, isSuccess }; -} diff --git a/hooks/queries/mypage/useEditWishesInfo.tsx b/hooks/queries/mypage/useEditWishesInfo.tsx deleted file mode 100644 index 6f45cff3..00000000 --- a/hooks/queries/mypage/useEditWishesInfo.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { editWishesInfo } from '@/api/mypage/mypageAPI'; -import { EditWishesInfoDataType } from '@/types/mypage/editWishesInfoDataType'; -import { useRouter } from 'next/router'; -import { useMutation } from 'react-query'; - -export default function useEditWishesInfo(editWishesInfoData: EditWishesInfoDataType) { - const router = useRouter(); - const { mutate: editWishesData } = useMutation(() => editWishesInfo(editWishesInfoData), { - onSuccess: () => { - alert('수정성공'); - router.back(); - }, - }); - - return { editWishesData }; -} diff --git a/hooks/queries/user.ts b/hooks/queries/user.ts new file mode 100644 index 00000000..57ef46d9 --- /dev/null +++ b/hooks/queries/user.ts @@ -0,0 +1,22 @@ +import { getUserAccount, patchUserAccount } from '@/api/user'; +import { QUERY_KEY } from '@/constant/queryKey'; +import { WishesDataInputType } from '@/types/common/input/wishesInput'; +import router from 'next/router'; +import { UseFormReturn } from 'react-hook-form'; +import { useMutation, useQuery } from 'react-query'; + +export function usePatchUserAccount(methods: UseFormReturn) { + const { mutate: patchUserAccountData } = useMutation(() => patchUserAccount(methods), { + onSuccess: () => { + router.push('/wishes/share'); + }, + }); + + return { patchUserAccountData }; +} + +export function useGetUserAccount() { + const { data: userAccountData } = useQuery(QUERY_KEY.ITEM_DATA, getUserAccount); + + return { userAccountData }; +} diff --git a/hooks/queries/wishes.ts b/hooks/queries/wishes.ts new file mode 100644 index 00000000..0535637c --- /dev/null +++ b/hooks/queries/wishes.ts @@ -0,0 +1,127 @@ +import { + deleteWishes, + getMainProgressData, + getProgressWishInfo, + getSingleWishInfo, + getWishes, + patchProgressWishInfo, + postWishes, +} from '@/api/wishes'; +import { QUERY_KEY } from '@/constant/queryKey'; +import { LoginUserInfo } from '@/recoil/auth/loginUserInfo'; +import { WishesDataInputType } from '@/types/common/input/wishesInput'; +import { WishLinksType } from '@/types/links/wishLinksType'; +import router from 'next/router'; +import { useState } from 'react'; +import { UseFormReturn } from 'react-hook-form'; +import { useMutation, useQuery } from 'react-query'; +import { useSetRecoilState } from 'recoil'; + +/** + * 모든 소원리스트 조회 + */ +export function useGetWishes() { + const { data } = useQuery(QUERY_KEY.WISHES_DATA, getWishes); + + return data; +} + +/** + * 진행중인 소원 정보 수정 + */ +export function usePatchWishes(methods: UseFormReturn) { + const { mutate: patchWishesData } = useMutation(() => patchProgressWishInfo(methods), { + onSuccess: () => { + alert('수정성공'); + router.back(); + }, + }); + + return { patchWishesData }; +} + +/** + * 소원링크 생성 + */ +export function usePostWishes(methods: UseFormReturn) { + const setLoginUserInfo = useSetRecoilState(LoginUserInfo); + + const { mutate: postWishesData } = useMutation(() => postWishes(methods), { + onSuccess: (data) => { + setLoginUserInfo((prevData) => ({ + ...prevData, + wishesId: data.data.data, + })); + }, + }); + + return { postWishesData }; +} + +/** + * 소원링크 삭제 + */ +export function useDeleteWishes() { + const mutation = useMutation((wishesData: number[]) => deleteWishes(wishesData)); + + return mutation; +} + +/** + * 진행중인 소원 정보 조회 + */ +export function useGetWishesProgress() { + const { data: wishesProgressData, ...restProps } = useQuery( + QUERY_KEY.PROGRESS, + getProgressWishInfo, + ); + + return { wishesProgressData, ...restProps }; +} + +/** + * 진행중인 소원 조회(메인화면) + */ +export function useGetMainProgressData() { + const { data: progressData, ...restProps } = useQuery(QUERY_KEY.PROGRESS, getMainProgressData); + + return { progressData, ...restProps }; +} + +/** + * 소원 단건 조회 + */ +export function useGetSingleWishInfo(wishId: string | string[] | undefined) { + const { data: wishData } = useQuery(QUERY_KEY.ONE_WISH, async () => getSingleWishInfo(wishId), { + onError: (error: any) => { + if (error.response && error.response.status === 403) { + alert('해당 소원에 접근할 수 없습니다.'); + router.back(); + } + }, + enabled: wishId !== '', + }); + + return { wishData }; +} + +export function useGetWishLinks() { + const [noWishes, setNoWishes] = useState(true); + const [wishLinks, setWishLinks] = useState([]); + + const { data, isSuccess } = useQuery( + QUERY_KEY.WISH_LINKS, + async () => getWishes(), + { + onSuccess: (wishLinks) => { + if (wishLinks.length > 0) { + setNoWishes(false); + } + + setWishLinks(wishLinks); + }, + }, + ); + + return { wishLinks, isSuccess, noWishes }; +} diff --git a/hooks/queries/wishes/useCreateWishesLink.ts b/hooks/queries/wishes/useCreateWishesLink.ts deleted file mode 100644 index ed9caf3d..00000000 --- a/hooks/queries/wishes/useCreateWishesLink.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { createWishesLink } from '@/api/wishes/wishesAPI'; -import { LoginUserInfo } from '@/recoil/auth/loginUserInfo'; -import { WishesData } from '@/recoil/formPage/wishesData'; -import { useMutation } from 'react-query'; -import { useRecoilValue, useSetRecoilState } from 'recoil'; - -export function useCreateWishesLink() { - const wishesData = useRecoilValue(WishesData); - const setLoginUserInfo = useSetRecoilState(LoginUserInfo); - - const { mutate: postWishesData, isSuccess } = useMutation(() => createWishesLink(wishesData), { - onSuccess: (data) => { - setLoginUserInfo((prevData) => ({ - ...prevData, - wishesId: data.data.data, - })); - }, - }); - - return { postWishesData }; -} diff --git a/hooks/queries/wishes/useGetItemInfo.ts b/hooks/queries/wishes/useGetItemInfo.ts deleted file mode 100644 index 479aa467..00000000 --- a/hooks/queries/wishes/useGetItemInfo.ts +++ /dev/null @@ -1,29 +0,0 @@ -import useInput from '@/hooks/common/useInput'; -import { useState } from 'react'; - -//링크 타입을 유니온으로 설정해야됨 -export function useGetItemInfo() { - const [linkURL, handleChangeLinkURL, setLinkURL] = useInput(''); - const [imageURL, setImageURL] = useState(''); - const [price, setPrice] = useState(0); - - const changeLinkURL = (input: string) => { - setLinkURL(input); - }; - const changeImageURL = (input: string) => { - setImageURL(input); - }; - const changePrice = (input: number) => { - setPrice(input); - }; - - return { - linkURL, - changeLinkURL, - handleChangeLinkURL, - imageURL, - changeImageURL, - price, - changePrice, - }; -} diff --git a/hooks/queries/wishes/useGetUserAccount.tsx b/types/api/request.ts similarity index 100% rename from hooks/queries/wishes/useGetUserAccount.tsx rename to types/api/request.ts diff --git a/types/api/response.ts b/types/api/response.ts new file mode 100644 index 00000000..d4f2ed6b --- /dev/null +++ b/types/api/response.ts @@ -0,0 +1,18 @@ +import { AccountInfoType } from '../common/input/wishesInput'; +import { MainProgressDataType, WishesProgressDataType } from '../wishesType'; + +export type DefaultResponseType = { + success: boolean; + message: string; + data: T; +}; + +export type MainProgressDataResponseType = DefaultResponseType; + +export type WishesProgressDataResponseType = DefaultResponseType; + +export type UserAccountDataResponseType = DefaultResponseType<{ + accountInfo: AccountInfoType; + id: number; + phone: string | number; +}>; diff --git a/types/mypage/editWishesInfoDataType.ts b/types/mypage/editWishesInfoDataType.ts deleted file mode 100644 index 67d02730..00000000 --- a/types/mypage/editWishesInfoDataType.ts +++ /dev/null @@ -1,13 +0,0 @@ -export interface EditWishesInfoDataType { - startDate: Date; - endDate: Date; - name: string; - bankName: string; - account: string; - phone: string; - imageUrl: string; - price: number; - title: string; - hint: string; - initial: string; -} diff --git a/types/wishesType.ts b/types/wishesType.ts new file mode 100644 index 00000000..eec5dc85 --- /dev/null +++ b/types/wishesType.ts @@ -0,0 +1,33 @@ +export type MainProgressDataType = { + wishId: string; + cakeCount: number; + dayCount: number; + price: number; + percent: number; + status: 'WHILE' | 'BEFORE' | 'END'; +}; + +export interface WishesProgressDataType extends WishesDataInputType { + accountInfo: AccountInfoType; +} + +export interface WishesDataInputType extends BankInfoInputsType { + linkURL: string; + imageUrl: string; + price: string | number; + initial: string; + title: string; + hint: string; + startDate: Date; + endDate: Date; +} + +export interface BankInfoInputsType extends AccountInfoType { + phone: string; +} + +export interface AccountInfoType { + name: string; + bank: string; + account: string; +} diff --git a/utils/common/token.ts b/utils/common/token.ts new file mode 100644 index 00000000..0c7eb814 --- /dev/null +++ b/utils/common/token.ts @@ -0,0 +1,6 @@ +export const getAccessToken = (): string | null => { + if (typeof window !== 'undefined') { + return localStorage.getItem('accessToken'); + } + return null; +}; From 2ad59a84fbfa19fcba55145e1803a81900796590 Mon Sep 17 00:00:00 2001 From: myeongheonhong Date: Thu, 21 Dec 2023 17:22:40 +0900 Subject: [PATCH 2/7] =?UTF-8?q?[=20refactor=20]=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EB=90=9C=20API=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/mypage/letters/[id].tsx | 4 +- components/mypage/letters/cakeListButton.tsx | 40 ++++++++--------- components/mypage/letters/lettersMain.tsx | 4 +- components/mypage/links/[id].tsx | 2 +- components/mypage/links/index.tsx | 5 +-- components/mypage/links/wishLists.tsx | 2 +- components/wishes/[id].tsx | 15 ++----- components/wishes/wishesForm/BankInfo.tsx | 45 ++++++++----------- components/wishes/wishesForm/Preview.tsx | 13 ++++-- .../{UploadGift.tsx => UploadPresent.tsx} | 29 +++++++----- components/wishes/wishesForm/WisehsStep2.tsx | 23 +--------- components/wishes/wishesForm/WishesStep1.tsx | 19 ++++---- components/wishes/wishesForm/index.tsx | 20 +++++++-- components/wishes/wishesForm/itemLink.tsx | 17 ++++--- hooks/wishes/useUploadItemInfo.ts | 10 ++--- 15 files changed, 115 insertions(+), 133 deletions(-) rename components/wishes/wishesForm/{UploadGift.tsx => UploadPresent.tsx} (76%) diff --git a/components/mypage/letters/[id].tsx b/components/mypage/letters/[id].tsx index 39954bda..a41cde62 100644 --- a/components/mypage/letters/[id].tsx +++ b/components/mypage/letters/[id].tsx @@ -6,8 +6,8 @@ import { BorderImg } from '@/public/assets/images'; import { useEffect, useState } from 'react'; import { ArrowLeftIc, ArrowRightIc, BackBtnIc } from '@/public/assets/icons'; import { useRouter } from 'next/router'; -import { useGetCakesLetters } from '@/hooks/queries/letters/useGetCakeLetters'; import { CAKE_LIST } from '@/constant/cakeList'; +import { useGetCakesInfo } from '@/hooks/queries/cakes'; export default function LettersContainer() { const [wishId, setWishId] = useState(''); @@ -26,7 +26,7 @@ export default function LettersContainer() { const cakeData = CAKE_LIST.find((cake) => cake.cakeNumber === Number(cakeId)); // 편지 - const { lettersData, lettersSum } = useGetCakesLetters(wishId, cakeId); + const { lettersData, lettersSum } = useGetCakesInfo(wishId, cakeId); const handleNameBoxClick = (index: number) => { setClickedBox(index); diff --git a/components/mypage/letters/cakeListButton.tsx b/components/mypage/letters/cakeListButton.tsx index 97bfc5c1..05f7d60a 100644 --- a/components/mypage/letters/cakeListButton.tsx +++ b/components/mypage/letters/cakeListButton.tsx @@ -2,7 +2,6 @@ import theme from '@/styles/theme'; import styled from 'styled-components'; import Image, { StaticImageData } from 'next/image'; - interface CakeListButtonProps { image?: string | StaticImageData; backgroundColor: string; @@ -17,35 +16,32 @@ export default function CakeListButton(props: CakeListButtonProps) { const { image, backgroundColor, fonts, fontColor, handleClick, cakeName, cakeNum } = props; return ( - {image && ( - 케이크 이미지 - )} + {image && 케이크 이미지} {/* */} {cakeName} X {cakeNum}개 - ); } const Styled = { - Container: styled.button<{ backgroundColor: string } >` - width: 100%; - height: 6rem; + Container: styled.button<{ backgroundColor: string }>` + width: 100%; + height: 6rem; - display: flex; - justify-content: left; - align-items: center; + display: flex; + justify-content: left; + align-items: center; - padding: 0 2rem 0; - border-radius: 1rem; + padding: 0 2rem 0; + border-radius: 1rem; - color: ${theme.colors.gray4}; - background-color: ${(props) => props.backgroundColor}; - border-color: transparent; - margin: 0 0 1rem; -`, + color: ${theme.colors.gray4}; + background-color: ${(props) => props.backgroundColor}; + border-color: transparent; + margin: 0 0 1rem; + `, // TextContainer: styled.div<{ fonts: string; fontColor: string }>` // padding: 0.2rem 0.5rem 0 1rem; @@ -54,10 +50,10 @@ const Styled = { // `, TextContainer: styled.div<{ fontColor: string }>` - padding: 0.2rem 0.5rem 0 1rem; + padding: 0.2rem 0.5rem 0 1rem; `, NumText: styled.span` -color: ${theme.colors.main_blue}; -` -}; \ No newline at end of file + color: ${theme.colors.main_blue}; + `, +}; diff --git a/components/mypage/letters/lettersMain.tsx b/components/mypage/letters/lettersMain.tsx index 25640788..ba48c4a9 100644 --- a/components/mypage/letters/lettersMain.tsx +++ b/components/mypage/letters/lettersMain.tsx @@ -2,12 +2,12 @@ import theme from '@/styles/theme'; import styled from 'styled-components'; import { useRouter } from 'next/router'; import CakeListButton from './cakeListButton'; -import { useGetCakesCount } from '@/hooks/queries/letters/useGetCakesCount'; import { useRecoilValue } from 'recoil'; import { LoginUserInfo } from '@/recoil/auth/loginUserInfo'; import { useEffect, useState } from 'react'; import MainHeader from '@/components/common/mainHeader'; import { CAKE_LIST } from '@/constant/cakeList'; +import { useGetCakesResult } from '@/hooks/queries/cakes'; export default function LettersMainContainer() { const [wishId, setWishId] = useState(''); @@ -27,7 +27,7 @@ export default function LettersMainContainer() { }, [loginUserInfo]); // cake 개수, 합 - const { cakesCount, total } = useGetCakesCount(wishId); + const { cakesCount, total } = useGetCakesResult(wishId); const getCakeNum = (cakeId: number, cakesCount: any[]): number => { if (!cakesCount) { diff --git a/components/mypage/links/[id].tsx b/components/mypage/links/[id].tsx index 1512f839..4845a709 100644 --- a/components/mypage/links/[id].tsx +++ b/components/mypage/links/[id].tsx @@ -5,7 +5,7 @@ import theme from '@/styles/theme'; import { LinkBeefCakeImg } from '@/public/assets/images'; import { useEffect, useState } from 'react'; import { useGetOneWish } from '@/hooks/queries/links/useGetOneWish'; -import { convertDateFormat } from '@/hooks/useDate'; +import { convertDateFormat } from '@/hooks/common/useDate'; import VerticalProgressBar from '@/components/common/verticalProgressBar'; export default function LinksContainer() { diff --git a/components/mypage/links/index.tsx b/components/mypage/links/index.tsx index 846aeeb2..d5b9acae 100644 --- a/components/mypage/links/index.tsx +++ b/components/mypage/links/index.tsx @@ -4,19 +4,18 @@ import useModal from '@/hooks/common/useModal'; import Modal from '@/components/common/modal'; import DeleteModal from '@/components/common/modal/DeleteModal'; import { useState } from 'react'; -import { useGetWishLinks } from '@/hooks/queries/links/useGetWishLinks'; import WishLists from './wishLists'; import NoWishLists from './noWishLists'; -import { useDeleteWishLinks } from '@/hooks/queries/links/useDeleteWishLinks'; import { useQueryClient } from 'react-query'; import { QUERY_KEY } from '@/constant/queryKey'; +import { useDeleteWishes, useGetWishLinks } from '@/hooks/queries/wishes'; export default function LinksMainContainer() { const [selectedLinks, setSelectedLinks] = useState([]); const { isOpen, handleToggle } = useModal(); const queryClient = useQueryClient(); - const deleteWishesMutation = useDeleteWishLinks(); + const deleteWishesMutation = useDeleteWishes(); const { wishLinks, noWishes } = useGetWishLinks(); diff --git a/components/mypage/links/wishLists.tsx b/components/mypage/links/wishLists.tsx index fc7d1169..085ffb24 100644 --- a/components/mypage/links/wishLists.tsx +++ b/components/mypage/links/wishLists.tsx @@ -1,6 +1,6 @@ import LinksBox from './linksBox'; import { WishLinksType } from '@/types/links/wishLinksType'; -import { convertDateFormat } from '@/hooks/useDate'; +import { convertDateFormat } from '@/hooks/common/useDate'; import router from 'next/router'; interface WishListsProps { diff --git a/components/wishes/[id].tsx b/components/wishes/[id].tsx index 29ae46f0..7b713055 100644 --- a/components/wishes/[id].tsx +++ b/components/wishes/[id].tsx @@ -4,7 +4,7 @@ import { useRouter } from 'next/router'; import { useQuery } from 'react-query'; import Button from '../common/button'; import MainView from '../common/mainView'; -import { getWishesData } from '@/api/cakes/cakesAPI'; +import { useGetSingleWishInfo } from '@/hooks/queries/wishes'; export default function WishesContainer() { const [wishesId, setWishesId] = useState(''); @@ -15,16 +15,7 @@ export default function WishesContainer() { setWishesId(router.query.id); }, [router.isReady]); - const { data } = useQuery('wished', getWishesData); - - // const { data } = useQuery('wished', async () => getWishesData(Number(wishesId)), { - // onError: (error: any) => { - // console.error("에러 발생:", error); - // alert("해당 소원의 펀딩이 아직 가능하지 않습니다. 펀딩 기간을 확인해주세요."); - // router.back(); - // }, - // enabled: wishesId !== '', - // }); + const { wishData } = useGetSingleWishInfo(wishesId); const handleMoveToCakes = () => { router.push(`/cakes/${wishesId}`); @@ -36,7 +27,7 @@ export default function WishesContainer() { return ( - + - + */} ); } diff --git a/components/common/box/itemImageBox.tsx b/components/common/box/itemImageBox.tsx index ca351500..daab16d3 100644 --- a/components/common/box/itemImageBox.tsx +++ b/components/common/box/itemImageBox.tsx @@ -1,6 +1,5 @@ import Image from 'next/image'; import ImageBox from './imageBox'; -import styled from 'styled-components'; interface ItemImageBoxProps { src: string; @@ -9,6 +8,7 @@ interface ItemImageBoxProps { export default function ItemImageBox(props: ItemImageBoxProps) { const { src, alt } = props; + return ( {alt} diff --git a/components/common/button/iconButton.tsx b/components/common/button/iconButton.tsx deleted file mode 100644 index 6457c6e7..00000000 --- a/components/common/button/iconButton.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import Image from 'next/image'; - -interface IconButtonProps { - src: string; - alt: string; - onClick?: () => void; -} - -export default function IconButton(props: IconButtonProps) { - const { src, alt, onClick } = props; - - const handleClick = () => { - if (onClick) { - onClick(); - } - }; - - return ( - - ); -} diff --git a/components/common/calendar/calendar.tsx b/components/common/calendar/calendar.tsx index b36f0d87..c02d1564 100644 --- a/components/common/calendar/calendar.tsx +++ b/components/common/calendar/calendar.tsx @@ -15,13 +15,11 @@ import { getDate } from '@/utils/common/getDate'; interface CalendarProps { date: Date; methods: UseFormReturn; - disable: boolean; - colorSystem: ColorSystemType; - readOnly: boolean; + readOnly?: boolean; } export default function Calendar(props: CalendarProps) { - const { date, methods, disable, colorSystem, readOnly } = props; + const { date, methods, readOnly } = props; const handleChangeDate = (selectedDate: Date) => { methods.setValue('startDate', selectedDate); @@ -29,7 +27,10 @@ export default function Calendar(props: CalendarProps) { }; return ( - + ( @@ -46,7 +47,7 @@ export default function Calendar(props: CalendarProps) { /> {/* */} - 캘린더 아이콘 + 캘린더 아이콘 ); } diff --git a/components/common/input/textareaBox.tsx b/components/common/input/textareaBox.tsx index ea1d1b92..e4f695d6 100644 --- a/components/common/input/textareaBox.tsx +++ b/components/common/input/textareaBox.tsx @@ -8,7 +8,6 @@ import ImageBox from '../box/imageBox'; interface TextareaBoxProps { placeholder?: string; - value?: string; inputLength: number; limitLength: number; readOnly?: boolean; @@ -16,11 +15,11 @@ interface TextareaBoxProps { } export default function TextareaBox(props: TextareaBoxProps) { - const { placeholder, value, inputLength, limitLength, readOnly, register } = props; + const { placeholder, inputLength, limitLength, readOnly, register } = props; return ( - + {limitLength && } diff --git a/components/common/modal/BankInput.tsx b/components/common/modal/BankInput.tsx index d45e4053..ed90d96f 100644 --- a/components/common/modal/BankInput.tsx +++ b/components/common/modal/BankInput.tsx @@ -5,7 +5,7 @@ import styled from 'styled-components'; import Button from '../button'; import { UseFormReturn } from 'react-hook-form'; import Input from '../input/input'; -import { BankInfoInputsType } from '@/types/common/input/wishesInput'; +import { WishesDataInputType } from '@/types/common/input/wishesInput'; import { ArrowDownIc } from '@/public/assets/icons'; import Image from 'next/image'; import { StyledBox } from '../box'; @@ -13,7 +13,7 @@ import theme from '@/styles/theme'; import AlertTextBox from '../alertTextBox'; interface BankInputProps { - methods: UseFormReturn; + methods: UseFormReturn; } export default function BankInput(props: BankInputProps) { @@ -31,7 +31,7 @@ export default function BankInput(props: BankInputProps) { - + 더 보기 diff --git a/components/common/modal/BankModal.tsx b/components/common/modal/BankModal.tsx index d661f859..67969096 100644 --- a/components/common/modal/BankModal.tsx +++ b/components/common/modal/BankModal.tsx @@ -13,8 +13,8 @@ interface BankModalProps { export default function BankModal(props: BankModalProps) { const { handleToggle, methods } = props; - const handleChangeBankName = (input: string) => { - methods.setValue('bankName', input); + const handleChangeBank = (input: string) => { + methods.setValue('bank', input); handleToggle(); }; @@ -24,7 +24,7 @@ export default function BankModal(props: BankModalProps) { {BANK_LIST.map((bank) => ( - handleChangeBankName(bank.name)}> + handleChangeBank(bank.name)}> {`${bank.name} diff --git a/components/common/modal/DeleteModal.tsx b/components/common/modal/DeleteModal.tsx index 673f8c91..5dc486d1 100644 --- a/components/common/modal/DeleteModal.tsx +++ b/components/common/modal/DeleteModal.tsx @@ -3,7 +3,6 @@ import Image from 'next/image'; import theme from '@/styles/theme'; import { CloseSmallIc } from '@/public/assets/icons'; -import IconButton from '@/components/common/button/iconButton'; import { MainCakeImg } from '@/public/assets/images'; import Button from '../button'; @@ -24,7 +23,7 @@ export default function DeleteModal(props: DeleteModalProps) { return ( - + 닫기 diff --git a/components/common/modal/GuideModal.tsx b/components/common/modal/GuideModal.tsx index 0638e8ec..fc175a56 100644 --- a/components/common/modal/GuideModal.tsx +++ b/components/common/modal/GuideModal.tsx @@ -1,9 +1,7 @@ import styled from 'styled-components'; import Image from 'next/image'; -import IconButton from '@/components/common/button/iconButton'; import { CloseWhiteIc } from '@/public/assets/icons'; import { GuideContentImg, GuideBoxImg } from '@/public/assets/images'; -import Button from '../button'; interface GuideModalProps { clickModal: () => void; @@ -22,22 +20,13 @@ export default function GuideModal(props: GuideModalProps) { - + 닫기 { 서비스 가이드 설명 - - - } @@ -104,9 +93,4 @@ const Styled = { position: relative; margin: 2.3rem 0rem 2.9rem; `, - - ButtonContainer2: styled.div` - position: relative; - margin: 2.3rem 2.1rem 0; - `, }; diff --git a/components/common/modal/index.tsx b/components/common/modal/index.tsx index e8dcc5f2..f7968f63 100644 --- a/components/common/modal/index.tsx +++ b/components/common/modal/index.tsx @@ -4,14 +4,15 @@ import styled from 'styled-components'; interface ModalProps { isOpen: boolean; handleToggle: () => void; + bgNone?: boolean; } export default function Modal(props: PropsWithChildren) { - const { isOpen, handleToggle, children } = props; + const { isOpen, handleToggle, bgNone, children } = props; return ( <> {isOpen && ( - + e.stopPropagation()}> {children} @@ -22,7 +23,7 @@ export default function Modal(props: PropsWithChildren) { } const Styled = { - ModalOverlay: styled.div` + ModalOverlay: styled.div<{ bgNone?: boolean }>` display: flex; justify-content: center; align-items: center; @@ -34,7 +35,7 @@ const Styled = { position: fixed; top: 0; left: 0; - background: rgba(0, 0, 0, 0.7); + background: ${(props) => (props.bgNone ? 'transparent' : 'rgba(0, 0, 0, 0.7)')}; display: flex; justify-content: center; align-items: center; diff --git a/components/login/redirect.tsx b/components/login/redirect.tsx index cdda5b27..de079eec 100644 --- a/components/login/redirect.tsx +++ b/components/login/redirect.tsx @@ -1,7 +1,7 @@ import { useRouter } from 'next/router'; -import useAuthKakao from '@/hooks/queries/login/useAuthKakao'; import { useEffect } from 'react'; import Loading from '../common/loading'; +import { useAuthKakao } from '@/hooks/queries/auth'; export default function Redirect() { const router = useRouter(); @@ -14,7 +14,5 @@ export default function Redirect() { } }, [accessToken, refreshToken, nickName]); - return ( - - ); -} \ No newline at end of file + return ; +} diff --git a/public/assets/images/guideContentImg.svg b/public/assets/images/guideContentImg.svg index 5fe7b827..970d2d35 100644 --- a/public/assets/images/guideContentImg.svg +++ b/public/assets/images/guideContentImg.svg @@ -1,4 +1,4 @@ - + @@ -9,10 +9,6 @@ - - - - @@ -139,7 +135,6 @@ - @@ -173,16 +168,15 @@ - - - - + + + - + @@ -205,16 +199,16 @@ - + - + - - - - + + + + @@ -222,76 +216,76 @@ - + - + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - + diff --git a/public/assets/images/index.ts b/public/assets/images/index.ts index 954782c8..c2b1477e 100644 --- a/public/assets/images/index.ts +++ b/public/assets/images/index.ts @@ -2,6 +2,7 @@ export { default as MainLoginImg } from '../images/mainLoginImg.png'; export { default as MainCakeImg } from '../images/mainCakeImg.png'; export { default as LogoImg } from '../images/logoImg.svg'; +export { default as MainPageCakeImg } from '../images/mainPageCakeImg.png'; export { default as BeefCakeDetailImg } from '../images/cakes/beefCakeDetailImg.png'; export { default as ChickenCakeDetailImg } from '../images/cakes/chickenCakeDetailImg.png'; diff --git a/public/assets/images/mainCakeImg.png b/public/assets/images/mainCakeImg.png index db60b0bb55fad5ac5b70c676ab8f1cb478de04fb..dcc989f309003eae04cc6f9b9ca63d1234f60468 100644 GIT binary patch literal 7656 zcmeHMhf`CDw+_O>x>7_CkWdtOfPxeO=|orBu7V;>dKJ`AqzHr-kOe{$qZ>7JL8Syj z6GBM{t^`7nh?EfNU23Exp(Zcx@6G(?&70-NAMi4BPbT-yotvERobUV2Ny;rtGrnKM ze*pjhe7~6+-v$7V!G9b-bFzKtD@2n z=cy9UCI0jB=X{u)vCRG3%AynPixYfgX0E!Jw}^( zkT)bD4)*u^|JPv|X!Rx@D|q*IMC8Q=6H`)J*9Vy#pv=v=`(3;!rS~T(?543r1-1S&W@zPO(~W5;b$({A8;Jfo z6U%rZ&~}Gt6tiNeaFgphE5$qxR|vZXw-wlyQpgQMMPrjaCA@>w;_$7DegMF;6!U)w zXVy8Z%(fzN#2RIKmI0}#9>)MD#2d@CN(BY&L<@5c%|cYevgbAzj@`@arvLzQLhQEu z=b)i*Dy;ekf`#v}iUFDGU)nCy1Y&$|8rDZ&Hl5r`=y>VLWwZy9PGjvRR@$K$cmiNv1Bz3q>vEI$Oj8>YXyz0o|w$P~^5>tJF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u=25AvV&$oan{)p1Rt3feqr?wclg!3^=O*R* z39MQ?xbEQgW?uDAH%J$zV~{+=@@21w)eaOINNxl3%iqO|$2p?qd(vsH$zM1xIDGn* zg%a1hZ@;Pg4;s^O?|M*hgmR`}5gy(=mm(%?xSC_shNk$7k(DRdK*% zm1ULYNUh|Y1|kS$w1#nh+$=pU&9xD%G%gCH?DWJIc>v^H>M6gnF2Sr0HfDPl|~ zpjC>-E1Y@CK#LUSg%CUDy;^S++mx(FaIX^Azb4uO{jI(56>_}t%r@p4wu6eBV39ZE zh(AmzO$_LWSzI}KhaSMg83p7KOY;Z3#ay7 z*wv1K#Rz~@eoX6ftd|-zgq2sZ02?aBYop&}w_feivu>YUKNWF~ndb@2nv&C0MFVax zyMt1nch63-ZccfF1%|Kq;&)v+9<6!%VyO|}gjwzFt*y%4*~KC?=RV8!gWr^`0Z5fu z1s0!4N{U8-)rZo&8&&M%)Mg?4CZ%Xye9mZM);KA;4AY*@+-AqZ{{kxkq#TeURS?mU z7F{D!QGmUmWhY#yDZDA)L@%P98Z@eV+qwPeuZbi;Vg2nHNa6~0?0Un}pk?8O9`xqs z=9|&s+++^x8P2Ml?DZ(6;js&`>a5Ns!eLNsI3dBjU~8B+O@Ts%IEf-{2WmZp@Xcgi zpOtWVhP7p!Rg!Hup7U^1i`~d*AV#!QM$H-70G5*Cu8gBWvi#nOR8Nw;OwPLaN~w84 z$?^uv>#0Q692V{)T#X~V#d|&f;+k&i&0>-Ml7UUIGBiJJ2Vq>%fnB)CA9zClDML>Z zn~<(O=F(Y;z?_tt8q}HF=Hw>ISI|E;s400EPe@OutS%n;+AmCNS-piKxaWj#sb7}nleP?+S@JjDb1gf_SSICLh^*9H3 oFAa5+`2YUJ!2g-~?;er4Az3;C_mp_H{+N`GhM{`pZHK4-0;}@|qyPW_ diff --git a/public/assets/images/mainPageCakeImg.png b/public/assets/images/mainPageCakeImg.png new file mode 100644 index 0000000000000000000000000000000000000000..62f950a25318e43e0b5d08c7b95c63acd1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JD7ZjN<;J5wZdJqV?bTkDbo`z) zn(3*TKSZw|z1RJv(_FbbFJZ9EtUb#>sIR}f$NWB*7{_EK%ZUpFlX|_Fv*mdUG>Pv! zJHev0`O{*QZmh8D`mYa$)TV4u$iIop*y2px+fWC8RU-2Zg_|w(rQlrE;|F8SI$30I zl0D?kGx5F7KFj&>8NAv4=f(PBp^(=hRM%r8W{X?$f7!Ny(N-GX`EyF?Xc{rzPb1Qh zma$UHdbeD6H8XV&DF0O8cM?3wDO22G9qm>-YAaa4!$}5H?K~cswBvYzxj>%dS!CK4 z8<{7x0rBH#oA>o09&^ci{LyC9(DqEboZb$_rrIug8Te=gdZzSlKB1%r&!0x^NE4E~ z=p5YAoo{K;q_S$%8+}5~|1?Hp1?V5hIyHIc?HE);)*e%nZUB>Vb|`9fsS8u>o?uSy zhdrWN0bb_}%Ats_T$bb|_EQ&u%W*;R}$q??`PvJIe)8jInK37xgG;Mg#^fFD&Y2T zXFk^-6BQZ{YsjDUZk{>4_|M<203iUV$&iSw^vQjAoJG{1VP%L;6E$|Ouf4GNab7nD zv68&Q&rM3^J1J68NwRH_6?Vk<+CY}ej^*n{+ zO+Ngo9<<%P#?c=PHyU$k6m&kO%=C{$h}YNp5MRTPK}C|z%}Gi{715@)ALtQD2_jJP zF7qXEWGtI_4nL{SOfTB^hc}NjztP*@YcUyxn5MAiN`}T;=+#KgEEgv8>K3Hex7-0w zy-+|t-72~LMB`rQ*u*ac->gF|DTC&ZXv~lSvjd?cFU%S!r=^yTk}kSRIXouvN^3b5 zfr(FI1&n4uX=rlnY)4-Dqy>Ht7woRg_U|v=%z_Ao%9t9oK3G{aR*6UO{eK%s|EFF0 a$Po{A0{a5RKAiH~2>eXtX~`4Qfd2vn^{dGM literal 0 HcmV?d00001 diff --git a/public/assets/images/sns/twitterLogoImg.svg b/public/assets/images/sns/twitterLogoImg.svg index c47c30bc..9971b50f 100644 --- a/public/assets/images/sns/twitterLogoImg.svg +++ b/public/assets/images/sns/twitterLogoImg.svg @@ -2,8 +2,8 @@ - + - + From bdc1a1495d77db2ed33a3c6d15c43f3f4e4df647 Mon Sep 17 00:00:00 2001 From: myeongheonhong Date: Thu, 21 Dec 2023 17:26:17 +0900 Subject: [PATCH 4/7] =?UTF-8?q?[=20refactor=20]=20=EB=A9=94=EC=9D=B8?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/main/cake.tsx | 128 ------------------------- components/main/header.tsx | 130 -------------------------- components/main/index.tsx | 86 ++--------------- components/main/mainBtn.tsx | 56 +++++++++++ components/main/mainCenterContent.tsx | 107 +++++++++++++++++++++ components/main/mainTopContent.tsx | 106 +++++++++++++++++++++ 6 files changed, 275 insertions(+), 338 deletions(-) delete mode 100644 components/main/cake.tsx delete mode 100644 components/main/header.tsx create mode 100644 components/main/mainBtn.tsx create mode 100644 components/main/mainCenterContent.tsx create mode 100644 components/main/mainTopContent.tsx diff --git a/components/main/cake.tsx b/components/main/cake.tsx deleted file mode 100644 index 1a7f9b76..00000000 --- a/components/main/cake.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import styled from 'styled-components'; -import theme from '@/styles/theme'; -import router from 'next/router'; -import Image from 'next/image'; -import { - MainChatImg, - MainEndCakeImg, - MainEndChatImg, - MainWishChatImg, - MainCakeImg, -} from '@/public/assets/images'; -import { LoginUserInfo } from '@/recoil/auth/loginUserInfo'; -import { useRecoilValue } from 'recoil'; -import { convertMoneyText } from '@/utils/common/convertMoneyText'; -import VerticalProgressBar from '../common/verticalProgressBar'; - -interface CakeProps { - wishStatus: string; - percent?: number; - price?: number; -} - -export default function Cake(props: CakeProps) { - const { wishStatus, percent, price } = props; - const loginUserInfo = useRecoilValue(LoginUserInfo); - - const handleMoveToLetters = () => { - router.push(`/mypage/letters/${loginUserInfo.wishesId}`); - }; - - const ChatImg = () => { - return wishStatus === 'before' || wishStatus === 'while' - ? MainWishChatImg - : wishStatus === 'end' - ? MainEndChatImg - : MainChatImg; - }; - - const priceData = wishStatus === 'while' || wishStatus === 'end' ? price : '???'; - - const CakeImg = () => (wishStatus === 'end' ? MainEndCakeImg : MainCakeImg); - - return ( - - - - 말풍선 - - 케이크 - - - {wishStatus === 'while' || wishStatus === 'end' ? ( - - 모인 케이크 보러가기 {'>'} - - ) : ( - 모인 케이크 금액 - )} - - {typeof priceData === 'number' ? ( - 총 {convertMoneyText(String(priceData))}원 - ) : ( - 총 {priceData}원 - )} - - - - - - {(wishStatus === 'while' || wishStatus === 'end') && ( - - {`펀딩 종료 후 3일내에 송금이 완료됩니다.\n계좌번호를 확인해주세요!`} - - )} - - ); -} - -const Styled = { - Container: styled.div` - margin: 9rem 0 0; - `, - - ImageContainer: styled.div` - width: 100%; - text-align: center; - `, - - AboutButton: styled.button` - width: 100%; - margin: 0 0 1rem; - ${theme.fonts.headline24_100}; - color: ${theme.colors.main_blue}; - `, - - AboutSmall: styled.div` - display: flex; - justify-content: center; - align-items: center; - ${theme.fonts.headline24_100}; - margin: 0 0 5.4rem; - `, - - Warning: styled.div` - display: flex; - justify-content: center; - text-align: center; - ${theme.fonts.body14}; - color: ${theme.colors.warning_red}; - margin: 0 0 3rem; - - white-space: pre-line; - `, - - CenterContainer: styled.div` - width: 100%; - display: flex; - justify-content: right; - align-items: center; - padding: 0 1rem 0 0; - `, - - ContentContainer: styled.div` - display: flex; - flex-direction: column; - justify-content: center; - `, -}; diff --git a/components/main/header.tsx b/components/main/header.tsx deleted file mode 100644 index 044c944f..00000000 --- a/components/main/header.tsx +++ /dev/null @@ -1,130 +0,0 @@ -import styled, { css } from 'styled-components'; -import theme from '@/styles/theme'; -import { SideBarIc } from '@/public/assets/icons'; -import IconButton from '@/components/common/button/iconButton'; -import MainHeader from '../common/mainHeader'; -import { useRecoilValue } from 'recoil'; -import { LoginUserInfo } from '@/recoil/auth/loginUserInfo'; -import router from 'next/router'; -import { useEffect, useState } from 'react'; - -interface HeaderProps { - wishStatus: string; - dayCount?: number; - cakeCount?: number; -} - -export default function Header(props: HeaderProps) { - const { wishStatus, dayCount, cakeCount } = props; - - const [nickName, setNicknameState] = useState(''); - const loginUserInfo = useRecoilValue(LoginUserInfo); - - useEffect(() => { - setNicknameState(loginUserInfo.nickName); - }, [loginUserInfo]); - - const handleMoveToMypage = () => { - router.push('/mypage'); - }; - - const getTitleContent = () => { - if (wishStatus === 'none') { - return ( - - {nickName}님, -
- 소원 링크를 생성하고 -
- 케이크를 모아봐요! -
- ); - } else if (wishStatus === 'while' || wishStatus === 'end') { - return ( - - {nickName}님에게 -
- {cakeCount}개의 조각 케이크가 -
- 도착했어요! -
- ); - } else if (wishStatus === 'before') { - return ( - - {nickName}님, -
- {dayCount}일 뒤 부터 소원링크를 -
- 공유해봐요! -
- ); - } else { - - {nickName}님, -
- 소원 링크를 생성하고 -
- 케이크를 모아봐요! -
; - } - }; - - const getDdayText = () => { - if (wishStatus === 'while') { - if (dayCount === 0) { - return '-DAY'; - } - return `-${dayCount}`; - } else if (wishStatus === 'end') { - return dayCount !== undefined ? `+${Math.abs(dayCount)}` : '?'; - } else { - return '-?'; - } - }; - - const sideContent = ( - <> - - D{getDdayText()} - - ); - - return ( - <> - - - ); -} - -const Styled = { - Title: styled.div` - ${theme.fonts.headline24_130}; - `, - - TitleColor: styled.span` - color: ${theme.colors.main_blue}; - `, - - DaysText: styled.span<{ wishStatus: string }>` - ${theme.fonts.headline20}; - color: ${theme.colors.main_blue}; - display: flex; - justify-content: center; - margin-top: 1.5rem; - - color: ${theme.colors.main_blue}; - - ${({ wishStatus }) => - wishStatus === 'end' && - css` - color: ${theme.colors.warning_red}; - `} - - ${({ wishStatus }) => - wishStatus === 'before' && - css` - color: ${theme.colors.gray2}; - `} - `, -}; diff --git a/components/main/index.tsx b/components/main/index.tsx index 96a1836f..270fd384 100644 --- a/components/main/index.tsx +++ b/components/main/index.tsx @@ -1,88 +1,14 @@ -import Header from './header'; +import MainTopContent from './mainTopContent'; -import Cake from './cake'; -import useGetProgressData from '@/hooks/queries/main/useGetProgressData'; -import { ReactNode, useEffect, useState } from 'react'; -import { useSetRecoilState } from 'recoil'; -import { LoginUserInfo } from '@/recoil/auth/loginUserInfo'; -import styled from 'styled-components'; -import Button from '../common/button'; -import { BtnBoxTypes, ColorSystemType } from '@/types/common/box/boxStyleType'; -import useModal from '@/hooks/common/useModal'; -import router from 'next/router'; -import Modal from '../common/modal'; -import ShareModal from '../common/modal/ShareModal'; +import MainBtn from './mainBtn'; +import MainCenterContent from './mainCenterContent'; export default function MainContainer() { - const [status, setStatus] = useState('none'); - const setLoginUserInfo = useSetRecoilState(LoginUserInfo); - - const { progressData, wishStatus } = useGetProgressData(); - - const { isOpen, handleToggle } = useModal(); - - const handleMovePage = () => { - router.push('/wishes'); - }; - - useEffect(() => { - setStatus(wishStatus); - progressData && - setLoginUserInfo((prev) => ({ - ...prev, - wishesId: progressData.wishId, - })); - }, [progressData, wishStatus]); - - const getButton = (): ReactNode | null => { - if (wishStatus === 'end') return null; - - let colorSystem: ColorSystemType = 'mainBlue_white'; - let handleClickFn = handleMovePage; - let btnText = '소원 링크 생성하기'; - - if (wishStatus === 'before') { - btnText = '내 소원 링크 공유하기'; - } - - if (wishStatus === 'while') { - handleClickFn = handleToggle; - colorSystem = 'pastelBlue_white'; - } - - return ( - - ); - }; - return ( <> -

- - - - {getButton()} - {isOpen && ( - - - - )} + + + ); } - -const Styled = { - ButtonWrapper: styled.div` - margin-bottom: 10.4rem; - `, -}; diff --git a/components/main/mainBtn.tsx b/components/main/mainBtn.tsx new file mode 100644 index 00000000..5787003e --- /dev/null +++ b/components/main/mainBtn.tsx @@ -0,0 +1,56 @@ +import router from 'next/router'; +import Button from '../common/button'; +import styled from 'styled-components'; +import useModal from '@/hooks/common/useModal'; +import Modal from '../common/modal'; +import ShareModalConent from '../common/modal/share/ShareModalConent'; +import { useGetMainProgressData } from '@/hooks/queries/wishes'; +import ModalContainer from '../common/modal/ModalContainer'; +import ShareModal from '../common/modal/share'; + +export default function MainBtn() { + const { progressData } = useGetMainProgressData(); + const progressStatus = progressData?.status; + + const { isOpen, handleToggle } = useModal(); + + const handleMoveWishesPage = () => { + router.push('/wishes'); + }; + + return ( + + {progressStatus ? ( + progressStatus !== 'END' && ( + + ) + ) : ( + + )} + {isOpen && ( + + + + )} + + ); +} + +const Styled = { + ButtonWrapper: styled.div` + margin-top: 7.1rem; + margin: 7.1rem 0 10.4rem; + `, +}; diff --git a/components/main/mainCenterContent.tsx b/components/main/mainCenterContent.tsx new file mode 100644 index 00000000..d01bb6b0 --- /dev/null +++ b/components/main/mainCenterContent.tsx @@ -0,0 +1,107 @@ +import Image from 'next/image'; +import styled from 'styled-components'; +import VerticalProgressBar from '../common/verticalProgressBar'; +import { MainCakeImg, MainChatImg, MainEndChatImg, MainWishChatImg } from '@/public/assets/images'; +import theme from '@/styles/theme'; +import { useGetMainProgressData } from '@/hooks/queries/wishes'; + +export default function MainCenterContent() { + const { progressData } = useGetMainProgressData(); + + const ChatImg = () => { + if (!progressData) { + return MainChatImg; + } + + if (progressData?.status === 'BEFORE' || progressData?.status === 'WHILE') { + return MainWishChatImg; + } + + if (progressData?.status === 'END') { + return MainEndChatImg; + } + }; + + return ( + + + + 말풍선 + + 메인 케이크 이미지 + + + + + + + + {progressData === undefined || progressData.status === 'BEFORE' ? ( + <> + {'모인 케이크\n'} + 총 ???개 + + ) : ( + <> + {'예상 케이크 금액 >\n'} + {`총 ${progressData.price}원`} + + )} + + + ); +} + +const Styled = { + Container: styled.div` + display: flex; + flex-direction: column; + align-items: center; + `, + + ImageWrapper: styled.div` + display: flex; + flex-direction: column; + + width: 100%; + `, + + CakeImageWrapper: styled.div` + display: flex; + justify-content: center; + width: 100%; + margin-top: -1rem; + margin-left: 2rem; + `, + + CenterContentWrapper: styled.div` + display: flex; + justify-content: space-between; + + width: 100%; + + margin-top: 10rem; + padding-right: 2.2rem; + `, + + CakeTextWrapper: styled.div` + text-align: center; + + ${theme.fonts.headline24_130}; + color: ${theme.colors.main_blue}; + + margin-top: -5.8rem; + + white-space: pre-line; + `, + + CakeText: styled.span` + color: ${theme.colors.black}; + `, + + ProgressBarWrapper: styled.div` + display: flex; + + margin-top: 3.4rem; + `, +}; diff --git a/components/main/mainTopContent.tsx b/components/main/mainTopContent.tsx new file mode 100644 index 00000000..03d6474c --- /dev/null +++ b/components/main/mainTopContent.tsx @@ -0,0 +1,106 @@ +import { useGetMainProgressData } from '@/hooks/queries/wishes'; +import { SideBarIc } from '@/public/assets/icons'; +import { LoginUserInfo } from '@/recoil/auth/loginUserInfo'; +import theme from '@/styles/theme'; +import Image from 'next/image'; +import router from 'next/router'; +import { useEffect, useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import styled from 'styled-components'; + +export default function MainTopContent() { + const { progressData } = useGetMainProgressData(); + const loginUserInfo = useRecoilValue(LoginUserInfo); + const [nickName, setNickName] = useState(''); + + const handleMoveToMypage = () => { + router.push('/mypage'); + }; + + const getDayText = () => { + if (!progressData) return 'D-?'; + + if (progressData?.dayCount === 0) { + return 'D-Day'; + } else { + return `D-${progressData?.dayCount}`; + } + }; + + useEffect(() => { + setNickName(loginUserInfo.nickName); + }, [loginUserInfo]); + + return ( + + + {progressData ? ( + progressData.status === 'BEFORE' ? ( + <> + {`${nickName}님\n`} + {`${progressData.dayCount}일 뒤 `} + {`부터 소원링크를\n공유할 수 있어요!`} + + ) : ( + //소원 진행 중 + <> + {`${nickName}님에게\n`} + {`${progressData.cakeCount}개 `} + {`의 조각 케이크가\n도착했어요!`} + + ) + ) : ( + <> + {`${nickName}님\n`} + {'소원 링크 '} + {`를 생성하고\n케이크를 모아봐요!`} + + )} + + + + 설정 + {getDayText()} + + + ); +} + +const Styled = { + Container: styled.header` + display: flex; + justify-content: space-between; + + margin-top: 2rem; + `, + + TextWrapper: styled.div` + ${theme.fonts.headline24_130}; + color: ${theme.colors.black}; + white-space: pre-line; + `, + + Text: styled.span` + color: ${theme.colors.main_blue}; + `, + + RigthSideWrapper: styled.div` + display: flex; + flex-direction: column; + + gap: 2.3rem; + `, + + DayText: styled.span` + ${theme.fonts.headline20}; + color: ${theme.colors.main_blue}; + + &.BEFORE { + color: ${theme.colors.gray2}; + } + + &.END { + color: ${theme.colors.warning_red}; + } + `, +}; From b5b14aa8fb536b0eff80f94682b276629cf08633 Mon Sep 17 00:00:00 2001 From: myeongheonhong Date: Thu, 21 Dec 2023 17:27:37 +0900 Subject: [PATCH 5/7] =?UTF-8?q?[=20chore=20]=20=EB=B3=80=EA=B2=BD=EB=90=9C?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/mypage/EditWishes/index.tsx | 112 +++++++++++++++---------- components/mypage/index.tsx | 30 +++++-- components/wishes/share/index.tsx | 40 +++++---- hooks/wishes/useWisehsStep.ts | 2 +- pages/main/index.tsx | 2 +- pages/mypage/letters/[id]/[cakeId].tsx | 3 +- recoil/formPage/wishesData.ts | 2 +- types/common/input/wishesInput.ts | 5 +- validation/rules.ts | 17 ++-- 9 files changed, 125 insertions(+), 88 deletions(-) diff --git a/components/mypage/EditWishes/index.tsx b/components/mypage/EditWishes/index.tsx index 9dd8ffd5..b00290c3 100644 --- a/components/mypage/EditWishes/index.tsx +++ b/components/mypage/EditWishes/index.tsx @@ -4,55 +4,75 @@ import InputContainer from '@/components/common/input/inputContainer'; import TextareaBox from '@/components/common/input/textareaBox'; import UploadTypeToggleBtn from '@/components/common/uploadTypeToggleBtn'; import ItemLink from '@/components/wishes/wishesForm/itemLink'; -import { WISHES_STATUS } from '@/constant/wishesStatus'; -import useEditWishesInfo from '@/hooks/queries/mypage/useEditWishesInfo'; import { CalendarGreyIc, CalendarIc } from '@/public/assets/icons'; import theme from '@/styles/theme'; import styled from 'styled-components'; import { useEffect, useState } from 'react'; -import { validation } from '@/validation/input'; -import AlertTextBox from '@/components/common/alertTextBox'; import { convertMoneyText } from '@/utils/common/convertMoneyText'; -import UploadGift from '@/components/wishes/wishesForm/UploadGift'; +import UploadPresent from '@/components/wishes/wishesForm/UploadPresent'; import Input from '@/components/common/input/input'; import useUploadItemInfo from '@/hooks/wishes/useUploadItemInfo'; import { useForm } from 'react-hook-form'; -import { BankInfoInputsType, WishesDataInputType } from '@/types/common/input/wishesInput'; +import { WishesDataInputType } from '@/types/common/input/wishesInput'; import BankInput from '@/components/common/modal/BankInput'; +import { + useGetMainProgressData, + useGetWishesProgress, + usePatchWishes, +} from '@/hooks/queries/wishes'; +import SiteList from '@/components/wishes/wishesForm/SiteList'; +import { usePatchUserAccount } from '@/hooks/queries/user'; +import { LIMIT_TEXT } from '@/constant/limitText'; +import { getDate } from '@/utils/common/getDate'; export default function EditWishesContainer() { - const { imageFile, preSignedImageURL, uploadImageFile } = useUploadItemInfo(); + const { imageFile, preSignedImageUrl, uploadImageFile } = useUploadItemInfo(); const [isLinkLoadType, setIsLinkLoadType] = useState(true); //false : 링크 불러오기 true : 직접 - const handleLoadTypeToggle = (state: boolean) => { - setIsLinkLoadType(state); - }; - const methods = useForm({ defaultValues: { linkURL: '', - imageURL: '', - price: 0, + imageUrl: '', + price: '', initial: '', title: '', hint: '', + startDate: new Date(), + endDate: getDate(new Date(), 7), phone: '', - mobileCode: '', name: '', - bankName: '', + bank: '', account: '', }, }); - const bankMethods = useForm({ - defaultValues: { - phone: '', - mobileCode: '', - name: '', - bankName: '', - account: '', - }, - }); + const { wishesProgressData } = useGetWishesProgress(); + const { progressData } = useGetMainProgressData(); + + const { patchUserAccountData } = usePatchUserAccount(methods); + const { patchWishesData } = usePatchWishes(methods); + + useEffect(() => { + if (wishesProgressData) { + methods.setValue('account', wishesProgressData?.accountInfo.account); + methods.setValue('name', wishesProgressData?.accountInfo.name); + methods.setValue('bank', wishesProgressData?.accountInfo.bank); + methods.setValue('phone', wishesProgressData.phone); + + methods.setValue('title', wishesProgressData.title); + methods.setValue('imageUrl', wishesProgressData.imageUrl); + methods.setValue('hint', wishesProgressData.hint); + methods.setValue('price', wishesProgressData.price); + methods.setValue('initial', wishesProgressData.initial); + + methods.setValue('startDate', new Date(wishesProgressData.startDate)); + methods.setValue('endDate', new Date(wishesProgressData.endDate)); + } + }, [wishesProgressData]); + + const handleLoadTypeToggle = (state: boolean) => { + setIsLinkLoadType(state); + }; return ( <> @@ -66,14 +86,15 @@ export default function EditWishesContainer() { /> {isLinkLoadType ? ( - + + ) : ( <> - @@ -85,48 +106,47 @@ export default function EditWishesContainer() { - + - {/* Caledar */} {/* 시작일 */} - - {/* - {/* 종료일 */} - {/* */} + {/* BankInfo */} - + - + - + - */} + ); } const Styled = { + Header: styled.header` + display: flex; + justify-content: space-between; + + width: 100%; + + color: ${theme.colors.main_blue}; + ${theme.fonts.headline20}; + `, + Container: styled.div` display: flex; flex-direction: column; @@ -135,6 +140,15 @@ const Styled = { margin: 2.4rem 0 3rem; `, + HintBox: styled(StyledBox)` + width: 100%; + height: 12.6rem; + + ${theme.fonts.body14}; + + padding: 1.2rem 1rem 1.2rem 1.2rem; + `, + ButtonWrapper: styled.div` padding-bottom: 4.6rem; `, diff --git a/components/wishes/[id].tsx b/components/wishes/[id].tsx index 7b713055..9b801b0f 100644 --- a/components/wishes/[id].tsx +++ b/components/wishes/[id].tsx @@ -1,10 +1,11 @@ import { useEffect, useState } from 'react'; import styled from 'styled-components'; import { useRouter } from 'next/router'; -import { useQuery } from 'react-query'; import Button from '../common/button'; import MainView from '../common/mainView'; import { useGetSingleWishInfo } from '@/hooks/queries/wishes'; +import { getPublicWishes } from '@/api/public'; +import { useGetPublicWishes } from '@/hooks/queries/public'; export default function WishesContainer() { const [wishesId, setWishesId] = useState(''); @@ -15,7 +16,7 @@ export default function WishesContainer() { setWishesId(router.query.id); }, [router.isReady]); - const { wishData } = useGetSingleWishInfo(wishesId); + const { publicWishesData } = useGetPublicWishes(wishesId); const handleMoveToCakes = () => { router.push(`/cakes/${wishesId}`); @@ -27,7 +28,7 @@ export default function WishesContainer() { return ( - + )} {isOpen && ( - - - + + + )} ); diff --git a/pages/cakes/[id].tsx b/pages/cakes/[id].tsx index 1b74a94b..4ed3e746 100644 --- a/pages/cakes/[id].tsx +++ b/pages/cakes/[id].tsx @@ -3,7 +3,7 @@ import Layout from '@/components/layout'; export default function CakesPage() { return ( - + ); diff --git a/types/api/response.ts b/types/api/response.ts index d4f2ed6b..2255da6e 100644 --- a/types/api/response.ts +++ b/types/api/response.ts @@ -16,3 +16,10 @@ export type UserAccountDataResponseType = DefaultResponseType<{ id: number; phone: string | number; }>; + +export type PublicWishesDataResponseType = DefaultResponseType<{ + name: string; + dayCount: number; + title: string; + hint: string; +}>;