Repository navigation
feat(calendar): drive selection in root calendar - #1330
Conversation
- Split sidebar click: dot toggles visibility, row selects creation context - Add selectedCalendarKey state with bg-accent/50 highlight on active entry - Derive effectiveModalDriveId/Context from selection or event's own driveId - Pass override driveId to createEvent for user-context drive events - Full modal parity (attendees, agent triggers, linked page) when drive selected Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughSidebar rows become selectable and highlighted; CalendarView tracks the selected calendar and routes EventModal drive/context from that selection for new events. Saving a new event may pass a drive override into createEvent; editing uses the event’s original drive context. ChangesCalendar Sidebar Selection for Event Creation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6609b35d7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const creationDriveId = isUserContext && selectedCalendarKey !== 'personal' | ||
| ? selectedCalendarKey | ||
| : (isUserContext ? undefined : driveId); | ||
| const effectiveModalDriveId = selectedEvent?.driveId ?? creationDriveId; |
There was a problem hiding this comment.
Preserve null drive context when editing personal events
When a drive is selected in the root calendar and the user opens an existing personal event (selectedEvent.driveId === null), selectedEvent?.driveId ?? creationDriveId resolves to the selected drive instead of preserving the event’s personal context. That makes the modal treat a personal event as drive-backed (showing drive attendees/agent UI and issuing drive-scoped fetches), and can lead to invalid save attempts such as attaching agent triggers to personal events. Use a null-preserving check (distinguish undefined from null) so editing respects the event’s actual ownership.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f00fe2d. Changed effectiveModalDriveId from selectedEvent?.driveId ?? creationDriveId to an explicit ternary: when editing an existing event, selectedEvent.driveId ?? undefined converts null (personal event) to undefined so it never inherits the selected drive context. Only when there is no event being edited does creationDriveId apply.
| tabIndex={0} | ||
| onClick={() => onToggle(cal.key)} | ||
| onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onToggle(cal.key); } }} | ||
| onClick={() => onSelectCalendar?.(cal.key)} |
There was a problem hiding this comment.
Keep sidebar row taps functional when no select callback exists
This row click handler now only calls onSelectCalendar, so in call sites that still use CalendarSidebar purely as a visibility filter (notably the mobile sheet, which does not pass onSelectCalendar), tapping a calendar row becomes a no-op and only the small checkbox hit-target still toggles visibility. That is a behavior regression for touch users compared to prior row-wide toggling and makes calendar filtering significantly harder on mobile.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f00fe2d. The row's onClick now falls back to onToggle when onSelectCalendar is not provided: onSelectCalendar ? onSelectCalendar(cal.key) : onToggle(cal.key). The mobile sheet in MobileCalendarView doesn't pass onSelectCalendar, so its rows continue to toggle visibility exactly as before.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@apps/web/src/components/calendar/CalendarSidebar.tsx`:
- Around line 74-79: The span with role="checkbox" that calls onToggle(cal.key)
is not keyboard-focusable; make it focusable by adding tabIndex={0} (or replace
the span with a semantic button) so keyboard users can reach it and trigger the
existing onKeyDown handler; ensure the same element that has role="checkbox",
aria-checked and onClick/onKeyDown receives tabIndex={0}.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4c693959-f083-47be-b0c0-48bfc918669f
📒 Files selected for processing (3)
apps/web/src/components/calendar/CalendarSidebar.tsxapps/web/src/components/calendar/CalendarView.tsxapps/web/src/components/calendar/useCalendarData.ts
- P1: personal events (driveId=null) no longer inherit selected drive context - P2: sidebar row falls back to onToggle when onSelectCalendar not provided (mobile sheet) - A11y: add tabIndex=0 to visibility checkbox span for keyboard focus Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ternary as a standalone statement in a curly-brace arrow body is flagged by @typescript-eslint/no-unused-expressions. Replace with if/else. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(calendar): drive selection in root calendar - Split sidebar click: dot toggles visibility, row selects creation context - Add selectedCalendarKey state with bg-accent/50 highlight on active entry - Derive effectiveModalDriveId/Context from selection or event's own driveId - Pass override driveId to createEvent for user-context drive events - Full modal parity (attendees, agent triggers, linked page) when drive selected Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(calendar): address PR review comments - P1: personal events (driveId=null) no longer inherit selected drive context - P2: sidebar row falls back to onToggle when onSelectCalendar not provided (mobile sheet) - A11y: add tabIndex=0 to visibility checkbox span for keyboard focus Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(calendar): use if/else instead of ternary expression statement Ternary as a standalone statement in a curly-brace arrow body is flagged by @typescript-eslint/no-unused-expressions. Replace with if/else. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
bg-accent/50)Changes
CalendarSidebar.tsxselectedKey+onSelectCalendarprops; split click targets; selection highlightCalendarView.tsxselectedCalendarKeystate; deriveseffectiveModalDriveId/Context; wires both desktop + mobileEventModalandcreateEventoverrideuseCalendarData.tscreateEventaccepts optionaloverrideDriveId(backwards-compatible)Test plan
/dashboard/calendar— Personal is highlighted by default/dashboard/[id]/calendar) behavior unchanged🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes