Skip to content

feat(calendar): drive selection in root calendar - #1330

Merged
2witstudios merged 3 commits into
masterfrom
pu/removing-notifs
May 13, 2026
Merged

2witstudios merged 3 commits into
masterfrom
pu/removing-notifs

Conversation

@2witstudios

@2witstudios 2witstudios commented May 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Split sidebar click behavior: the colored dot toggles a drive's visibility; clicking the row label selects it as the active creation context (highlighted with bg-accent/50)
  • Full modal parity from root calendar: when a drive is selected, the New Event modal shows attendees, agent triggers, and linked-page sections — identical to the drive-level calendar
  • Correct event creation: new events are posted with the selected drive's ID; opening existing drive events from root calendar also unlocks all drive features in the modal

Changes

File What changed
CalendarSidebar.tsx New selectedKey + onSelectCalendar props; split click targets; selection highlight
CalendarView.tsx selectedCalendarKey state; derives effectiveModalDriveId/Context; wires both desktop + mobile EventModal and createEvent override
useCalendarData.ts createEvent accepts optional overrideDriveId (backwards-compatible)

Test plan

  • Open /dashboard/calendar — Personal is highlighted by default
  • Click a drive name in the sidebar — row highlights; click New Event → modal shows Attendees, Agent trigger, Advanced sections
  • Create the event → it appears under the correct drive calendar with the right color
  • Switch back to Personal → New Event modal shows basic fields only, event is personal
  • Click the colored dot on a drive → visibility toggles without changing selection
  • Open an existing drive event from root calendar → all drive sections visible in modal
  • Drive-level calendar (/dashboard/[id]/calendar) behavior unchanged

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Sidebar rows are now selectable with keyboard support and a visual highlight for the selected calendar.
    • New events created from the sidebar respect the currently selected calendar, and the event editor receives the correct calendar context.
  • Bug Fixes

    • Checkbox/toggle clicks (and Enter/Space on them) no longer trigger row selection or activation, preventing accidental selection when toggling visibility.

Review Change Stack

- 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>
@coderabbitai

coderabbitai Bot commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ae888ac4-5321-40d5-b7b5-3c318eb93c2b

📥 Commits

Reviewing files that changed from the base of the PR and between f00fe2d and 0e3ba4b.

📒 Files selected for processing (1)
  • apps/web/src/components/calendar/CalendarSidebar.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/components/calendar/CalendarSidebar.tsx

📝 Walkthrough

Walkthrough

Sidebar 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.

Changes

Calendar Sidebar Selection for Event Creation

Layer / File(s) Summary
CalendarSidebar row selection UI
apps/web/src/components/calendar/CalendarSidebar.tsx
CalendarSidebarProps adds selectedKey and onSelectCalendar; row clicks/Enter/Space call onSelectCalendar when present and highlight the selected row; the inner toggle stops propagation and still calls onToggle.
CalendarView selected calendar tracking and sidebar integration
apps/web/src/components/calendar/CalendarView.tsx
Adds selectedCalendarKey state initialized to "personal" and wires CalendarSidebar with selectedKey and onSelectCalendar to manage selection.
EventModal drive context routing based on event state
apps/web/src/components/calendar/CalendarView.tsx
Derives creationDriveId, effectiveModalDriveId, and effectiveModalContext: editing uses event drive; creating uses selectedCalendarKey mapped to drive/context or fallback. Mobile and desktop EventModal use these effective values.
Event creation with drive override through API pipeline
apps/web/src/components/calendar/CalendarView.tsx, apps/web/src/components/calendar/useCalendarData.ts
handleEventSave computes a conditional driveOverride from selectedCalendarKey for new events and passes it to createEvent; useCalendarData.createEvent(eventData, overrideDriveId?) uses overrideDriveId when provided as the driveId in the POST payload.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A tap on the sidebar, a gentle click,
I pick a calendar quick as a flick,
New events now know where to land,
Driven by the key from my little hand,
Hopping off to save with a carrot-stick!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature: drive selection capability in the root calendar component.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pu/removing-notifs

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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.

@coderabbitai coderabbitai Bot left a comment

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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between a13be78 and b6609b3.

📒 Files selected for processing (3)
  • apps/web/src/components/calendar/CalendarSidebar.tsx
  • apps/web/src/components/calendar/CalendarView.tsx
  • apps/web/src/components/calendar/useCalendarData.ts

Comment thread apps/web/src/components/calendar/CalendarSidebar.tsx
2witstudios and others added 2 commits May 13, 2026 10:39
- 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>
@2witstudios
2witstudios deleted the pu/removing-notifs branch May 13, 2026 16:03
@2witstudios
2witstudios restored the pu/removing-notifs branch May 13, 2026 16:04
@2witstudios 2witstudios reopened this May 13, 2026
@2witstudios
2witstudios merged commit 26eeb48 into master May 13, 2026
5 checks passed
2witstudios added a commit that referenced this pull request May 15, 2026
* 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>
@2witstudios
2witstudios deleted the pu/removing-notifs branch May 27, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant