Skip to content

feat: 요일 헤더에 자동 날짜 표시 추가 - #116

Closed
yoohyun-1203 wants to merge 1 commit into
devfrom
fix/day-headers-dates
Closed

feat: 요일 헤더에 자동 날짜 표시 추가#116
yoohyun-1203 wants to merge 1 commit into
devfrom
fix/day-headers-dates

Conversation

@yoohyun-1203

Copy link
Copy Markdown
Collaborator

🚀 작업 내용 (What)

  • 초대 링크 들어갔을 때 & 일정 조율 현황 들어갔을 때 요일만 뜨던거 날짜 뜨게함

📣 핵심 변경 이유 (Why)

📸 스크린샷 (Visuals, 선택)

⚠️ 체크리스트 (Checklist)

  • 브랜치 컨벤션(feature/00-name)을 지켰나요?
  • 커밋 컨벤션(feat:, fix: 등)을 지켰나요?
  • 작업 전에 관련 이슈를 생성하고 연결했나요?
  • 내 코드가 팀의 기존 코드를 망가뜨리지 않았는지 확인했나요?

🔗 관련 이슈 (Issue)

Close #

@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
moim-app Ready Ready Preview, Comment Jun 15, 2026 12:03am

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • New Features

    • 일정 예약 화면에서 요일 표시에 다가오는 실제 날짜(월/일)를 포함하도록 개선했습니다. 슬롯 옵션 라벨, 일정 선택 그리드 헤더, 호스트 결과 heatmap 등에서 더욱 명확한 날짜 정보를 확인할 수 있습니다.
  • Bug Fixes

    • 파일 업로드 검증 로직을 개선했습니다.

Walkthrough

ScheduleRoomClient.tsx에서 DAY_LABELS 타입을 Record<string, string>으로 확장하고, 다음 발생 요일 날짜를 계산해 월/일 형식으로 반환하는 formatDayWithDate 함수를 추가했다. 슬롯 옵션 라벨, 그리드 헤더, heatmap 세 곳의 요일 표기를 이 함수로 교체하고, 파일 크기 검증 조건을 !isIcs로 수정하며 중복 DAY_CODE_TO_JS_DAY 선언을 제거했다.

Changes

요일 날짜 표기 및 파일 검증 수정

Layer / File(s) Summary
DAY_LABELS 타입 확장 및 formatDayWithDate 정의
src/app/schedule/[id]/ScheduleRoomClient.tsx
DAY_LABELSRecord<string, string>으로 변경, DAY_CODE_TO_JS_DAYRecord<string, number>로 재정의하고 다음 해당 요일 날짜를 반환하는 formatDayWithDate를 추가. 하단 중복 선언 제거.
호출 지점 교체 및 파일 검증 조건 수정
src/app/schedule/[id]/ScheduleRoomClient.tsx
slotOptions 라벨, 그리드 헤더, heatmapDays 세 곳을 formatDayWithDate(day)로 교체. 파일 크기 100KB 조건을 !isImage에서 !isIcs로 수정.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

feature


핵심 지적 사항:

1. formatDayWithDate의 날짜 기준 모호성

new Date()로 "오늘"을 기준 삼아 다음 발생 날짜를 계산하면, 렌더링 시점마다 결과가 달라진다. SSR/CSR hydration mismatch가 발생할 수 있다.

// 위험: 매 렌더마다 다른 값
function formatDayWithDate(dayCode: string): string {
  const today = new Date(); // ← 렌더 시점 종속
  ...
}

useMemo 또는 useState로 클라이언트 마운트 시 한 번만 계산하고, 서버 렌더 시에는 요일 이름만 반환하도록 방어해야 한다:

const [referenceDate, setReferenceDate] = useState<Date | null>(null);
useEffect(() => { setReferenceDate(new Date()); }, []);

// formatDayWithDate에 referenceDate를 인자로 주입
function formatDayWithDate(dayCode: string, from: Date | null): string {
  if (!from) return DAY_LABELS[dayCode] ?? dayCode; // SSR safe fallback
  ...
}

2. !isIcs 조건 변경의 의도 불명확

// 변경 전
if (!isImage && file.size > 100 * 1024)

// 변경 후
if (!isIcs && file.size > 100 * 1024)

!isImage에서 !isIcs로 바뀌면 이미지 파일이 100KB를 초과해도 제한되지 않는다. 이미지 파일에 대한 크기 제한이 의도적으로 해제된 것인지, 아니면 버그인지 명확히 해야 한다. 두 조건을 분리하거나 각 파일 타입별 제한을 명시적으로 선언하는 것이 안전하다:

const MAX_ICS_SIZE = 100 * 1024;
const MAX_IMAGE_SIZE = 5 * 1024 * 1024; // 의도에 맞게 조정

if (isIcs && file.size > MAX_ICS_SIZE) { ... }
if (isImage && file.size > MAX_IMAGE_SIZE) { ... }

3. DAY_CODE_TO_JS_DAY 타입 완화의 타입 안전성 손실

Record<DayCode, number>Record<string, number>로 변경하면 컴파일 타임에 잘못된 키 접근을 감지할 수 없다. formatDayWithDate 내부에서 DAY_CODE_TO_JS_DAY[dayCode]undefined를 반환할 때의 방어 코드가 있는지 확인하고, 없으면 추가해야 한다:

