From 09ce832e8e34fdba8014cacd5d945c5a8667a174 Mon Sep 17 00:00:00 2001 From: Hojin Date: Mon, 22 Jan 2024 00:33:17 +0900 Subject: [PATCH 01/52] =?UTF-8?q?Feat:=20=EC=83=81=ED=92=88=EA=B0=80?= =?UTF-8?q?=EA=B2=A9=20=EC=88=98=EC=A0=95=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@types/socket.types.ts | 2 +- src/api/socket.ts | 2 +- src/components/Plan/PlanEditItemBox.tsx | 14 +++--- src/components/Plan/PlanItem.tsx | 1 + src/components/Plan/PlanItemBox.tsx | 66 ++++++++++++++++++++++++- src/hooks/useSocket.ts | 2 + 6 files changed, 77 insertions(+), 10 deletions(-) diff --git a/src/@types/socket.types.ts b/src/@types/socket.types.ts index 49244096..a8167cc8 100644 --- a/src/@types/socket.types.ts +++ b/src/@types/socket.types.ts @@ -100,7 +100,7 @@ interface pubAddTripItem { interface pubUpdatePrice { tripId: string; visitDate: string; - price: number; + price: string; } interface pubUpdateTripItem { diff --git a/src/api/socket.ts b/src/api/socket.ts index 0ade3027..8a32b63f 100644 --- a/src/api/socket.ts +++ b/src/api/socket.ts @@ -84,7 +84,7 @@ export const pubAddTripItem = ( // 여행 아이템 예상 가격 업데이트 이벤트 발생시 export const pubUpdatePrice = ( pubUpdatePrice: pubUpdatePrice, - tripItemId: string, + tripItemId: number, ) => { socketClient.publish({ destination: `/pub/tripItems/${tripItemId}/updatePrice`, diff --git a/src/components/Plan/PlanEditItemBox.tsx b/src/components/Plan/PlanEditItemBox.tsx index 4c5ce80d..6919d327 100644 --- a/src/components/Plan/PlanEditItemBox.tsx +++ b/src/components/Plan/PlanEditItemBox.tsx @@ -1,4 +1,4 @@ -import { PenIcon, DragAndDropIcon } from '@components/common/icons/Icons'; +import { DragAndDropIcon } from '@components/common/icons/Icons'; import { TripItem } from '@/@types/service'; import { DragDropContext, @@ -71,9 +71,10 @@ const PlanEditItemBox = ({ const handleConfirm = () => { if (tripId && visitDate && selectedItemId) { - callBackPub(() => - pubDeleteItem({ tripId: tripId, visitDate: visitDate }, selectedItemId), - ); + pubDeleteItem({ tripId: tripId, visitDate: visitDate }, selectedItemId); + // callBackPub(() => + // pubDeleteItem({ tripId: tripId, visitDate: visitDate }, selectedItemId), + // ); } setToastPopUp(() => ({ isPopUp: true, @@ -139,9 +140,8 @@ const PlanEditItemBox = ({ alt="img" />
-
+
{item.name} -
{item.category} @@ -166,7 +166,7 @@ const PlanEditItemBox = ({ )} -
+
= ({ date, day }) => { item={tripItem?.data?.tripItems || []} paths={tripPath?.data?.paths || []} transportation={transpo} + visitDate={date || ''} day={day} /> )} diff --git a/src/components/Plan/PlanItemBox.tsx b/src/components/Plan/PlanItemBox.tsx index d54a922c..7e26250c 100644 --- a/src/components/Plan/PlanItemBox.tsx +++ b/src/components/Plan/PlanItemBox.tsx @@ -3,15 +3,22 @@ import { CarIcon, BusIcon, SequenceIcon, + CloseIcon, } from '@components/common/icons/Icons'; import { TripItem, Paths } from '@/@types/service'; import { v4 as uuidv4 } from 'uuid'; +import { useGetTripsAuthority } from '@hooks/useGetTripsAuthority'; +import Alert from '@components/common/alert/Alert'; +import { useContext, useState } from 'react'; +import { socketContext } from '@hooks/useSocket'; +import { pubUpdatePrice } from '@api/socket'; type PlanItemBoxProps = { item: TripItem[]; paths: Paths[]; transportation: string; day: string; + visitDate: string; }; const PlanItemBox = ({ @@ -19,12 +26,32 @@ const PlanItemBox = ({ paths, transportation, day, + visitDate, }: PlanItemBoxProps) => { if (!item || !paths) { return
Missing data
; } + const { tripAuthority } = useGetTripsAuthority(); + const { tripId } = useContext(socketContext); + const itemLength = item.length; + const [inputPrice, setInputPrice] = useState(''); + const showCloseIcon = inputPrice; + + const handlePrice = (inputBudget: string, tripItemId: number) => { + if (inputBudget && tripItemId) { + pubUpdatePrice( + { + tripId: tripId, + visitDate: visitDate, + price: inputBudget, + }, + tripItemId, + ); + setInputPrice(''); + } + }; return ( <> @@ -50,7 +77,44 @@ const PlanItemBox = ({
{item.name} - + {tripAuthority == 'WRITE' && ( + + handlePrice(inputPrice, item.tripItemId) + } + closeOnConfirm={true} + children={ + + } + content={ +
+
+ setInputPrice(e.target.value)} + /> +
setInputPrice('')}> + {showCloseIcon && ( + + )} +
+
+ + 원 + +
+ } + /> + )}
{item.category} diff --git a/src/hooks/useSocket.ts b/src/hooks/useSocket.ts index d0eeef0f..eb9b0520 100644 --- a/src/hooks/useSocket.ts +++ b/src/hooks/useSocket.ts @@ -92,9 +92,11 @@ export const useSocket = () => { if (tripId && visitDate) { socketConnect(tripId, visitDate.visitDate); } + console.log('소켓연결'); return () => { socketClient.deactivate(); + console.log('소켓해제'); }; }, [tripId, visitDate, socketCallback]); From 6c06d4e620029caae9fb559d40605ad5d725d921 Mon Sep 17 00:00:00 2001 From: Hojin Date: Mon, 22 Jan 2024 01:15:57 +0900 Subject: [PATCH 02/52] =?UTF-8?q?Refactor:=20=EC=97=AC=EC=A0=95=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=ED=85=9C=20=EB=AC=B8=EC=9E=90=EC=97=B4=20?= =?UTF-8?q?=EB=84=98=EC=B9=A8=EB=B0=A9=EC=A7=80=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/socket.ts | 4 ++-- src/components/Plan/PlanEditItemBox.tsx | 11 ++++++----- src/components/Plan/PlanItemBox.tsx | 4 +++- src/components/Plan/TripBudget.tsx | 14 ++++++++------ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/api/socket.ts b/src/api/socket.ts index 8a32b63f..c5c437b4 100644 --- a/src/api/socket.ts +++ b/src/api/socket.ts @@ -106,10 +106,10 @@ export const pubUpdateTripItem = ( // 여행 날짜별 교통 수단 변경 이벤트 발생시 (01/16 업데이트) export const pubUpdateTransportation = ( pubUpdateTransportation: pubUpdateTransportation, - trips: string, + tripId: string, ) => { socketClient.publish({ - destination: `/pub/trips/${trips}/updateTransportation`, + destination: `/pub/trips/${tripId}/updateTransportation`, body: JSON.stringify(pubUpdateTransportation), }); }; diff --git a/src/components/Plan/PlanEditItemBox.tsx b/src/components/Plan/PlanEditItemBox.tsx index 6919d327..1e1a6fec 100644 --- a/src/components/Plan/PlanEditItemBox.tsx +++ b/src/components/Plan/PlanEditItemBox.tsx @@ -71,10 +71,9 @@ const PlanEditItemBox = ({ const handleConfirm = () => { if (tripId && visitDate && selectedItemId) { - pubDeleteItem({ tripId: tripId, visitDate: visitDate }, selectedItemId); - // callBackPub(() => - // pubDeleteItem({ tripId: tripId, visitDate: visitDate }, selectedItemId), - // ); + callBackPub(() => + pubDeleteItem({ tripId: tripId, visitDate: visitDate }, selectedItemId), + ); } setToastPopUp(() => ({ isPopUp: true, @@ -141,7 +140,9 @@ const PlanEditItemBox = ({ />
- {item.name} + {item.name.length > 17 + ? item.name.slice(0, 17) + '...' + : item.name}
{item.category} diff --git a/src/components/Plan/PlanItemBox.tsx b/src/components/Plan/PlanItemBox.tsx index 7e26250c..40146f9a 100644 --- a/src/components/Plan/PlanItemBox.tsx +++ b/src/components/Plan/PlanItemBox.tsx @@ -76,7 +76,9 @@ const PlanItemBox = ({ />
- {item.name} + {item.name.length > 19 + ? item.name.slice(0, 19) + '...' + : item.name} {tripAuthority == 'WRITE' && ( { const { tripAuthority } = useGetTripsAuthority(); - const { tripBudget, tripId } = useContext(socketContext); + const { callBackPub, tripBudget, tripId } = useContext(socketContext); const budget = tripBudget?.data; @@ -28,11 +28,13 @@ const TripBudget = () => { const handleSetTargetBudget = (inputBudget: string) => { const newTargetBudget = parseInt(inputBudget, 10); // 문자열 숫자로 변환 if (!isNaN(newTargetBudget) && newTargetBudget !== budget?.budget) { - pubUpdateBudget( - { - budget: newTargetBudget, - }, - tripId || '', + callBackPub(() => + pubUpdateBudget( + { + budget: newTargetBudget, + }, + tripId || '', + ), ); setInputBudget(''); } From 7a9352f46421038b3f6c86530b2b8f60bfb85157 Mon Sep 17 00:00:00 2001 From: Hojin Date: Mon, 22 Jan 2024 10:28:55 +0900 Subject: [PATCH 03/52] =?UTF-8?q?Feat:=20=EB=82=B4=20=EC=97=AC=ED=96=89?= =?UTF-8?q?=EC=B7=A8=ED=96=A5=20=EC=84=A4=EC=A0=95=ED=95=98=EB=9F=AC?= =?UTF-8?q?=EA=B0=80=EA=B8=B0=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Plan/PlanItemBox.tsx | 2 +- src/components/Trip/TripPreference.tsx | 13 ++++++++++++- src/pages/mypage/editUserSurvey.page.tsx | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/Plan/PlanItemBox.tsx b/src/components/Plan/PlanItemBox.tsx index 40146f9a..4ea6b619 100644 --- a/src/components/Plan/PlanItemBox.tsx +++ b/src/components/Plan/PlanItemBox.tsx @@ -70,7 +70,7 @@ const PlanItemBox = ({
img diff --git a/src/components/Trip/TripPreference.tsx b/src/components/Trip/TripPreference.tsx index 432c72f2..51570d26 100644 --- a/src/components/Trip/TripPreference.tsx +++ b/src/components/Trip/TripPreference.tsx @@ -11,6 +11,7 @@ import { getTripsSurveyMembers } from '@api/trips'; import { useSetRecoilState, useRecoilState } from 'recoil'; import { participantsState } from '@recoil/trip'; import { useGetTripsAuthority } from '@hooks/useGetTripsAuthority'; +import { useNavigate } from 'react-router-dom'; interface RatioBarParams { value: number; @@ -27,8 +28,18 @@ interface PercentageParams { } const TripPreferenceButton: React.FC = () => { + const { tripAuthority } = useGetTripsAuthority(); + const navigate = useNavigate(); + const handleTrip = () => { + if (tripAuthority === 'WRITE') { + navigate('/mypage/survey'); + } + }; + return ( -
- {item.price} 원 + {item.price.toLocaleString()} 원
From f2500015d2cc9976e9225787926ba5a382767a34 Mon Sep 17 00:00:00 2001 From: sue Date: Mon, 22 Jan 2024 11:33:34 +0900 Subject: [PATCH 07/52] =?UTF-8?q?Fix:=20=EC=97=AC=EC=A0=95=EC=9E=A5?= =?UTF-8?q?=EC=86=8C=20=EC=97=86=EC=9D=84=20=EB=95=8C=20default=20?= =?UTF-8?q?=EC=A7=80=EB=8F=84=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Plan/TripMap.tsx | 71 +++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/src/components/Plan/TripMap.tsx b/src/components/Plan/TripMap.tsx index 94dac763..60b40607 100644 --- a/src/components/Plan/TripMap.tsx +++ b/src/components/Plan/TripMap.tsx @@ -6,12 +6,16 @@ import { getColor } from '@utils/getColor'; const VITE_KAKAO_MAP_API_KEY = import.meta.env.VITE_KAKAO_MAP_API_KEY; const TripMap = ({ paths }: { paths: Paths[] }) => { + const DEFAULT_LATITUDE = 36.34; + const DEFAULT_LONGITUDE = 127.77; + const firstPath = paths[0]; - const latitude = firstPath?.fromLatitude; - const longitude = firstPath?.fromLongitude; + const latitude = firstPath ? firstPath.fromLatitude : DEFAULT_LATITUDE; + const longitude = firstPath ? firstPath.fromLongitude : DEFAULT_LONGITUDE; const mapRef = useRef(null); const [selectedMarker, setSelectedMarker] = useState(null); + const [maplevel, setMapLevel] = useState(4); const defaultPosition = { lat: Number(latitude), lng: Number(longitude) }; @@ -84,7 +88,13 @@ const TripMap = ({ paths }: { paths: Paths[] }) => { }; useEffect(() => { - setBounds(); + if (paths.length > 0) { + setTimeout(() => { + setBounds(); + }, 100); + } else { + setMapLevel(15); + } }, [paths]); // 마커를 클릭할 때 호출되는 함수 @@ -186,39 +196,40 @@ const TripMap = ({ paths }: { paths: Paths[] }) => { key={VITE_KAKAO_MAP_API_KEY} center={centerPosition} style={MapStyle} - level={4} + level={maplevel} className="relative object-fill" ref={mapRef}> - {paths.map((path, index) => ( -
- handleMarkerClick(path.toSeqNum)} - image={getSequenceIconUrl(path.toSeqNum - 1)} - /> - {/* 마지막 항목인 경우, 목적지 위치에 마커 추가 */} - {index === paths.length - 1 && ( + {paths.length !== 0 && + paths.map((path, index) => ( +
handleMarkerClick(path.toSeqNum + 1)} - image={getSequenceIconUrl(path.toSeqNum)} + onClick={() => handleMarkerClick(path.toSeqNum)} + image={getSequenceIconUrl(path.toSeqNum - 1)} /> - )} - -
- ))} + {/* 마지막 항목인 경우, 목적지 위치에 마커 추가 */} + {index === paths.length - 1 && ( + handleMarkerClick(path.toSeqNum + 1)} + image={getSequenceIconUrl(path.toSeqNum)} + /> + )} + +
+ ))}
); From e9612e91186a56b97cfb697de5cae48dd7e0048a Mon Sep 17 00:00:00 2001 From: sue Date: Mon, 22 Jan 2024 11:40:41 +0900 Subject: [PATCH 08/52] =?UTF-8?q?Design:=20=EA=B3=84=ED=9A=8D=EC=8A=A4?= =?UTF-8?q?=EC=BC=80=EC=A4=84=20=EB=82=A0=EC=A7=9C=20=EB=B3=80=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Plan/PlanSchedule.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Plan/PlanSchedule.tsx b/src/components/Plan/PlanSchedule.tsx index 4e96dc4f..2571a865 100644 --- a/src/components/Plan/PlanSchedule.tsx +++ b/src/components/Plan/PlanSchedule.tsx @@ -20,7 +20,8 @@ const PlanSchedule = () => {
- {trip?.startDate} ~ {trip?.endDate} + {trip?.startDate?.substring(2).replace(/-/g, '.') || ''} -{' '} + {trip?.endDate?.substring(5).replace(/-/g, '.') || ''}
); From caf099228f2e130e2d130eeee5e18cf35124dc8a Mon Sep 17 00:00:00 2001 From: sue Date: Mon, 22 Jan 2024 11:49:41 +0900 Subject: [PATCH 09/52] =?UTF-8?q?Design:=20=EC=97=AC=EC=A0=95=ED=8E=B8?= =?UTF-8?q?=EC=A7=91=20=EB=AA=A8=EB=8B=AC=20width=20=EC=9E=AC=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Trip/EditCodeModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Trip/EditCodeModal.tsx b/src/components/Trip/EditCodeModal.tsx index 7d3ca648..372d5b89 100644 --- a/src/components/Trip/EditCodeModal.tsx +++ b/src/components/Trip/EditCodeModal.tsx @@ -69,7 +69,7 @@ const EditCodeModal = () => { {isEditModal && ( - + 나의 여정 From 0a54823eed868149c2d131a6042b0dfec5664340 Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Mon, 22 Jan 2024 11:51:36 +0900 Subject: [PATCH 10/52] =?UTF-8?q?Style:=20=EC=98=A4=ED=83=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/authSelectOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/authSelectOptions.ts b/src/utils/authSelectOptions.ts index 0e544aa7..d16d0a59 100644 --- a/src/utils/authSelectOptions.ts +++ b/src/utils/authSelectOptions.ts @@ -10,6 +10,6 @@ export const ageArr: SelectOption[] = [ { id: 'TEENAGER', value: '10대' }, { id: 'TWENTIES', value: '20대' }, { id: 'THIRTIES', value: '30대' }, - { id: 'FOURTIES', value: '40대' }, + { id: 'FORTIES', value: '40대' }, { id: 'ABOVE_FIFTIES', value: '50대 이상' }, ]; From 48f8ca1996749d77e3b097d226be4a7ec738a6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=96=B4=EC=8A=B9=EC=A4=80?= Date: Mon, 22 Jan 2024 12:06:24 +0900 Subject: [PATCH 11/52] =?UTF-8?q?Fix:=20=EC=97=AC=ED=96=89=EC=B7=A8?= =?UTF-8?q?=ED=96=A5=20=EB=94=94=ED=8F=B4=ED=8A=B8=20=EB=94=94=EC=9E=90?= =?UTF-8?q?=EC=9D=B8=20=EA=B5=AC=ED=98=84=20=EB=B0=8F=20=EB=94=94=EB=B2=84?= =?UTF-8?q?=EA=B9=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Plan/PlanSectionTop.tsx | 4 +- src/components/Trip/TripPreference.tsx | 68 ++++++++++++------- ...ltimeEditor.tsx => TripRealtimeMember.tsx} | 4 +- src/components/common/tab/Tab.tsx | 4 +- src/utils/calculatePercentage.ts | 9 ++- 5 files changed, 57 insertions(+), 32 deletions(-) rename src/components/Trip/{TripRealtimeEditor.tsx => TripRealtimeMember.tsx} (96%) diff --git a/src/components/Plan/PlanSectionTop.tsx b/src/components/Plan/PlanSectionTop.tsx index 480ec571..fada423c 100644 --- a/src/components/Plan/PlanSectionTop.tsx +++ b/src/components/Plan/PlanSectionTop.tsx @@ -1,4 +1,4 @@ -import TripRealtimeEditor from '@components/Trip/TripRealtimeEditor'; +import TripRealtimeMember from '@components/Trip/TripRealtimeMember'; import { BackBox } from '@components/common'; import { useNavigate } from 'react-router-dom'; import TripBudget from './TripBudget'; @@ -92,7 +92,7 @@ const PlanSectionTop = () => { navigate(`/trip/${tripId}/share`); }} /> - + { + const navigate = useNavigate(); + + const handleClickButton = () => { + navigate('/signup/survey'); + }; + return ( - )} - + diff --git a/src/components/Trip/EditCodeModal.tsx b/src/components/Trip/EditCodeModal.tsx index 7d3ca648..d87b54df 100644 --- a/src/components/Trip/EditCodeModal.tsx +++ b/src/components/Trip/EditCodeModal.tsx @@ -59,7 +59,7 @@ const EditCodeModal = () => { {isToastVisible && } {tripAuthority === 'WRITE' ? ( - + From 83667472ceca8d260a492be451029f8527e6c5fc Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Mon, 22 Jan 2024 12:27:53 +0900 Subject: [PATCH 14/52] =?UTF-8?q?Fix:=20jsx=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/icons/Icons.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/common/icons/Icons.tsx b/src/components/common/icons/Icons.tsx index 6704db50..c096458d 100644 --- a/src/components/common/icons/Icons.tsx +++ b/src/components/common/icons/Icons.tsx @@ -1583,15 +1583,15 @@ export const EditStarIcon = () => { id="Vector 868" d="M22.1255 40.0781H42.1255" stroke="#8DA3B8" - stroke-width="3" - stroke-linecap="round" + strokeWidth="3" + strokeLinecap="round" /> = ({}) => { ); }; - - From 1354cbc50556824a77006389449650230e2e873e Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Mon, 22 Jan 2024 12:28:08 +0900 Subject: [PATCH 15/52] =?UTF-8?q?Style:=20=EC=98=A4=ED=83=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@types/member.types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@types/member.types.ts b/src/@types/member.types.ts index 3b8146ac..2a6f4767 100644 --- a/src/@types/member.types.ts +++ b/src/@types/member.types.ts @@ -18,7 +18,7 @@ interface MemberInfo { // | 'TEENAGER' // | 'TWENTIES' // | 'THIRTIES' - // | 'FOURTIES' + // | 'FORTIES' // | 'ABOVE_FIFTIES' // | 'DEFATULT' genderType: string | null; From ff7809aa1cfd51094973b80191d75da8860ed49a Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Mon, 22 Jan 2024 13:15:59 +0900 Subject: [PATCH 16/52] =?UTF-8?q?Refactor:=20=EB=B9=84=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EC=9C=A0=EC=A0=80=20=ED=8E=B8=EC=A7=91=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EB=AA=A8=EB=8B=AC=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Trip/EditCodeModal.tsx | 120 +++++++++++++++----------- 1 file changed, 72 insertions(+), 48 deletions(-) diff --git a/src/components/Trip/EditCodeModal.tsx b/src/components/Trip/EditCodeModal.tsx index d87b54df..ee7c964a 100644 --- a/src/components/Trip/EditCodeModal.tsx +++ b/src/components/Trip/EditCodeModal.tsx @@ -3,11 +3,12 @@ import CodeInput from '@components/Share/CodeInput'; import Alert from '@components/common/alert/Alert'; import { useGetTripsAuthority } from '@hooks/useGetTripsAuthority'; import { useState } from 'react'; -import { useNavigate, useParams } from 'react-router-dom'; +import { useLocation, useNavigate, useParams } from 'react-router-dom'; import * as Dialog from '@radix-ui/react-dialog'; import { DeleteIcon, PenIcon } from '@components/common/icons/Icons'; import { useMutation, useQueryClient } from '@tanstack/react-query'; import ToastPopUp from '@components/common/toastpopup/ToastPopUp'; +import { getItem } from '@utils/localStorageFun'; const EditCodeModal = () => { const navigate = useNavigate(); @@ -54,61 +55,84 @@ const EditCodeModal = () => { } }; + const isLogin = getItem('accessToken'); + const { pathname } = useLocation(); + const handleLoginConfirm = () => { + navigate('/login', { state: { prevPath: `${pathname}/code` } }); + }; + return ( <> {isToastVisible && } - {tripAuthority === 'WRITE' ? ( - - - - - {isEditModal && ( - - - - - 나의 여정 - + {isLogin ? ( + tripAuthority === 'WRITE' ? ( + + + + + {isEditModal && ( + + + + + 나의 여정 + - <> - - - - - - - - )} - + + + + + + + )} + + ) : ( + + } + isOpen={isModalOpen} + setIsOpen={setIsModalOpen} + onConfirm={handleConfirm}> + + + ) ) : ( + title={'로그인'} + message={ + <> + 편집 참여 코드 입력을 위해 로그인이 필요해요. +
+ 로그인하시겠어요? + } - isOpen={isModalOpen} - setIsOpen={setIsModalOpen} - onConfirm={handleConfirm}> + onConfirm={handleLoginConfirm}> From 0fb24e8c4ee42c28a6771d1bdecebf661dd4e620 Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Mon, 22 Jan 2024 15:07:03 +0900 Subject: [PATCH 17/52] =?UTF-8?q?Refactor:=20=EC=97=AC=EC=A0=95=20?= =?UTF-8?q?=ED=8E=B8=EC=A7=91=20=EC=83=81=ED=83=9C=20=ED=8C=90=EB=8B=A8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Trip/TripSectionTop.tsx | 2 ++ src/hooks/useGetTripsAuthority.ts | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Trip/TripSectionTop.tsx b/src/components/Trip/TripSectionTop.tsx index d1388108..730f3a65 100644 --- a/src/components/Trip/TripSectionTop.tsx +++ b/src/components/Trip/TripSectionTop.tsx @@ -18,6 +18,8 @@ const TripSectionTop = () => { if (tripAuthority !== null) { if (tripAuthority !== 'WRITE') { setIsEditable(true); + } else { + setIsEditable(false); } } }, [tripAuthority]); diff --git a/src/hooks/useGetTripsAuthority.ts b/src/hooks/useGetTripsAuthority.ts index 2db402cc..5eecf742 100644 --- a/src/hooks/useGetTripsAuthority.ts +++ b/src/hooks/useGetTripsAuthority.ts @@ -24,7 +24,6 @@ export const useGetTripsAuthority = (): useGetTripsAuthorityReturn => { queryKey: ['getTripsAuthority', id], queryFn: () => getTripsAuthority(id), enabled: !!id, - staleTime: 60000, }); const tripAuthority = data?.data.data.tripAuthority; From 5e358356edf83add6dd137b6bd924756462f8f57 Mon Sep 17 00:00:00 2001 From: Shim Jeong ah <35457850+joanShim@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:37:02 +0900 Subject: [PATCH 18/52] =?UTF-8?q?Fix:=20input=20=EB=B0=96=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20clear=EB=B2=84=ED=8A=BC=20=ED=8A=80=EC=96=B4?= =?UTF-8?q?=EB=82=98=EA=B0=80=EB=8A=94=20=EC=97=90=EB=9F=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/create/createTrip.page.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/create/createTrip.page.tsx b/src/pages/create/createTrip.page.tsx index ca568ca8..18b3cb9f 100644 --- a/src/pages/create/createTrip.page.tsx +++ b/src/pages/create/createTrip.page.tsx @@ -95,7 +95,8 @@ export const CreateTrip = () => { { From f4391d2b98572cb88a4eacbf775997c91c126e94 Mon Sep 17 00:00:00 2001 From: sue Date: Mon, 22 Jan 2024 16:38:55 +0900 Subject: [PATCH 19/52] =?UTF-8?q?Fix:=20=EB=B9=84=EC=9A=A9=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=AA=A8=EB=8B=AC=20input=20width=20=EC=9E=AC?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Plan/TripBudget.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Plan/TripBudget.tsx b/src/components/Plan/TripBudget.tsx index 8e77bccc..ff23134f 100644 --- a/src/components/Plan/TripBudget.tsx +++ b/src/components/Plan/TripBudget.tsx @@ -117,7 +117,7 @@ const TripBudget = () => {
setInputBudget(e.target.value)} From 1071cf2134edf3870ca9d66ee36057e83da77ae9 Mon Sep 17 00:00:00 2001 From: sue Date: Mon, 22 Jan 2024 16:48:12 +0900 Subject: [PATCH 20/52] =?UTF-8?q?Design:=20Tab=20=EB=A6=AC=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20x-scroll=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/tab/Tab.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/tab/Tab.tsx b/src/components/common/tab/Tab.tsx index 3109b337..c75d14f2 100644 --- a/src/components/common/tab/Tab.tsx +++ b/src/components/common/tab/Tab.tsx @@ -29,7 +29,7 @@ const Tab = ({ lists, contents }: TabProps) => { defaultValue="tab0" onValueChange={handleTabChange}> {lists.map((list, index) => { return ( From 1c2ec94f2967f5b8bb17f844280b149c6f548f8c Mon Sep 17 00:00:00 2001 From: sue Date: Mon, 22 Jan 2024 17:53:53 +0900 Subject: [PATCH 21/52] =?UTF-8?q?Refactor:=20=EC=97=AC=EC=A0=95=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B2=84=EA=B7=B8=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Plan/TripBudget.tsx | 2 +- src/components/Trip/EditCodeModal.tsx | 6 ++--- src/pages/trip/tripEdit.page.tsx | 32 +++++++++++++++------------ 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/components/Plan/TripBudget.tsx b/src/components/Plan/TripBudget.tsx index ff23134f..181ceab4 100644 --- a/src/components/Plan/TripBudget.tsx +++ b/src/components/Plan/TripBudget.tsx @@ -113,7 +113,7 @@ const TripBudget = () => { } content={ -
+
{ 수정하기 diff --git a/src/pages/trip/tripEdit.page.tsx b/src/pages/trip/tripEdit.page.tsx index cd9cb371..50d6bc51 100644 --- a/src/pages/trip/tripEdit.page.tsx +++ b/src/pages/trip/tripEdit.page.tsx @@ -32,30 +32,35 @@ const TripEdit = () => { const [showSelectDate, setShowSelectDate] = useState(false); const [tripDate, setTripDate] = useRecoilState(tripDateState); - let start: Date, end: Date; - if (startDate && endDate) { - start = new Date(startDate); - end = new Date(endDate); - } + // 초기 날짜 + const [initialStartDate, setInitialStartDate] = useState(null); + const [initialEndDate, setInitialEndDate] = useState(null); useEffect(() => { if (startDate && endDate) { + const start = new Date(startDate); + const end = new Date(endDate); setTripDate({ startDate: start, endDate: end }); - } - if (tripName) { - setTitle(tripName); + setInitialStartDate(start); + setInitialEndDate(end); + + if (tripName) { + setTitle(tripName); + } } }, [tripName, startDate, endDate]); const handleSubmit = async () => { try { - let adjustedStartDate, adjustedEndDate; + let adjustedStartDate = startDate ? new Date(startDate) : null; + let adjustedEndDate = endDate ? new Date(endDate) : null; - if (tripDate.startDate) { + if (tripDate.startDate && tripDate.startDate !== initialStartDate) { adjustedStartDate = new Date(tripDate.startDate); adjustedStartDate.setDate(adjustedStartDate.getDate() + 1); } - if (tripDate.endDate) { + + if (tripDate.endDate && tripDate.endDate !== initialEndDate) { adjustedEndDate = new Date(tripDate.endDate); adjustedEndDate.setDate(adjustedEndDate.getDate() + 1); } @@ -72,9 +77,8 @@ const TripEdit = () => { }; if (tripId) { - const response = await putTrips(tripId, tripRequestData); - console.log('전송 완료: ', response); - navigate('/trip/' + tripId); + await putTrips(tripId, tripRequestData); + navigate(`/trip/${tripId}`); window.location.reload(); } } catch (error) { From 164699396e0db3ab716cecdb8f4ca1c3ca42f919 Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Mon, 22 Jan 2024 17:54:24 +0900 Subject: [PATCH 22/52] =?UTF-8?q?feat:=20=EA=B3=B5=EC=9C=A0=EC=A4=91?= =?UTF-8?q?=EB=A9=A4=EB=B2=84=20=ED=83=80=EC=9E=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@types/trips.types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/@types/trips.types.ts b/src/@types/trips.types.ts index 6b6bceec..e2ebbb0c 100644 --- a/src/@types/trips.types.ts +++ b/src/@types/trips.types.ts @@ -13,6 +13,7 @@ interface MyTripType { startDate: string; endDate: string; numberOfPeople: number; + numberOfTripMember: number; tripStatus: string; tripThumbnailUrl: string; area: string; From ffaf3053fa452cb85a7d746ea151238adf03bf93 Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Mon, 22 Jan 2024 17:54:37 +0900 Subject: [PATCH 23/52] =?UTF-8?q?style:=20=EB=94=94=EC=9E=90=EC=9D=B8=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 --- .../DetailSectionTop/DetailToursMap.tsx | 55 +++++++------------ 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/src/components/DetailSectionTop/DetailToursMap.tsx b/src/components/DetailSectionTop/DetailToursMap.tsx index 4413e86f..3b4c3da9 100644 --- a/src/components/DetailSectionTop/DetailToursMap.tsx +++ b/src/components/DetailSectionTop/DetailToursMap.tsx @@ -11,8 +11,6 @@ interface DetailToursMapProps { export default function DetailToursMap({ mapData }: DetailToursMapProps) { const { fullAddress, longitude, latitude, tel } = mapData; - const [isMapVisible, setIsMapVisible] = useState(false); - const [isAddressVisible, setIsAddressVisible] = useState(false); const [_] = useKakaoLoader({ appkey: VITE_KAKAO_MAP_API_KEY, @@ -20,37 +18,13 @@ export default function DetailToursMap({ mapData }: DetailToursMapProps) { const MapStyle = { width: '100%', - height: isMapVisible ? 0 : '180px', - marginTop: isMapVisible ? '15px' : '15px', - marginBottom: isMapVisible ? '15px' : '15px', - transition: 'height 0.3s ease-in-out', - }; - - const closeMap = () => { - setIsMapVisible((prev) => !prev); + height: '180px', + marginTop: '5px', + marginBottom: '15px', }; return (
-
-
setIsAddressVisible(!isAddressVisible)}> - - {!isAddressVisible ? ( -

- {fullAddress} -

- ) : ( -

- {fullAddress} -

- )} -
-
- -
-
-
- -
-

- {tel ? tel : '전화번호가 없어요'} + +

+
+ +

+ {fullAddress}

-
-
+
+
+ +
+

+ {tel ? tel : '전화번호가 없어요'} +

+
+
+
From f98693b002f2d8248ff0f4ce4aff939765028a2f Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Mon, 22 Jan 2024 17:55:11 +0900 Subject: [PATCH 24/52] =?UTF-8?q?refactor:=20=EB=8B=B9=EC=9D=BC=EC=B9=98?= =?UTF-8?q?=EA=B8=B0=200=EB=B0=95=201=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MyTrip/MyTripIngItem.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/MyTrip/MyTripIngItem.tsx b/src/components/MyTrip/MyTripIngItem.tsx index dcac90dd..ca0d08d4 100644 --- a/src/components/MyTrip/MyTripIngItem.tsx +++ b/src/components/MyTrip/MyTripIngItem.tsx @@ -37,7 +37,8 @@ const MyTripIngItem: React.FC = ({ myTripList }) => {
{startDate.replace(/-/g, '.')} ~{' '} - {endDate.replace(/-/g, '.').split('2024.')} ({tripDuration}) + {endDate.replace(/-/g, '.').split('2024.')}{' '} + {tripDuration === '0박 1일' ? null : ` (${tripDuration})`}
From 3c68fe6c3dcf83576dfe5adb2f9cbe5e19026732 Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Mon, 22 Jan 2024 17:55:20 +0900 Subject: [PATCH 25/52] =?UTF-8?q?refactor:=20=EB=8B=B9=EC=9D=BC=EC=B9=98?= =?UTF-8?q?=EA=B8=B0=200=EB=B0=95=201=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MyTrip/MyTripItem.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/MyTrip/MyTripItem.tsx b/src/components/MyTrip/MyTripItem.tsx index f327aa9c..72375a66 100644 --- a/src/components/MyTrip/MyTripItem.tsx +++ b/src/components/MyTrip/MyTripItem.tsx @@ -21,7 +21,7 @@ const MyTripItem: React.FC = ({ myTripList }) => { tripName, startDate, endDate, - numberOfPeople, + numberOfTripMember, tripThumbnailUrl, } = myTripList; @@ -44,7 +44,7 @@ const MyTripItem: React.FC = ({ myTripList }) => { destructive={true} onClick={() => deleteMyTripMutate(tripId)}>
- 삭제 + 나가기
@@ -71,13 +71,14 @@ const MyTripItem: React.FC = ({ myTripList }) => {
{startDate.replace(/-/g, '.')} -{' '} - {endDate.replace(/-/g, '.').split('2024.')} ({tripDuration}) + {endDate.replace(/-/g, '.').split('2024.')} + {tripDuration === '0박 1일' ? null : ` (${tripDuration})`}
- {numberOfPeople}명과 공유중 + {numberOfTripMember}명과 공유중
From 0210a73e177f7eb2f38541a36e00863fa155ec64 Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Mon, 22 Jan 2024 17:55:34 +0900 Subject: [PATCH 26/52] =?UTF-8?q?refactor:=20=EC=A3=BC=EC=86=8C=20?= =?UTF-8?q?=EC=8B=9C=EA=B5=B0=EA=B5=AC=EA=B9=8C=EC=A7=80=EB=A7=8C=20?= =?UTF-8?q?=EB=82=98=EC=98=A4=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Wish/WishItem.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/Wish/WishItem.tsx b/src/components/Wish/WishItem.tsx index e8c12eb9..8a27f666 100644 --- a/src/components/Wish/WishItem.tsx +++ b/src/components/Wish/WishItem.tsx @@ -1,6 +1,7 @@ import { TourType } from '@/@types/tours.types'; import { HeartIcon, StarIcon } from '@components/common/icons/Icons'; import Like from '@components/common/like/Like'; +import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; interface WishItemProps { @@ -19,8 +20,17 @@ const WishItem: React.FC = ({ wishList }) => { tourAddress, } = wishList; + const [isMetroIncluded, setIsMetroIncluded] = useState(false); + const navigate = useNavigate(); + useEffect(() => { + if (tourAddress) { + const isMetroCityIncluded = /특별시|광역시/.test(tourAddress); + setIsMetroIncluded(isMetroCityIncluded); + } + }, []); + return (
= ({ wishList }) => { {title}

-

{tourAddress}

+

+ {isMetroIncluded && tourAddress + ? (tourAddress.match(/(.*?[시군구])/)?.[0] || '') + + (tourAddress + .replace(/(.*?[시군구])/, '') + .match(/(특별시|광역시)?.*?[시군구]/)?.[0] || '') + : tourAddress?.match(/(.*?[시군구])/)?.[0]} +

From 769ecf009f975388ae90e91f843687e3fe0f76b4 Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Mon, 22 Jan 2024 17:55:51 +0900 Subject: [PATCH 27/52] =?UTF-8?q?style:=20MapIcon=20size=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/icons/Icons.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/icons/Icons.tsx b/src/components/common/icons/Icons.tsx index c096458d..91c93068 100644 --- a/src/components/common/icons/Icons.tsx +++ b/src/components/common/icons/Icons.tsx @@ -322,7 +322,7 @@ export const MapIcon: React.FC = ({ return ( From 982f635b845c9d6ff3e7c758b30db8a28aa477ee Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Mon, 22 Jan 2024 18:15:33 +0900 Subject: [PATCH 28/52] =?UTF-8?q?refactor:=20unused=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DetailSectionTop/DetailToursMap.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/DetailSectionTop/DetailToursMap.tsx b/src/components/DetailSectionTop/DetailToursMap.tsx index 3b4c3da9..07871ac0 100644 --- a/src/components/DetailSectionTop/DetailToursMap.tsx +++ b/src/components/DetailSectionTop/DetailToursMap.tsx @@ -1,7 +1,6 @@ -import { useState } from 'react'; import { Map, MapMarker } from 'react-kakao-maps-sdk'; import { useKakaoLoader } from 'react-kakao-maps-sdk'; -import { PhoneIcon, MapIcon, DownIcon } from '@components/common/icons/Icons'; +import { PhoneIcon, MapIcon } from '@components/common/icons/Icons'; const VITE_KAKAO_MAP_API_KEY = import.meta.env.VITE_KAKAO_MAP_API_KEY; From 0f82187b908b94cba70bf819e9379f72c1104953 Mon Sep 17 00:00:00 2001 From: sue Date: Mon, 22 Jan 2024 18:44:59 +0900 Subject: [PATCH 29/52] =?UTF-8?q?Design:=20=EB=A9=94=EC=9D=B8=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=94=94=EC=9E=90=EC=9D=B8=20QA=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Tours/ToursCategory.tsx | 2 +- src/components/Tours/ToursCategoryItem.tsx | 2 +- .../Tours/ToursCategoryItemSkeleton.tsx | 2 +- src/components/Tours/ToursItem.tsx | 2 +- src/components/common/nav/Nav.tsx | 33 ++++++++++++++----- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/components/Tours/ToursCategory.tsx b/src/components/Tours/ToursCategory.tsx index 8578ddda..8f899739 100644 --- a/src/components/Tours/ToursCategory.tsx +++ b/src/components/Tours/ToursCategory.tsx @@ -54,7 +54,7 @@ const ToursCategory = ({
{Array.from({ length: 10 }, (_, index) => ( - + ))} diff --git a/src/components/Tours/ToursCategoryItem.tsx b/src/components/Tours/ToursCategoryItem.tsx index d849da67..f7e62cb3 100644 --- a/src/components/Tours/ToursCategoryItem.tsx +++ b/src/components/Tours/ToursCategoryItem.tsx @@ -13,7 +13,7 @@ const ToursCategoryItem = ({ ); diff --git a/src/components/Tours/ToursCategoryItemSkeleton.tsx b/src/components/Tours/ToursCategoryItemSkeleton.tsx index e60f5678..cb51d2ee 100644 --- a/src/components/Tours/ToursCategoryItemSkeleton.tsx +++ b/src/components/Tours/ToursCategoryItemSkeleton.tsx @@ -1,7 +1,7 @@ const ToursCategoryItemSkeleton = () => { return (
-
+
); }; diff --git a/src/components/Tours/ToursItem.tsx b/src/components/Tours/ToursItem.tsx index 41c1abd6..0e30a938 100644 --- a/src/components/Tours/ToursItem.tsx +++ b/src/components/Tours/ToursItem.tsx @@ -30,7 +30,7 @@ const ToursItem = ({ tour }: { tour: TourType }) => {
-

+

{title}

diff --git a/src/components/common/nav/Nav.tsx b/src/components/common/nav/Nav.tsx index 7695f624..c26329ac 100644 --- a/src/components/common/nav/Nav.tsx +++ b/src/components/common/nav/Nav.tsx @@ -40,7 +40,10 @@ const Nav = () => { }} className="cursor-pointer flex-col items-center justify-center px-2">
- +

@@ -50,9 +53,13 @@ const Nav = () => { onClick={() => navigate('/mytrip')} className="cursor-pointer flex-col items-center justify-center px-2">
- {isActive('/mytrip') ? : } + {isActive('/mytrip') ? ( + + ) : ( + + )}
-

여정

+

여정

) : ( { onConfirm={handleConfirm}>
- +
-

+

여정

@@ -82,10 +92,11 @@ const Nav = () => { className="cursor-pointer flex-col items-center justify-center px-2">
-

+

관심목록

@@ -103,10 +114,11 @@ const Nav = () => {
-

+

관심목록

@@ -117,9 +129,12 @@ const Nav = () => { onClick={() => navigate('/mypage')} className="cursor-pointer flex-col items-center justify-center px-1">
- +
-

내정보

+

내정보

From 8bce534868802d3db86b7373956fe557aa2dedde Mon Sep 17 00:00:00 2001 From: Shim Jeong ah <35457850+joanShim@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:06:02 +0900 Subject: [PATCH 30/52] =?UTF-8?q?Fix:=20=EB=B0=B0=EA=B2=BD=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0,=20=ED=99=94=EB=A9=B4=20=EB=86=92=EC=9D=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DatePicker/Calendar.tsx | 2 +- src/components/createTrip/SelectDate.tsx | 4 +- src/index.css | 2 +- src/pages/create/createTrip.page.tsx | 4 +- src/pages/test.page.tsx | 151 +++++++++++++++++++++++ src/router/routerLayout.tsx | 4 +- 6 files changed, 159 insertions(+), 8 deletions(-) create mode 100644 src/pages/test.page.tsx diff --git a/src/components/DatePicker/Calendar.tsx b/src/components/DatePicker/Calendar.tsx index 1db551ab..16eb0172 100644 --- a/src/components/DatePicker/Calendar.tsx +++ b/src/components/DatePicker/Calendar.tsx @@ -173,7 +173,7 @@ const Calendar: React.FC<{ : '날짜를 선택해주세요.'}
-
+
{visibleMonths.map((month, idx) => (
{renderCalendar(month)}
))} diff --git a/src/components/createTrip/SelectDate.tsx b/src/components/createTrip/SelectDate.tsx index aadc9696..b92d92f8 100644 --- a/src/components/createTrip/SelectDate.tsx +++ b/src/components/createTrip/SelectDate.tsx @@ -17,7 +17,7 @@ export const SelectDate = ({ onClose }: { onClose: () => void }) => { }; return ( -
+
@@ -30,7 +30,7 @@ export const SelectDate = ({ onClose }: { onClose: () => void }) => { setSelectedEndDate(endDate); }} /> -
+
완료
diff --git a/src/index.css b/src/index.css index ba55d149..00b6f010 100644 --- a/src/index.css +++ b/src/index.css @@ -27,7 +27,7 @@ body { margin: 0; - background-color: #eee; + /* background-color: #eee; */ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } diff --git a/src/pages/create/createTrip.page.tsx b/src/pages/create/createTrip.page.tsx index 18b3cb9f..acaf0422 100644 --- a/src/pages/create/createTrip.page.tsx +++ b/src/pages/create/createTrip.page.tsx @@ -88,7 +88,7 @@ export const CreateTrip = () => { ); } return ( -
+
여행 생성하기
@@ -143,7 +143,7 @@ export const CreateTrip = () => {
{formattedTripDate}
-
+
완료
diff --git a/src/pages/test.page.tsx b/src/pages/test.page.tsx new file mode 100644 index 00000000..77ec6622 --- /dev/null +++ b/src/pages/test.page.tsx @@ -0,0 +1,151 @@ +import { ButtonPrimary } from '@components/common/button/Button'; +import BackHeader from '@components/common/header/BackHeader'; +import { + CalendarIcon, + CloseIcon, + CounterIcon, + PlanIcon, + UserIcon, +} from '@components/common/icons/Icons'; +import { InputField } from '@components/createTrip/InputField'; +import { tripDateState } from '@recoil/tripDate'; +import { useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { SelectDate } from '@components/createTrip/SelectDate'; +import { postTrips } from '@api/trips'; +import useCounter from '@hooks/useCounter'; +import { formatDate } from '@utils/formatDate'; +import { useQuery } from '@tanstack/react-query'; +import { getMemberTrips } from '@api/member'; +import { useNavigate } from 'react-router-dom'; +import { Spinner } from '@components/common/spinner/Spinner'; + +export const TestPage = () => { + const navigate = useNavigate(); + const [title, setTitle] = useState(''); + const [numOfMembers, increaseNumOfMembers, decreaseNumOfMembers] = useCounter( + 1, + 1, + ); + const [showSelectDate, setShowSelectDate] = useState(false); + const tripDate = useRecoilValue(tripDateState); + + const { data, isLoading, isError } = useQuery({ + queryKey: ['myTrips'], + queryFn: () => getMemberTrips(), + }); + + if (isLoading) { + return ; + } + // if (isError) { + // return
데이터를 불러오는 중 오류가 발생했습니다.
; + // } + const MY_TRIP_NUMBER = data?.length + 1; + const defaultTitle = `나의 여정 ${MY_TRIP_NUMBER}`; + + const handleSubmit = async () => { + try { + const tripRequestData = { + tripName: title || defaultTitle, + numberOfPeople: numOfMembers, + startDate: tripDate.startDate + ? tripDate.startDate.toISOString().split('T')[0] + : null, + endDate: tripDate.endDate + ? tripDate.endDate.toISOString().split('T')[0] + : null, + area: null, + subarea: null, + }; + + const response = await postTrips(tripRequestData); + console.log('전송 완료: ', response); + const tripId = response.data.data.tripId; + navigate('/trip/' + tripId); + } catch (error) { + console.error('전송 실패: ', error); + } + }; + + const formattedTripDate = + tripDate.startDate && tripDate.endDate + ? tripDate.startDate === tripDate.endDate + ? formatDate(tripDate.startDate, 'yyyy. MM. dd') + : `${formatDate(tripDate.startDate, 'yyyy. MM. dd')} - ${formatDate( + tripDate.endDate, + 'MM. dd', + )}` + : '여행 날짜 (선택)'; + + if (showSelectDate) { + return ( + { + setShowSelectDate(false); + }} + /> + ); + } + return ( +
+ +
여행 생성하기
+ + + { + setTitle(e.target.value); + }} + autoFocus + /> + {title && ( +
{ + setTitle(''); + }}> + +
+ )} +
+ + +
인원
+
+ {numOfMembers !== 1 && ( + + )} +
{numOfMembers}
+ +
+
+ + { + setShowSelectDate(true); + }} + isClickable> +
{formattedTripDate}
+
+ +
+ 완료 +
+
+ ); +}; diff --git a/src/router/routerLayout.tsx b/src/router/routerLayout.tsx index 75d0006f..93033a41 100644 --- a/src/router/routerLayout.tsx +++ b/src/router/routerLayout.tsx @@ -24,9 +24,9 @@ const MainLayout = () => { ); return ( -
+
-
+
{showNav &&