-
Notifications
You must be signed in to change notification settings - Fork 53
Feat: Render events relative to their times #248
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
base: master
Are you sure you want to change the base?
Feat: Render events relative to their times #248
Conversation
|
@AbiT-246 is attempting to deploy a commit to the Ansul Agrawal's projects Team on Vercel. A member of the Team first needs to authorize it. |
This comment was marked as outdated.
This comment was marked as outdated.
|
@AbiT-246, can you update the pr |
|
@AbiT-246, please resolve the conflict. I will push to the beta version. |
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: 2
🤖 Fix all issues with AI agents
In @src/components/ResourceEvents.jsx:
- Line 364: The key generation using `${evt.eventItem.id}_${headerItem.time}`
can collide when evt.eventItem.id is null/undefined or not stable; update the
key expression to use a stable fallback and include additional stable context
such as the enclosing resource id or the map index: e.g., build the key from
(evt.eventItem?.id ?? evt.id ?? `evt_${index}`) + '_' + (resource?.id ??
`res_${resourceIndex}`) + '_' + headerItem.time, ensuring you reference the same
variables used in the map (evt, eventItem, headerItem, resource, index) so the
key is always a non-empty unique string even when eventItem.id is missing.
- Around line 316-359: Replace the fixed 1440 and unclamped math: compute
dayDurationMinutes from the actual day bounds (e.g.,
dayStart.endOf('day').diff(dayStart.startOf('day'),'minute')) to handle DST,
clamp startOffsetMinutes and eventDurationMinutes into [0, dayDurationMinutes],
and use baseCellWidth consistently for leftOffset and totalWidth calculations so
padding/margin is honored for both single-day and multi-day (first-day)
branches; ensure width is Math.max(1, Math.min(computedWidth, totalWidth)) and
left is clamped so the rendered left+width cannot overflow the cell region
(apply to the CellUnit.Day branch where evt.span === 1 and the multi-day
isFirstDay branch, referencing variables dayDurationMinutes, baseCellWidth,
leftOffset, totalWidth, eventWidth, startPercentage, durationPercentage).
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/components/ResourceEvents.jsx
🔇 Additional comments (1)
src/components/ResourceEvents.jsx (1)
434-469: The wrapper is correctly implemented; the raised concerns are largely unfounded.1) Default export change: Not a breaking change. ResourceEvents is not part of the public API (src/index.js only exports Scheduler, SchedulerData, etc.); only index.jsx internally imports it.
2) Missing
itemparameter: Correct as-is. The spec functions expect signature(props, monitor, component), not(item, ...). When handlers need the dragged item, they callmonitor.getItem()directly (see DnDContext.js line 71 in hover). The wrapper correctly delegates to spec with(props, monitor, componentRef.current).3) Empty
accept: []: Supported and correct. Per react-dnd API, empty accept disables drops as intended for the disabled path.4) Ref type (
componentRef.current): Correct. The wrapper passes the class instance, which has theeventContainerproperty that spec.drop/hover expect (DnDContext.js line 29 accessescomponent.eventContainer).Likely an incorrect or invalid review comment.
This PR improves event rendering in the day view by positioning and sizing events proportionally based on their actual start and end times within each day, instead of spanning the full day cell.
Fixes #223
Changes
Proportional positioning for single-day events
Proportional sizing
Multi-day event handling
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.