const jsDay = DAY_CODE_TO_JS_DAY[dayCode];
if (jsDay === undefined) return DAY_LABELS[dayCode] ?? dayCode;
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning 작업 내용은 기술했으나 핵심 변경 이유, 스크린샷, 관련 이슈 연결이 완전히 비어있고 체크리스트 미완료. Why 섹션에 날짜 표시 필요 이유(사용자 혼동 방지, 다중 시간대 대응 등)를 명시하고 관련 이슈 ID 연결 필수. UI 변경이 있으면 스크린샷 추가.
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 'feat:' 접두사로 시작하고 요일 헤더에 자동 날짜 표시 추가라는 핵심 변경 사항을 명확히 요약한다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/day-headers-dates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/schedule/`[id]/ScheduleRoomClient.tsx:
- Around line 64-82: The formatDayWithDate function does not validate whether
the dayCode parameter exists in the DAY_CODE_TO_JS_DAY mapping, which can cause
diff to become NaN when an invalid dayCode is passed, resulting in incorrect
dates. Add defensive code to the formatDayWithDate function to check if the
dayCode exists in the DAY_CODE_TO_JS_DAY record before using it, and either
throw an error for invalid inputs or provide a fallback behavior to prevent NaN
calculations.
- Around line 428-431: The condition checking file size validation in the
ScheduleRoomClient.tsx file is inverted. The current condition `!isIcs` applies
the size limit and ICS-specific error message to image files instead of ICS
files. Change the condition from `!isIcs` to `isIcs` so that the 100KB file size
limit with the message "ICS 파일 크기는 100KB 이하여야 합니다." only applies to actual ICS
files, preventing incorrect error messages from appearing for image files.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 10b64849-3659-42c2-bb94-39268c91ea54

📥 Commits

Reviewing files that changed from the base of the PR and between 5171f8d and da7bb51.

📒 Files selected for processing (1)
  • src/app/schedule/[id]/ScheduleRoomClient.tsx

Comment on lines +64 to +82
const DAY_CODE_TO_JS_DAY: Record<string, number> = {
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}`;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

formatDayWithDate에서 잘못된 dayCode 입력 시 NaN 날짜 생성 가능

DAY_CODE_TO_JS_DAY[dayCode]undefined를 반환하면 diffNaN이 되어 잘못된 날짜가 표시된다. 현재 호출부가 모두 DayCode[]를 사용하므로 런타임 위험은 낮으나, 타입이 string으로 완화된 만큼 방어 코드가 필요하다.

♻️ 방어 코드 추가 제안
 function formatDayWithDate(dayCode: string): string {
+  const jsDay = DAY_CODE_TO_JS_DAY[dayCode];
+  if (jsDay === undefined) {
+    return DAY_LABELS[dayCode] ?? dayCode;
+  }
   const now = new Date();
-  const diff = (DAY_CODE_TO_JS_DAY[dayCode] - now.getDay() + 7) % 7;
+  const diff = (jsDay - 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}`;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/schedule/`[id]/ScheduleRoomClient.tsx around lines 64 - 82, The
formatDayWithDate function does not validate whether the dayCode parameter
exists in the DAY_CODE_TO_JS_DAY mapping, which can cause diff to become NaN
when an invalid dayCode is passed, resulting in incorrect dates. Add defensive
code to the formatDayWithDate function to check if the dayCode exists in the
DAY_CODE_TO_JS_DAY record before using it, and either throw an error for invalid
inputs or provide a fallback behavior to prevent NaN calculations.

Comment on lines +428 to 431
if (!isIcs && file.size > 100 * 1024) {
setImportMessage("ICS 파일 크기는 100KB 이하여야 합니다.");
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# 다른 파일의 ICS 검증 로직과 일관성 확인
rg -n "100.*1024|100KB" --type ts -C 3 | head -80

Repository: Siul49/moim

Length of output: 2152


🏁 Script executed:

sed -n '420,435p' src/app/schedule/[id]/ScheduleRoomClient.tsx

Repository: Siul49/moim

Length of output: 487


조건 반전 버그 — 이미지 파일에 ICS 크기 제한 메시지 표시

라인 428의 !isIcs 조건은 "이미지 파일"을 필터링하는데, 에러 메시지는 "ICS 파일 크기" 제한을 안내한다. 라인 422-427 검증을 통과한 파일은 isIcs || isImage이므로, !isIcs는 곧 isImage를 의미한다. 따라서 현재 코드는 이미지 파일 > 100KB 시 "ICS 파일 크기는..." 메시지를 표시하게 되어 사용자를 혼동시킨다.

calendar/connect/page.tsxapi/everytime/timetable/route.ts는 모두 ICS 파일에만 100KB 제한을 적용한다. 조건을 isIcs로 수정해야 한다.

🐛 조건 수정
-    if (!isIcs && file.size > 100 * 1024) {
+    if (isIcs && file.size > 100 * 1024) {
       setImportMessage("ICS 파일 크기는 100KB 이하여야 합니다.");
       return;
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/schedule/`[id]/ScheduleRoomClient.tsx around lines 428 - 431, The
condition checking file size validation in the ScheduleRoomClient.tsx file is
inverted. The current condition `!isIcs` applies the size limit and ICS-specific
error message to image files instead of ICS files. Change the condition from
`!isIcs` to `isIcs` so that the 100KB file size limit with the message "ICS 파일
크기는 100KB 이하여야 합니다." only applies to actual ICS files, preventing incorrect
error messages from appearing for image files.

@Siul49

Siul49 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

종료 사유: 최신 dev 기준 재작업으로 대체

이 PR 브랜치( ix/day-headers-dates)는 dev 대비 오래되어 conflict/리뷰 지적 상태였습니다.

이 PR은 머지하지 않고 닫습니다. 후속 PR 번호를 코멘트로 연결합니다.

@Siul49 Siul49 closed this Jul 10, 2026
@Siul49

Siul49 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

대체 PR: #124

Siul49 added a commit that referenced this pull request Jul 10, 2026
Merge #124: day headers with M/D dates (Close #123). Supersedes #116.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants