Commit b01cb27
feat: improve overlapping events display in weekly calendar view (calcom#24880)
* feat: improve overlapping events display in weekly calendar view
- Add cascading layout algorithm for overlapping events
- First event at 80% width, subsequent events offset by 8%
- Implement hover behavior to bring events to front (z-index 100)
- Extract overlap logic into reusable utility functions
- Add comprehensive unit tests for overlap detection and layout calculation
- Sort events by start time, then by duration for consistent rendering
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* feat: add weekly calendar playground page for testing overlapping events
- Create comprehensive playground page with 8 test scenarios
- Include two overlapping, three cascading, non-overlapping, same start time, chain overlaps, dense day, touching events, and mixed statuses
- Add focused view with scenario selector and grid view for side-by-side comparison
- Update playground index to include weekly calendar link
- Each scenario includes description, expected behavior, and collapsible event data
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* update base props
* remove unneccessary things
* fix: isolate Calendar store instances to prevent shared state
- Refactor useCalendarStore to use Zustand's createStore with React Context
- Each Calendar component now creates its own isolated store instance
- Maintains backward compatibility with global store fallback
- Fixes issue where multiple Calendar instances on same page shared state
This allows the playground page to render multiple Calendar instances
without state conflicts between them.
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* fix: prevent event overflow in dense overlap scenarios
- Dynamically compress offset step based on overlap group size
- Ensure leftOffset + width never exceeds 100% to prevent bleeding into next day
- Add width clamping as safety guard against rounding errors
- Add 3 new tests for overflow prevention with dense event scenarios
Fixes issue where 10+ overlapping events would cascade beyond day boundary
and bleed into the next day's column. The algorithm now calculates the
maximum safe step size per overlap group while maintaining visual cascade.
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* remove global store
* fix: comprehensive overflow prevention with safety margin and CSS fix
- Add safetyMarginPercent (0.5%) to prevent rounding and CSS box model overflow
- Implement floor3 rounding for width to guarantee left + width <= 100 - safetyMargin
- Calculate width from rounded left offset to avoid rounding mismatch
- Remove inset-x-1 class conflict that was setting both left and right positioning
- Change from marginLeft to left positioning for proper control
- Add test for 20+ overlapping events to verify no overflow
- Update existing tests to verify safety margin is respected
This fixes the slight overflow issue reported by the user where events were
still bleeding into adjacent day columns despite the initial dynamic step
compression fix. The root cause was a combination of:
1. CSS conflict: inset-x-1 class setting both left and right positioning
2. Rounding mismatch: width calculated from unrounded left offset
3. No safety margin for CSS box model effects (borders, padding)
All 21 tests now pass including new safety margin verification.
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* feat: update Dense Day scenario to 20+ events
- Increase from 11 to 21 overlapping events in Dense Day scenario
- Update title from '10+ Events' to '20+ Events'
- Add 10 more diverse events with staggered start times
- Better stress test for overflow prevention with safety margin
This provides a more comprehensive test case for the overflow prevention
fix and matches the user's request for 20+ events instead of 10+.
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* WIP
* feat: enhance event tooltip to show full event details
- Replace simple title-only tooltip with rich content tooltip
- Display event title, time range, description, and status
- Add color indicator matching the event's visual style
- Set min-width (200px) and max-width (300px) for better readability
- Use inverted theme colors for better contrast in tooltip
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* faster animation
* feat: position tooltip based on day of week
- Show tooltip on right side for Monday-Thursday (days 1-4)
- Show tooltip on left side for Friday-Sunday (days 5-0)
- Calculate day of week using dayjs from event start date
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* add margin for tooltip
* feat: add event duration layout test scenario
- Add new scenario with events of varying durations (3, 7, 15, 20, 30, 53 minutes)
- Test layout logic where eventDuration > 30 changes flex direction
- Events ≤30min show horizontal layout (title and time inline)
- Events >30min show vertical layout (title and time stacked)
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* update styles
* feat: add minimum height of 15px for events
- Ensure very short events (e.g., 3 minutes) are still visible
- Use CSS max() to apply minimum height while respecting duration-based height
- Prevents events from becoming too small to interact with
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* update playground
* do not mutate
* pre-compute some values
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Sean Brydon <sean@cal.com>1 parent c48f204 commit b01cb27
9 files changed
Lines changed: 1268 additions & 166 deletions
File tree
- apps/web/app/(use-page-wrapper)/settings/(admin-layout)/admin/playground
- weekly-calendar
- packages
- features/calendars/weeklyview
- components
- event
- state
- utils
- ui/components/tooltip
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
0 commit comments