From 0f3e4f45d3385826aee79bf121f9bce074906b03 Mon Sep 17 00:00:00 2001 From: juyeon-park Date: Fri, 1 Dec 2023 14:44:15 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20=EA=B1=B0=EB=9E=98=EC=84=B1=EC=82=AC?= =?UTF-8?q?=EB=90=9C=20=EB=AC=BC=EA=B1=B4=20=EC=83=81=EC=84=B8=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=95=88=EB=90=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(home)/components/HistorySection.tsx | 20 +++++++++---- .../description-section/MoreButton.tsx | 11 +++++--- .../components/trade-section/SuggestList.tsx | 28 +++++++++---------- .../components/trade-section/TradeSection.tsx | 11 +++++--- .../cards/new/components/PokeAvailable.tsx | 2 +- .../components/CompleteRequestButton.tsx | 4 ++- .../MyCardDescriptionSection.tsx | 15 ++-------- src/app/loading.tsx | 4 +-- .../TradeCompleteBadge.tsx | 2 +- src/constants/card.ts | 1 + 10 files changed, 51 insertions(+), 47 deletions(-) diff --git a/src/app/(root)/(routes)/(home)/components/HistorySection.tsx b/src/app/(root)/(routes)/(home)/components/HistorySection.tsx index 7c07f51c..f6792d62 100644 --- a/src/app/(root)/(routes)/(home)/components/HistorySection.tsx +++ b/src/app/(root)/(routes)/(home)/components/HistorySection.tsx @@ -1,12 +1,20 @@ -'use client' - import HistoryCard from '@/components/domain/card/trade-history-card' -import useRecentHistoryQuery from '@/hooks/api/queries/useRecentHistoryQuery' +import { RECENT_HISTORY_SIZE } from '@/constants/pageSize' +import { getRecentTradeHistoryList } from '@/services/history/history' import { TradeHistory } from '@/types/tradeHistory' -const HistorySection = () => { - const { data: historyData } = useRecentHistoryQuery() - const historyList = historyData?.data.historyList ?? [] +async function getRecentHistory() { + try { + const res = await getRecentTradeHistoryList(RECENT_HISTORY_SIZE) + const data = await res + return data.data.historyList + } catch (error: any) { + throw new Error(error) + } +} + +const HistorySection = async () => { + const historyList = await getRecentHistory() return ( historyList.length !== 0 && ( diff --git a/src/app/(root)/(routes)/cards/[cardId]/components/description-section/MoreButton.tsx b/src/app/(root)/(routes)/cards/[cardId]/components/description-section/MoreButton.tsx index ebef673a..8b6864ca 100644 --- a/src/app/(root)/(routes)/cards/[cardId]/components/description-section/MoreButton.tsx +++ b/src/app/(root)/(routes)/cards/[cardId]/components/description-section/MoreButton.tsx @@ -70,12 +70,15 @@ const MoreButton = ({ cardId, status }: MoreButtonProps) => { mutate({ cardId, status }) } + const isCardCompleted = status === 'TRADE_COMPLETE' return ( - + {!isCardCompleted && ( + + )} @@ -90,7 +93,7 @@ const MoreButton = ({ cardId, status }: MoreButtonProps) => { handleChangeStatus(cardStatusMap[status].statusToChange) } > - {cardStatusMap[status].text} + {cardStatusMap[status]?.text} diff --git a/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/SuggestList.tsx b/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/SuggestList.tsx index 9e1b5cfb..a33cbc8f 100644 --- a/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/SuggestList.tsx +++ b/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/SuggestList.tsx @@ -53,21 +53,19 @@ const SuggestList = ({ pokeAvailable, toCardId }: SuggestListProps) => { 오퍼하기 찔러보기 - }> - {['OFFER', 'POKE'].map((type) => ( - - {!pokeAvailable && type === 'POKE' ? ( - - ) : ( - filterData(type) - )} - - ))} - + {['OFFER', 'POKE'].map((type) => ( + + {!pokeAvailable && type === 'POKE' ? ( + + ) : ( + filterData(type) + )} + + ))} ) } diff --git a/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/TradeSection.tsx b/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/TradeSection.tsx index fb346be4..a66bdd70 100644 --- a/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/TradeSection.tsx +++ b/src/app/(root)/(routes)/cards/[cardId]/components/trade-section/TradeSection.tsx @@ -1,8 +1,9 @@ 'use client' -import { useState } from 'react' +import { Suspense, useState } from 'react' import { StaticImageData } from 'next/image' import { useRouter } from 'next/navigation' +import Loading from '@/app/loading' import Button from '@/components/ui/button' import { Dialog, @@ -100,11 +101,13 @@ const TradeSection = ({ )} - - + + 제안 가능한 내 물건 보기 - + }> + + diff --git a/src/app/(root)/(routes)/cards/new/components/PokeAvailable.tsx b/src/app/(root)/(routes)/cards/new/components/PokeAvailable.tsx index 146ca01f..adf6964d 100644 --- a/src/app/(root)/(routes)/cards/new/components/PokeAvailable.tsx +++ b/src/app/(root)/(routes)/cards/new/components/PokeAvailable.tsx @@ -32,7 +32,7 @@ const PokeAvailable = ({ - 등록할 상품보다 낮은 금액의 상품 거래 제안을 허용합니다. + 등록할 물건보다 낮은 금액의 물건 거래 제안을 허용합니다. - + {cardTitle} @@ -78,15 +73,9 @@ const MyCardDescriptionSection = ({ 거래지역 - {tradeArea} + {tradeArea === '' ? '미입력' : tradeArea} - {/* - {formatDistanceToNow(new Date(createdAt), { - addSuffix: true, - locale: koLocale, - })} - */} diff --git a/src/app/loading.tsx b/src/app/loading.tsx index a1c7446a..f4196af2 100644 --- a/src/app/loading.tsx +++ b/src/app/loading.tsx @@ -5,8 +5,8 @@ import lottieJson from '../../public/loading.json' const Loading = () => { return ( -
-
+
+
( - 거래완료 + 거래성사 ) export default TradeCompleteBadge diff --git a/src/constants/card.ts b/src/constants/card.ts index ece3a3e7..9851ab8e 100644 --- a/src/constants/card.ts +++ b/src/constants/card.ts @@ -100,6 +100,7 @@ const COMPLETE_REQUEST_TYPE_OBJS = [ { key: 'WAITING', value: '거래성사 대기중' }, { key: 'ACCEPTED', value: '거래성사 확정' }, { key: 'REFUSED', value: '거래성사 거절됨' }, + { key: 'DELETED', value: '거래상대의 물건이 삭제되었습니다' }, ] export {