From 0ea86d6ac18f39df792f920b7378b286137121b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=97=B0=EC=A7=84?= Date: Sat, 16 Aug 2025 15:33:45 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20null=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/dateCourse/info.tsx | 51 ++++++++++++++++---------- src/components/dateCourse/timeline.tsx | 5 ++- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/components/dateCourse/info.tsx b/src/components/dateCourse/info.tsx index f617b9b..6ebf330 100644 --- a/src/components/dateCourse/info.tsx +++ b/src/components/dateCourse/info.tsx @@ -16,30 +16,41 @@ type TMealKey = keyof typeof Meal; const isBudgetKey = (v: string): v is TBudgetKey => Object.prototype.hasOwnProperty.call(Budget, v); const isTotalTimeKey = (v: string): v is TTotalTimeKey => Object.prototype.hasOwnProperty.call(TotalTime, v); const isMealKey = (v: string): v is TMealKey => Object.prototype.hasOwnProperty.call(Meal, v); + export default function Info({ cashTag, locationTag, timeTag, MealTag, keywordTags }: TInfo) { - const label = isBudgetKey(cashTag) ? Budget[cashTag] : '알 수 없음'; - const totalTime = isTotalTimeKey(timeTag) ? TotalTime[timeTag] : '알 수 없음'; - const meals = MealTag.filter(isMealKey).map((tag) => Meal[tag]); + const label = cashTag != null && isBudgetKey(cashTag) ? Budget[cashTag] : '알 수 없음'; + const totalTime = timeTag != null && isTotalTimeKey(timeTag) ? TotalTime[timeTag] : '알 수 없음'; + const meals = MealTag !== null && MealTag.filter(isMealKey).map((tag) => Meal[tag]); return (
- - - - - - - - - - - - - - - - - + {cashTag && ( + + + + )} + {locationTag && ( + + + + )} + {timeTag && ( + + + + )} + + {meals && ( + + + + )} + + {keywordTags && ( + + + + )}
); } diff --git a/src/components/dateCourse/timeline.tsx b/src/components/dateCourse/timeline.tsx index 29d989e..7e88b42 100644 --- a/src/components/dateCourse/timeline.tsx +++ b/src/components/dateCourse/timeline.tsx @@ -12,6 +12,9 @@ import Location from '@/assets/icons/Location_Blank.svg?react'; function Timeline({ end = false, image, name, placeCategoryResponseList, roadNameAddress, averagePrice, time, signatureDish }: TTimeline) { const [open, setOpen] = useState(false); + const editTime = time != null ? time.split(':')[0] : '00'; + const editMin = time != null ? time.split(':')[1] : '00'; + return (
(end ? undefined : setOpen(!open))} >
- {time.split(':')[0]}:{time.split(':')[1]} + {editTime}:{editMin}