Skip to content

♻️Refactor : 행사 날짜 - 당일로 포맷팅#143

Merged
KongMezu merged 2 commits intodevelopfrom
refactor/#132/chat-bookmark
Nov 15, 2025
Merged

♻️Refactor : 행사 날짜 - 당일로 포맷팅#143
KongMezu merged 2 commits intodevelopfrom
refactor/#132/chat-bookmark

Conversation

@KongMezu
Copy link
Copy Markdown
Contributor

@KongMezu KongMezu commented Nov 15, 2025

🔥 작업 내용

  • 행사 날짜 포맷팅

Summary by CodeRabbit

릴리스 노트

  • 버그 수정

    • 팝업의 오버레이를 클릭하여 팝업을 닫을 수 있도록 개선했습니다.
  • 개선 사항

    • UI 요소들의 레이어링 순서를 개선하여 올바른 표시 순서를 보장합니다.

@vercel
Copy link
Copy Markdown

vercel bot commented Nov 15, 2025

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

Project Deployment Preview Comments Updated (UTC)
af-fe Ready Ready Preview Comment Nov 15, 2025 6:19pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 15, 2025

Walkthrough

세 개의 UI 컴포넌트에 대한 초기화 로직 및 레이어링 조정: DatePicker의 innerDatedisplayMonth 초기화를 today 기반으로 리팩토링, PopupSet의 Overlay에 클릭 닫기 기능 추가, z-index 값 전반적으로 상향 조정.

Changes

Cohort / File(s) Summary
DatePicker 초기화 로직 리팩토링
src/shared/components/datePicker/DatePicker.tsx
innerDate 기본값을 defaultValue ?? today로 변경, today/startOfToday 선언을 컴포넌트 상단으로 이동, displayMonth 초기화 흐름을 value ?? innerDate ?? new Date() 기반으로 조정
Overlay 상호작용 및 레이어링 개선
src/shared/components/set/PopupSet.tsx, src/shared/overlay/Overlay.tsx
PopupSet의 Overlay에 onClick={handleClose} 추가로 클릭 시 팝업 닫기 기능 활성화, z-index 값 z-[100]z-[10000], 999999로 상향 조정

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • DatePicker.tsx: 초기화 로직 변경이 간단하며, 공개 API는 그대로 유지되어 동작 검증이 명확함
  • PopupSet.tsx & Overlay.tsx: z-index 조정 및 단순 이벤트 핸들러 추가로 변경 범위가 제한적

Possibly related PRs

Suggested labels

refactor

Suggested reviewers

  • skyblue1232
  • jjangminii

Poem

🐰 오늘의 기준으로 날짜를 심고,
레이어를 높이 쌓으니 반짝반짝,
팝업을 톡 누르면 스르르 사라지고,
초기화의 마법, 정갈하게 정리 완료! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning 필수 섹션 중 대부분이 누락되었으며, '작업 내용' 섹션만 최소한으로 작성되어 있습니다. 추후 작업 사항, 이슈 번호, PR Point, 스크린샷/GIF 등 템플릿의 필수 섹션들을 추가하여 작성해주세요.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 '행사 날짜 - 당일로 포맷팅'으로 주요 변경사항(날짜 포맷팅)을 명확히 나타내고 있습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#132/chat-bookmark

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.

@github-actions
Copy link
Copy Markdown

🏷️ Labeler has automatically applied labels based on your PR title, branch name, or commit message.
Please verify that they are correct before merging.

@github-actions github-actions bot added the comment 필요한 주석 추가 및 변경 label Nov 15, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b971788 and ea26b17.

📒 Files selected for processing (3)
  • src/shared/components/datePicker/DatePicker.tsx (1 hunks)
  • src/shared/components/set/PopupSet.tsx (1 hunks)
  • src/shared/overlay/Overlay.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/shared/components/set/PopupSet.tsx (1)
src/shared/lib/utils.ts (1)
  • cn (71-73)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-deploy
🔇 Additional comments (2)
src/shared/components/set/PopupSet.tsx (1)

23-23: 오버레이 클릭으로 팝업 닫기 기능 추가 - 좋습니다!

오버레이에 onClick={handleClose}를 추가하여 사용자가 오버레이를 클릭해 팝업을 닫을 수 있게 한 것은 좋은 UX 개선입니다.

src/shared/components/datePicker/DatePicker.tsx (1)

34-36: 변경 사항 확인 완료: innerDate 초기화 로직이 변경되었으나 컴포넌트는 정상 작동합니다.

