diff --git a/src/components/travel/DetailCard.tsx b/src/components/travel/DetailCard.tsx index a6d2b0c..1a6acf4 100644 --- a/src/components/travel/DetailCard.tsx +++ b/src/components/travel/DetailCard.tsx @@ -34,8 +34,6 @@ export function DetailCard({ }) { const [time, setTime] = useState(place.time ?? '오전'); - console.log(time); - const { data: tourSpot } = useTourSpotData( place.item.contentId, place.item.contentTypeId, @@ -222,7 +220,6 @@ const styles = { placeImg: styled.img` width: 100%; - object-fit: content; flex: 1; border-radius: 8px; margin-top: 0.8rem; diff --git a/src/features/trip/trip.slice.ts b/src/features/trip/trip.slice.ts index b542403..febf97a 100644 --- a/src/features/trip/trip.slice.ts +++ b/src/features/trip/trip.slice.ts @@ -111,7 +111,27 @@ export const useTripStore = create((set, get) => ({ })), addTour: () => - set((prev) => ({ ...prev, activities: [...prev.activities, []] })), + set((prev) => { + const { tourInfo, activities } = prev; + if (!tourInfo.startTime || !tourInfo.endTime) return prev; + + const DAY = 60 * 60 * 24 * 1000; + const days = + Math.round(tourInfo.endTime.getTime() - tourInfo.startTime.getTime()) / + DAY; + + return { + ...prev, + tourInfo: { + ...tourInfo, + endTime: + days >= activities.length + ? new Date(tourInfo.endTime.getTime() + DAY) + : tourInfo.endTime, + }, + activities: [...prev.activities, []], + }; + }), removeTour: (day) => set((prev) => ({