From da7bb5129af42756599bdd67ee85f6da74c85586 Mon Sep 17 00:00:00 2001 From: yoohyun-1203 Date: Mon, 15 Jun 2026 09:01:07 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9A=94=EC=9D=BC=20=ED=97=A4=EB=8D=94?= =?UTF-8?q?=EC=97=90=20=EC=9E=90=EB=8F=99=20=EB=82=A0=EC=A7=9C=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/schedule/[id]/ScheduleRoomClient.tsx | 40 ++++++++++++-------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/app/schedule/[id]/ScheduleRoomClient.tsx b/src/app/schedule/[id]/ScheduleRoomClient.tsx index 1e8ca77..784034d 100644 --- a/src/app/schedule/[id]/ScheduleRoomClient.tsx +++ b/src/app/schedule/[id]/ScheduleRoomClient.tsx @@ -51,7 +51,7 @@ interface HostSchedule extends PublicSchedule { commonSlots: TimeSlot[]; } -const DAY_LABELS: Record = { +const DAY_LABELS: Record = { MON: "월요일", TUE: "화요일", WED: "수요일", @@ -61,6 +61,26 @@ const DAY_LABELS: Record = { SUN: "일요일", }; +const DAY_CODE_TO_JS_DAY: Record = { + SUN: 0, + MON: 1, + TUE: 2, + WED: 3, + THU: 4, + FRI: 5, + SAT: 6, +}; + +function formatDayWithDate(dayCode: string): string { + const now = new Date(); + const diff = (DAY_CODE_TO_JS_DAY[dayCode] - now.getDay() + 7) % 7; + const target = new Date(now); + target.setDate(now.getDate() + diff); + const m = target.getMonth() + 1; + const d = target.getDate(); + return `${DAY_LABELS[dayCode] ?? dayCode} ${m}/${d}`; +} + export function ScheduleRoomClient({ scheduleId, hostToken, @@ -295,7 +315,7 @@ export function ScheduleRoomClient({ slots.push({ key: `${day}-${hour}`, slot: { day, startHour: hour, endHour: hour + 1 }, - label: `${DAY_LABELS[day]} ${formatHour(hour)}-${formatHour(hour + 1)}`, + label: `${formatDayWithDate(day)} ${formatHour(hour)}-${formatHour(hour + 1)}`, }); } } @@ -405,7 +425,7 @@ export function ScheduleRoomClient({ ); return; } - if (!isImage && file.size > 100 * 1024) { + if (!isIcs && file.size > 100 * 1024) { setImportMessage("ICS 파일 크기는 100KB 이하여야 합니다."); return; } @@ -652,7 +672,7 @@ export function ScheduleRoomClient({ key={day} className="flex h-8 items-center justify-center pb-2 text-center text-sm font-bold text-brand-purple" > - {DAY_LABELS[day]} + {formatDayWithDate(day)} ))} @@ -1130,7 +1150,7 @@ function HostResultPanel({ }, [schedule.candidateStartHour, schedule.candidateEndHour]); const heatmapDays = useMemo(() => { - return schedule.candidateDays.map((d) => DAY_LABELS[d] || d); + return schedule.candidateDays.map((d) => formatDayWithDate(d)); }, [schedule.candidateDays]); const heatmapColors = useMemo(() => { @@ -1446,16 +1466,6 @@ function HostResultPanel({ ); } -const DAY_CODE_TO_JS_DAY: Record = { - SUN: 0, - MON: 1, - TUE: 2, - WED: 3, - THU: 4, - FRI: 5, - SAT: 6, -}; - // 확정 슬롯은 요일 기반({day,startHour,endHour})이므로, // 다가오는 해당 요일의 실제 날짜로 환산해 캘린더 일정 start/end를 만든다. function nextOccurrence(slot: TimeSlot): { start: Date; end: Date } {