코드베이스 검증 결과, DatePicker 컴포넌트의 defaultValue 없는 사용 (src/pages/events/index.tsx:49)이 이 변경의 영향을 받습니다.

변경 전: defaultValue만 사용 → innerDate가 undefined 가능
변경 후: defaultValue ?? todayinnerDate가 항상 Date 값을 가짐

결과:

  • 기능적으로는 안정적입니다 (모든 사용처에서 defensive 패턴 ?? new Date()로 처리됨)
  • 다만 UI 동작이 변합니다: defaultValue 없이 사용할 때 버튼에 "Select date" 대신 오늘 날짜가 표시됩니다
  • 이 변경이 의도된 것이라면 변경사항 적절합니다

Comment on lines +27 to +32
const today = new Date();
const startOfToday = new Date(
today.getFullYear(),
today.getMonth(),
today.getDate(),
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

미사용 변수: startOfToday가 선언되었으나 사용되지 않습니다.

startOfToday 변수가 27-32라인에서 선언되었지만, 92-93라인의 관련 코드가 주석 처리되어 실제로는 사용되지 않습니다. 이는 리팩토링이 완료되지 않았음을 시사합니다.

다음 중 하나를 선택하세요:

  1. startOfToday를 사용하는 기능을 구현하고 92-93라인의 주석을 해제
  2. startOfToday 변수 선언을 제거

주석 처리된 코드는 향후 구현 예정인 기능인가요? 그렇다면 TODO 주석을 추가하거나 이슈를 생성하는 것을 권장합니다.

이 기능 구현을 도와드릴까요? 또는 추적을 위한 이슈를 생성해드릴까요?

Also applies to: 92-93

🤖 Prompt for AI Agents
In src/shared/components/datePicker/DatePicker.tsx around lines 27-32,
startOfToday is declared but unused (the related logic at lines 92-93 is
commented out); either remove the startOfToday declaration to eliminate the dead
variable, or re-enable and wire the commented logic at 92-93 so startOfToday is
actually used (ensure the comparison/usage matches the intended behavior and
tests); if the commented code is intended for future work, restore the
declaration removal but add a TODO comment and/or create a tracking issue
referencing the planned feature instead of leaving unused code.

⚠️ Potential issue | 🟠 Major

성능 이슈: 매 렌더링마다 날짜 객체가 재생성됩니다.

todaystartOfToday가 컴포넌트 본문 내에서 선언되어 매 렌더링마다 새로운 Date 객체가 생성됩니다. 이는 불필요한 메모리 할당과 성능 저하를 야기합니다.

다음과 같이 수정하여 최적화하세요:

  ...calendarProps
}: DatePickerProps) {
  const [open, setOpen] = useState(false);

+  const [today] = useState(() => new Date());
+  const [startOfToday] = useState(() => {
+    const t = new Date();
+    return new Date(t.getFullYear(), t.getMonth(), t.getDate());
+  });
-  const today = new Date();
-  const startOfToday = new Date(
-    today.getFullYear(),
-    today.getMonth(),
-    today.getDate(),
-  );

  const [innerDate, setInnerDate] = useState<Date | undefined>(

또는 컴포넌트 외부에서 한 번만 계산하도록 이동하세요.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const today = new Date();
const startOfToday = new Date(
today.getFullYear(),
today.getMonth(),
today.getDate(),
);
const [today] = useState(() => new Date());
const [startOfToday] = useState(() => {
const t = new Date();
return new Date(t.getFullYear(), t.getMonth(), t.getDate());
});
🤖 Prompt for AI Agents
In src/shared/components/datePicker/DatePicker.tsx around lines 27 to 32, the
component recreates new Date objects on every render (today and startOfToday),
causing unnecessary allocations; fix by computing these values once and reusing
them — either move the calculation outside the component at module scope so they
are created only once, or wrap the creation in a useMemo/useRef with an empty
dependency array inside the component to memoize the Date instances; update any
usages to reference the memoized/module-scope variables and remove per-render
creation.

<div
className={cn(
'fixed inset-0 z-[100]',
'fixed inset-0 z-[10000]',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

z-index 값이 과도하게 높습니다.

z-index를 100에서 10000으로 변경한 것은 Overlay 컴포넌트의 9999와 일관성을 유지하기 위한 것으로 보이지만, 두 값 모두 불필요하게 높습니다.

Overlay(9999)와 PopupSet(10000)의 1 차이는 의미가 있지만, 전체적인 z-index 스케일을 낮추는 것을 권장합니다 (예: Overlay 100, PopupSet 101).

🤖 Prompt for AI Agents
In src/shared/components/set/PopupSet.tsx around line 27, the z-index class
'z-[10000]' is excessively large; lower the stacking scale so PopupSet uses a
modest value (e.g., z-101 or z-[101]) instead of 10000, and ensure consistency
by updating the Overlay component to use a base like z-100 so the relative
ordering (Overlay 100, PopupSet 101) is preserved across the codebase; replace
the long-form 10000 class with the smaller value and run a quick UI check to
confirm no stacking regressions.

onClick={onClick}
className={`
fixed inset-0 z-[99]
fixed inset-0 z-[9999]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

z-index 값이 과도하게 높습니다.

z-index를 99에서 9999로 변경하는 것은 100배 증가이며, 이는 z-index 관리 전략에 문제가 있을 수 있음을 시사합니다. 이러한 높은 값은 다음과 같은 문제를 야기할 수 있습니다:

  • 향후 더 높은 레이어가 필요할 때 값을 계속 증가시키는 악순환
  • 서드파티 라이브러리나 다른 컴포넌트와의 z-index 충돌 가능성
  • 코드베이스 전반의 z-index 체계 관리 어려움

100~200 범위의 값으로도 충분할 가능성이 높으니, 실제로 이렇게 높은 값이 필요한지 검토해주세요.

다음 스크립트로 프로젝트 전체의 z-index 사용 현황을 확인할 수 있습니다:


🏁 Script executed:

#!/bin/bash
# z-index 사용 패턴 분석

# Tailwind z-index 클래스 검색
rg -nP 'z-\[?\d+\]?' --type ts --type tsx -C2

# CSS 파일에서 z-index 검색
rg -nP 'z-index:\s*\d+' --type css -C2

Length of output: 27


z-index 사용 현황을 정확히 파악하기 위해 수정된 스크립트를 실행하겠습니다.


🏁 Script executed:

#!/bin/bash
# z-index 사용 패턴 분석 (수정)

# Tailwind z-index 클래스 검색 (ts, tsx, jsx 파일)
echo "=== Tailwind z-index 클래스 (z-[숫자]) ==="
rg -nP 'z-\[\d+\]' -g '*.ts' -g '*.tsx' -g '*.jsx' -C2

# 대체 방식: z- 패턴 검색
echo "=== Tailwind z- 패턴 ==="
rg -n 'z-\d+' -g '*.ts' -g '*.tsx' -g '*.jsx' -C2

# CSS 파일에서 z-index 검색
echo "=== CSS z-index ==="
rg -nP 'z-index' -g '*.css' -g '*.scss' -C2

# Overlay.tsx 파일 내용 확인
echo "=== Overlay.tsx 파일 확인 ==="
fd -t f 'Overlay.tsx' -x cat {}

Length of output: 8186


z-index 관리 체계 개선이 필수입니다. 더 심각한 우선순위 문제도 발견되었습니다.

코드베이스 검토 결과, 리뷰 우려가 타당합니다:

  • z-index 값들이 일관성 없이 혼재함 (0, 10, 50, 100, 2000, 9999, 10000)
  • 악순환이 이미 시작됨: PopupSet.tsx (라인 27)에서 z-[10000] 사용 중이므로, Overlay의 z-[9999]는 의도와 달리 뒤로 가게 됨
  • 제3자 라이브러리와의 충돌 위험 높음

수정 필요 사항:

  1. 긴급: src/shared/components/set/PopupSet.tsx (라인 27)에서 z-[10000] 검토 – Overlay보다 우선순위가 높은지 확인
  2. 필수: 전사적 z-index 관리 체계 정립 (e.g., 100~200 범위로 계층화)
  3. 필수: Overlay의 z-[9999], ResultMap의 z-[9999]를 체계적 값으로 변경
  4. 권고: 향후 새로운 레이어 추가 시 사전에 체계 검토
🤖 Prompt for AI Agents
src/shared/overlay/Overlay.tsx around line 12: Overlay currently uses z-[9999],
which conflicts with other high z-indexes and is lower than PopupSet's
z-[10000]; change Overlay to use a project-standard z-index (e.g., move to a
defined layer like z-[200] or a CSS variable/class such as var(--z-overlay) or
.z-overlay) and update any other hardcoded 9999 usages (e.g., ResultMap) to the
same standard; also inspect src/shared/components/set/PopupSet.tsx line 27
(z-[10000]) and either lower it to the correct layer or document/justify it in
the new z-index plan so the overlay stacking order is consistent across the app.

@KongMezu KongMezu merged commit 457bece into develop Nov 15, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comment 필요한 주석 추가 및 변경

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants