From 7c2f5a4639f5b5270dda66c73faaff1045089b00 Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Tue, 16 Jan 2024 16:53:48 +0900 Subject: [PATCH 1/4] =?UTF-8?q?style:=20=EC=97=AC=EC=A0=95=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=EC=A1=B0=ED=9A=8C=20=EB=94=94=EC=9E=90=EC=9D=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MyTrip/MyTrip.tsx | 3 --- src/components/MyTrip/MyTripAfterList.tsx | 4 ++-- src/components/MyTrip/MyTripBeforeList.tsx | 4 ++-- src/components/MyTrip/MyTripIngItem.tsx | 14 ++++++++------ src/components/MyTrip/MyTripItem.tsx | 10 +++++----- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/components/MyTrip/MyTrip.tsx b/src/components/MyTrip/MyTrip.tsx index ae8ed92e..8958338b 100644 --- a/src/components/MyTrip/MyTrip.tsx +++ b/src/components/MyTrip/MyTrip.tsx @@ -31,9 +31,6 @@ const MyTrip = () => { return (
-
-

나의 여정

-
{data.length > 0 ? ( <> diff --git a/src/components/MyTrip/MyTripAfterList.tsx b/src/components/MyTrip/MyTripAfterList.tsx index 543e168d..ec33c2de 100644 --- a/src/components/MyTrip/MyTripAfterList.tsx +++ b/src/components/MyTrip/MyTripAfterList.tsx @@ -19,8 +19,8 @@ const MyTripAfterList: React.FC = ({ myTripsData }) => { return ( <> -
-

지난 여행

+
+

지난 여행

{sortedTrips.map((myTripList: MyTripType) => ( diff --git a/src/components/MyTrip/MyTripBeforeList.tsx b/src/components/MyTrip/MyTripBeforeList.tsx index b5c8c278..e4d27037 100644 --- a/src/components/MyTrip/MyTripBeforeList.tsx +++ b/src/components/MyTrip/MyTripBeforeList.tsx @@ -14,8 +14,8 @@ const MyTripBeforeList: React.FC = ({ myTripsData }) => { return ( <> -
-

다가오는 여행

+
+

다가오는 여행

{myTripsData.map((myTripList: MyTripType) => ( diff --git a/src/components/MyTrip/MyTripIngItem.tsx b/src/components/MyTrip/MyTripIngItem.tsx index 55539e1e..dcac90dd 100644 --- a/src/components/MyTrip/MyTripIngItem.tsx +++ b/src/components/MyTrip/MyTripIngItem.tsx @@ -14,26 +14,28 @@ const MyTripIngItem: React.FC = ({ myTripList }) => { return (
navigate(`/trip/${tripId}`)}>
여행지 이미지
-
- {tripStatus} +
+ + {tripStatus} +
-
+
{tripName}
-
+
{startDate.replace(/-/g, '.')} ~{' '} {endDate.replace(/-/g, '.').split('2024.')} ({tripDuration})
diff --git a/src/components/MyTrip/MyTripItem.tsx b/src/components/MyTrip/MyTripItem.tsx index e4d30dc3..a91a0a2f 100644 --- a/src/components/MyTrip/MyTripItem.tsx +++ b/src/components/MyTrip/MyTripItem.tsx @@ -66,18 +66,18 @@ const MyTripItem: React.FC = ({ myTripList }) => {
-
+
{tripName}
-
- {startDate.replace(/-/g, '.')} ~{' '} +
+ {startDate.replace(/-/g, '.')} -{' '} {endDate.replace(/-/g, '.').split('2024.')} ({tripDuration})
- - {numberOfPeople}명과 공유중 + + {numberOfPeople}명과 공유중
From c38a0cada9eca4ff75eaf0a25fe9fc5365d5f06e Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Tue, 16 Jan 2024 17:31:03 +0900 Subject: [PATCH 2/4] =?UTF-8?q?style:=20=EC=97=AC=EC=A0=95=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=EC=A1=B0=ED=9A=8C=20=EB=94=94=EC=9E=90=EC=9D=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MyTrip/MyTrip.tsx | 3 +++ src/pages/create/createTrip.page.tsx | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/MyTrip/MyTrip.tsx b/src/components/MyTrip/MyTrip.tsx index 8958338b..ae8ed92e 100644 --- a/src/components/MyTrip/MyTrip.tsx +++ b/src/components/MyTrip/MyTrip.tsx @@ -31,6 +31,9 @@ const MyTrip = () => { return (
+
+

나의 여정

+
{data.length > 0 ? ( <> diff --git a/src/pages/create/createTrip.page.tsx b/src/pages/create/createTrip.page.tsx index c9e2b865..a6640f62 100644 --- a/src/pages/create/createTrip.page.tsx +++ b/src/pages/create/createTrip.page.tsx @@ -35,7 +35,7 @@ export const CreateTrip = () => { queryFn: () => getMemberTrips(), }); - const MY_TRIP_NUMBER = data?.data.numberOfElements + 1; + const MY_TRIP_NUMBER = data?.numberOfElements + 1; const defaultTitle = `나의 여정 ${MY_TRIP_NUMBER}`; const handleSubmit = async () => { From 004583ad385bc1f3d2331f40ab083d80f5eaebda Mon Sep 17 00:00:00 2001 From: Hojin Date: Tue, 16 Jan 2024 18:56:47 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Fix:=20=EC=86=8C=EC=BC=93=20api=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=82=AC=ED=95=AD=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@types/socket.types.ts | 5 ++--- src/api/socket.ts | 6 +++--- src/recoil/socket.ts | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/@types/socket.types.ts b/src/@types/socket.types.ts index fc46aa4d..f5cd8f0b 100644 --- a/src/@types/socket.types.ts +++ b/src/@types/socket.types.ts @@ -20,13 +20,13 @@ type subItemMessage = (response: { data: { tripId: number; visitDate: string; + transportation: 'CAR' | 'PUBLIC_TRANSPORTATION'; tripItems: { tripItemId: number; tourItemId: number; name: string; thumbnailUrl: string; category: string; - transportation: string; seqNum: number; visitDate: string; price: number; @@ -40,6 +40,7 @@ type subPathMessage = (response: { data: { tripId: number; visitDate: string; + transportation: 'CAR' | 'PUBLIC_TRANSPORTATION'; paths: { fromTripItemId: number; toTripItemId: number; @@ -49,7 +50,6 @@ type subPathMessage = (response: { fromLatitude: string; toLongitude: string; toLatitude: string; - transportation: 'CAR' | 'PUBLIC_TRANSPORTATION'; pathInfo: { price: number; totalDistance: number; @@ -120,7 +120,6 @@ interface pubUpdateTripItem { } interface pubUpdateTransportation { - tripId: number; visitDate: string; transportation: 'CAR' | 'PUBLIC_TRANSPORTATION'; } diff --git a/src/api/socket.ts b/src/api/socket.ts index bbc41c97..85f61100 100644 --- a/src/api/socket.ts +++ b/src/api/socket.ts @@ -101,13 +101,13 @@ export const pubUpdateTripItem = ( }); }; -// 여행 아이템 방문 교통 수단 변경 이벤트 발생시 +// 여행 날짜별 교통 수단 변경 이벤트 발생시 (01/16 업데이트) export const pubUpdateTransportation = ( pubUpdateTransportation: pubUpdateTransportation, - tripItemId: number, + trips: number, ) => { socketClient.publish({ - destination: `/pub/tripItems/${tripItemId}/updateTransportation`, + destination: `/pub/trips/${trips}/updateTransportation`, body: JSON.stringify(pubUpdateTransportation), }); }; diff --git a/src/recoil/socket.ts b/src/recoil/socket.ts index 89cd5b90..d722c733 100644 --- a/src/recoil/socket.ts +++ b/src/recoil/socket.ts @@ -7,7 +7,7 @@ export const tripIdState = atom({ export const visitDateState = atom<{ visitDate: string } | null>({ key: 'visitDateState', - default: { visitDate: '2024-01-05' }, + default: { visitDate: '2024-01-03' }, }); export const memberIdState = atom<{ memberId: number } | null>({ From 5b8dcbfa117c52ecb615703736cdcdf30acc5c12 Mon Sep 17 00:00:00 2001 From: Hojin Date: Tue, 16 Jan 2024 19:11:19 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Fix:=20=EB=B9=8C=EB=93=9C=EC=97=90=EB=9F=AC?= =?UTF-8?q?=20=ED=95=B4=EA=B2=B0(service.ts,=20socket.types.ts=20=EB=8F=99?= =?UTF-8?q?=EA=B8=B0=ED=99=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@types/service.ts | 39 ++++++++++++++++++----------- src/components/Plan/PlanItemBox.tsx | 4 +++ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/@types/service.ts b/src/@types/service.ts index 9651b8f2..0b2ae10e 100644 --- a/src/@types/service.ts +++ b/src/@types/service.ts @@ -20,36 +20,36 @@ export type subItemRes = { data: { tripId: number; visitDate: string; - tripItems: TripItem[]; + transportation: 'CAR' | 'PUBLIC_TRANSPORTATION'; + tripItems: { + tripItemId: number; + tourItemId: number; + name: string; + thumbnailUrl: string; + category: string; + seqNum: number; + visitDate: string; + price: number; + }[]; } | null; }; -export type TripItem = { - tripItemId: number; - tourItemId: number; - name: string; - thumbnailUrl: string; - category: string; - transportation: string; - seqNum: number; - visitDate: string; - price: number; -}; - export type subPathRes = { status: number; message: string; data: { tripId: number; visitDate: string; + transportation: 'CAR' | 'PUBLIC_TRANSPORTATION'; paths: { + fromTripItemId: number; + toTripItemId: number; fromSeqNum: number; toSeqNum: number; fromLongitude: string; fromLatitude: string; toLongitude: string; toLatitude: string; - transportation: string; pathInfo: { price: number; totalDistance: number; @@ -95,3 +95,14 @@ export type SocketContextType = { tripBudget: subBudgetRes | null; callBackPub: (callback: () => void) => void; }; + +export type TripItem = { + tripItemId: number; + tourItemId: number; + name: string; + thumbnailUrl: string; + category: string; + seqNum: number; + visitDate: string; + price: number; +} | null; diff --git a/src/components/Plan/PlanItemBox.tsx b/src/components/Plan/PlanItemBox.tsx index d0f8e1cf..f55b6b26 100644 --- a/src/components/Plan/PlanItemBox.tsx +++ b/src/components/Plan/PlanItemBox.tsx @@ -6,6 +6,10 @@ type PlanItemBoxProps = { }; const PlanItemBox = ({ item }: PlanItemBoxProps) => { + if (!item) { + return
error...
; + } + return ( <>