-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add weekendColor prop to highlight weekend columns #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add weekendColor prop to StylingOption interface - Add weekendColor support in GridBodyProps and GridBody component - Implement weekend detection logic using getDay() (0=Sunday, 6=Saturday) - Add weekend column highlighting with configurable color - Update Gantt component to accept and pass weekendColor prop - Add weekendColor usage examples in example app (#97979714) - Update README.md with weekendColor documentation - Change todayColor default from rgba(252, 248, 227, 0.5) to rgba(252, 248, 227, 1) Based on PR #122 from MaTeMaTuK/gantt-task-react by AquilesOliveiraDev
|
Warning Rate limit exceeded@jeonghanyun has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 17 seconds before requesting another review. โ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. ๐ฆ How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ๐ Files selected for processing (1)
๐ WalkthroughWalkthrough์ฃผ์ ๋ณ๊ฒฝ ์ฌํญ์ Gantt ์ฐจํธ ์ปดํฌ๋ํธ์ ์ฃผ๋ง ์ปฌ๋ผ์ ์์์ ์ง์ ํ ์ ์๋ ์๋ก์ด ์คํ์ผ ์ต์
( Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant Gantt
participant TaskGantt
participant GridBody
App->>Gantt: weekendColor prop ์ ๋ฌ
Gantt->>TaskGantt: gridProps์ weekendColor ํฌํจํ์ฌ ์ ๋ฌ
TaskGantt->>GridBody: weekendColor prop ์ ๋ฌ
GridBody->>GridBody: ์ฃผ๋ง ์ปฌ๋ผ์ weekendColor๋ก <rect> ๋ ๋๋ง
Estimated code review effort๐ฏ 2 (Simple) | โฑ๏ธ ~8 minutes Poem
โจ Finishing Touches
๐งช Generate unit tests
๐ชง TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
๐งน Nitpick comments (1)
src/components/grid/grid-body.tsx (1)
80-91: ์ฃผ๋ง ๊ฐ์ง ๋ก์ง์ ๊ฐ์ ํด์ฃผ์ธ์ํ์ฌ ๊ตฌํ์์ ๋ฐฐ์ด์ ๋ง์ง๋ง ๋ ์ง๊ฐ ์ฃผ๋ง์ธ ๊ฒฝ์ฐ ๊ฐ์กฐํ์๋์ง ์์ต๋๋ค. ๋ํ ์ฑ๋ฅ ์ต์ ํ๋ฅผ ์ํด
useMemo๋ฅผ ๊ณ ๋ คํด๋ณด์ธ์.๋ค์๊ณผ ๊ฐ์ด ๊ฐ์ ํ ์ ์์ต๋๋ค:
- if (weekendColor !== "transparent" && dates[i + 1] && [0, 6].includes(dates[i + 1].getDay())) { + // Check current date for weekend + if (weekendColor !== "transparent" && [0, 6].includes(date.getDay())) { weekends.push( <rect - key={"WeekendColumn" + i} - x={tickX + columnWidth} + key={"WeekendColumn" + date.getTime()} + x={tickX} y={0} width={columnWidth} height={y} fill={weekendColor} /> ); }๋๋ ์ฑ๋ฅ์ ์ํด weekend ๊ณ์ฐ์
useMemo๋ก ๊ฐ์ธ๋ ๊ฒ์ ๊ณ ๋ คํด๋ณด์ธ์.
๐ Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ Files selected for processing (5)
README.md(1 hunks)example/src/App.tsx(2 hunks)src/components/gantt/gantt.tsx(2 hunks)src/components/grid/grid-body.tsx(5 hunks)src/types/public-types.ts(1 hunks)
๐ Additional comments (7)
src/types/public-types.ts (1)
116-116: ํ์ ์ ์๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์ถ๊ฐ๋์์ต๋๋ค
weekendColor์์ฑ์ดStylingOption์ธํฐํ์ด์ค์ ์ ํ์ ๋ฌธ์์ด ํ์ ์ผ๋ก ์ ์ ํ ์ถ๊ฐ๋์์ต๋๋ค. ๋ค๋ฅธ ์์ ์์ฑ๋ค๊ณผ ์ผ๊ด์ฑ์ ์ ์งํ๋ฉฐ ํ์ ํธํ์ฑ๋ ๋ณด์ฅ๋ฉ๋๋ค.README.md (1)
116-116: ๋ฌธ์ํ๊ฐ ์ ์ ํ ์ถ๊ฐ๋์์ต๋๋ค
weekendColor์์ฑ์ ๋ํ ์ค๋ช ์ด ๊ธฐ์กด ๋ฌธ์ ํ์๊ณผ ์ผ๊ด์ฑ์ ์ ์งํ๋ฉฐ ๋ช ํํ๊ฒ ์์ฑ๋์์ต๋๋ค.example/src/App.tsx (1)
90-90: ์์ ์ฌ์ฉ๋ฒ์ด ์ ์ ํฉ๋๋ค๋ Gantt ์ปดํฌ๋ํธ ์ธ์คํด์ค์
weekendColor์์ฑ์ด ์ผ๊ด์ฑ ์๊ฒ ์ถ๊ฐ๋์์ผ๋ฉฐ, ๋ฐํฌ๋ช ํ์(#97979714)์ ์ฌ์ฉํ์ฌ ์ฃผ๋ง ์ปฌ๋ผ์ ์ ์ ํ ๊ฐ์กฐํ ์ ์๋๋ก ๊ตฌํ๋์์ต๋๋ค.Also applies to: 106-106
src/components/gantt/gantt.tsx (2)
56-57: ์์ ์์ฑ ๊ธฐ๋ณธ๊ฐ์ด ์ ์ ํ ์ค์ ๋์์ต๋๋ค
todayColor์ ๊ธฐ๋ณธ๊ฐ์ด ์์ ๋ถํฌ๋ช ์ผ๋ก ๋ณ๊ฒฝ๋์ด ๋ ๋ช ํํ ํ์๊ฐ ๊ฐ๋ฅํ๋ฉฐ,weekendColor์ ๊ธฐ๋ณธ๊ฐ์"transparent"๋ก ์ค์ ํ์ฌ ๊ธฐ๋ฅ์ด ๊ธฐ๋ณธ์ ์ผ๋ก ๋นํ์ฑํ๋๋๋ก ํ ๊ฒ์ด ์ ์ ํฉ๋๋ค.
398-398: ์์ฑ ์ ๋ฌ์ด ์ฌ๋ฐ๋ฅด๊ฒ ๊ตฌํ๋์์ต๋๋ค
weekendColor์์ฑ์ดgridProps๋ฅผ ํตํด ๊ทธ๋ฆฌ๋ ๋ ๋๋ง ๋ก์ง์ผ๋ก ์ฌ๋ฐ๋ฅด๊ฒ ์ ๋ฌ๋์์ต๋๋ค.src/components/grid/grid-body.tsx (2)
13-13: ํ์ ์ ์์ ์์ฑ ์ถ๊ฐ๊ฐ ์ฌ๋ฐ๋ฆ ๋๋ค
GridBodyPropsํ์ ์weekendColor์์ฑ์ด ์ ์ ํ ์ถ๊ฐ๋๊ณ ์ปดํฌ๋ํธ์์ ์ฌ๋ฐ๋ฅด๊ฒ ๊ตฌ์กฐ ๋ถํด๋์์ต๋๋ค.Also applies to: 23-23
140-140: SVG ๊ทธ๋ฃน ๋ ๋๋ง์ด ์ ์ ํฉ๋๋ค
weekends๊ทธ๋ฃน์ด ์ฌ๋ฐ๋ฅธ ์์๋ก ์ถ๊ฐ๋์ด ์ฃผ๋ง ๊ฐ์กฐํ์๊ฐ ๋ค๋ฅธ ์์๋ค๊ณผ ์ ์ ํ ๋ ๋๋ง๋ฉ๋๋ค.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds weekend highlighting functionality to the gantt chart by introducing a weekendColor prop that allows users to set a background color for weekend columns (Saturday and Sunday). The feature is based on the original MaTeMaTuK/gantt-task-react PR #122 and includes Korean localization support.
- Added
weekendColorprop toStylingOptioninterface for weekend column highlighting - Implemented weekend detection logic in grid body to apply background colors to Saturday (6) and Sunday (0) columns
- Updated default
todayColorvalue for consistency with the original implementation
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/types/public-types.ts | Added weekendColor prop to StylingOption interface |
| src/components/grid/grid-body.tsx | Implemented weekend detection and rendering logic with background color support |
| src/components/gantt/gantt.tsx | Added weekendColor prop with default value and prop forwarding |
| example/src/App.tsx | Added usage examples with weekendColor set to semi-transparent gray |
| README.md | Added documentation for the new weekendColor option |
src/components/grid/grid-body.tsx
Outdated
| if (weekendColor !== "transparent" && dates[i + 1] && [0, 6].includes(dates[i + 1].getDay())) { | ||
| weekends.push( | ||
| <rect | ||
| key={"WeekendColumn" + i} | ||
| x={tickX + columnWidth} |
Copilot
AI
Aug 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The weekend detection logic uses dates[i + 1] but should use dates[i] to check the current date being processed. Using dates[i + 1] will cause the weekend highlighting to be offset by one column.
| if (weekendColor !== "transparent" && dates[i + 1] && [0, 6].includes(dates[i + 1].getDay())) { | |
| weekends.push( | |
| <rect | |
| key={"WeekendColumn" + i} | |
| x={tickX + columnWidth} | |
| if (weekendColor !== "transparent" && [0, 6].includes(date.getDay())) { | |
| weekends.push( | |
| <rect | |
| key={"WeekendColumn" + i} | |
| x={tickX} |
Fixed the weekend detection logic to use the current date instead of the next date, which was causing the weekend highlighting to be offset by one column. Also improved the key generation to use date.getTime() for better uniqueness. - Changed from dates[i + 1] to date (current date) for weekend detection - Updated x position from tickX + columnWidth to tickX - Improved React key from "WeekendColumn" + i to "WeekendColumn" + date.getTime() ๐ค Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
๋ฆฌ๋ทฐ ํผ๋๋ฐฑ ๊ฐ์ฌํฉ๋๋ค! ๐โ ์์ ์๋ฃ: ์ฃผ๋ง ์ปฌ๋ผ ํ์ด๋ผ์ดํ ์คํ์ ๋ฌธ์ ์ง์ ์ฌํญ๋ค:
ํด๊ฒฐ: ์ปค๋ฐ 58e7414์์ ๋ค์๊ณผ ๊ฐ์ด ์์ ํ์ต๋๋ค: - if (weekendColor \!== "transparent" && dates[i + 1] && [0, 6].includes(dates[i + 1].getDay())) {
+ if (weekendColor \!== "transparent" && [0, 6].includes(date.getDay())) {
weekends.push(
<rect
- key={"WeekendColumn" + i}
- x={tickX + columnWidth}
+ key={"WeekendColumn" + date.getTime()}
+ x={tickX}๐ ๊ฐ์ ์ฌํญ ์์ฝ
๐ฏ ์ฑ๋ฅ ์ต์ ํ ๊ด๋ จ
๋ชจ๋ ์ง์ ์ฌํญ์ด ํด๊ฒฐ๋์์ผ๋ ๋ฆฌ๋ทฐ ์ฌ๊ฒํ ๋ถํ๋๋ฆฝ๋๋ค! ๐ |
๐จ Weekend Color Support Feature
์ด PR์ MaTeMaTuK/gantt-task-react PR #122์ "Add new prop weekendColor to grid" ๊ธฐ๋ฅ์ ํ๊ตญ์ด ๋ฒ์ ์ ์ ์ฉํ ๊ฒ์ ๋๋ค.
โจ ์ฃผ์ ๊ธฐ๋ฅ
๐๏ธ Weekend Highlighting
transparent) ์ค์ ์ผ๋ก ์ฃผ๋ง ํ์ด๋ผ์ดํธ ๋นํ์ฑํ ๊ฐ๋ฅ๐ง ์ฌ์ฉ ์์
๐ฏ ๊ธฐ๋ฅ ์ค๋ช
"transparent"(์ฃผ๋ง ํ์ด๋ผ์ดํธ ์์)"#97979714"(๋ฐํฌ๋ช ํ์)getDay()๊ฐ์ด 0(์ผ์์ผ) ๋๋ 6(ํ ์์ผ)์ผ ๋ ์์ ์ ์ฉ๐ ๋ณ๊ฒฝ๋ ํ์ผ๋ค
Core Files
src/types/public-types.ts: weekendColor prop์ StylingOption์ ์ถ๊ฐsrc/components/grid/grid-body.tsx: ์ฃผ๋ง ๊ฐ์ง ๋ฐ ์์ ์ ์ฉ ๋ก์งsrc/components/gantt/gantt.tsx: weekendColor prop ์ ๋ฌExample Files
example/src/App.tsx: weekendColor ์ฌ์ฉ ์์ ์ถ๊ฐDocumentation
README.md: weekendColor ๋ฌธ์ ์ถ๊ฐ๐ ๊ธฐํ ๋ณ๊ฒฝ์ฌํญ
todayColor๊ธฐ๋ณธ๊ฐ์rgba(252, 248, 227, 0.5)์์rgba(252, 248, 227, 1)๋ก ๋ณ๊ฒฝ (์๋ณธ PR๊ณผ ๋์ผ)โ ํ ์คํธ
๐ Credit
Original PR by @AquilesOliveiraDev - PR #122
์ด ๊ธฐ๋ฅ์ผ๋ก ์ฃผ๋ง์ ํน๋ณํ ๊ท์น์ด ์ ์ฉ๋๋ ํ๋ก์ ํธ์์ ์๊ฐ์ ์ผ๋ก ์ฃผ๋ง์ ๊ตฌ๋ถํ ์ ์๊ฒ ๋์์ต๋๋ค! ๏ฟฝ๏ฟฝ
Summary by CodeRabbit
New Features
weekendColor)์ด ์ถ๊ฐ๋์์ต๋๋ค.Style
Documentation
weekendColor์ต์ ์ ๋ํ ์ค๋ช ์ด ์ถ๊ฐ๋์์ต๋๋ค.