feat(calendar): context-aware sidebar date clicks (Calendar view vs Journal) - #269
Merged
Conversation
The global right-sidebar mini-calendar previously always navigated to the Journal tab on day click. When the user is actively working in the Calendar tab this was disruptive — it yanked them out of their Month/Week/Year view just to focus a date. Make the sidebar context-aware: when the Calendar tab is the active tab, clicking a day (or the Today button) re-anchors the current calendar view in place, without a tab switch. All four views (day/week/month/year) are handled by the existing anchor-driven range logic — no per-view branching. For every other active tab, behavior is unchanged (opens Journal at that date). - New CalendarViewContext shares anchorDate across CalendarPage and GlobalDayPanel so the sidebar can drive the view. - GlobalDayPanel branches handleDateSelect/handleTodayClick on useActiveTab()?.type === 'calendar'. - Central test wrapper (renderWithProviders) wraps the new provider so existing CalendarPage tests continue to render.
h4yfans
added a commit
that referenced
this pull request
Apr 18, 2026
The renderer-level week-view quick-create test fought two jsdom limitations after main merged in the virtualized horizontal scroll (PR #269-era change): the week grid now keys popover rendering on absolute day indices via @tanstack/react-virtual, which needs ResizeObserver + real box geometry to render any visible columns. jsdom's zero-sized layout produces no visible virtual items, so the popover never mounts. The Electron E2E test already covers the week-view quick-create flow against a real Chromium runtime with real layout. Drop the renderer-layer duplicate and leave a comment explaining why.
h4yfans
added a commit
that referenced
this pull request
Apr 18, 2026
The renderer-level week-view quick-create test fought two jsdom limitations after main merged in the virtualized horizontal scroll (PR #269-era change): the week grid now keys popover rendering on absolute day indices via @tanstack/react-virtual, which needs ResizeObserver + real box geometry to render any visible columns. jsdom's zero-sized layout produces no visible virtual items, so the popover never mounts. The Electron E2E test already covers the week-view quick-create flow against a real Chromium runtime with real layout. Drop the renderer-layer duplicate and leave a comment explaining why.
h4yfans
added a commit
that referenced
this pull request
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The global right-sidebar mini-calendar now behaves based on the active tab:
The Today button in the sidebar follows the same branch.
Why
Before this change, every sidebar day click navigated to the Journal tab — disruptive when the user is actively working in Calendar, since it yanked them out of their Month/Week/Year view just to focus a date. Making the sidebar context-aware lets the same UI serve both workflows: fast navigation inside Calendar, and quick journaling from anywhere else.
How
CalendarViewContext(apps/desktop/src/renderer/src/contexts/calendar-view-context.tsx) — holds the singleanchorDateshared betweenCalendarPageandGlobalDayPanel. Mirrors theDayPanelContextpattern (null sentinel + throwing hook).GlobalDayPanelbrancheshandleDateSelect/handleTodayClickonuseActiveTab()?.type === 'calendar'.CalendarPageswaps its localuseState(getTodayDate)foruseCalendarView(). No other handler changes — the ReactuseStatesetter identity is preserved through context, sosetAnchorDate((current) => ...)functional updates inhandlePrevious/handleNextkeep working.getRangeForView(view, anchorDate)already derives day/week/month/year ranges from a single anchor, so settinganchorDate = clickedDatere-centers whichever view is active. No per-view code.tests/utils/render.tsxwraps the new provider inside the existingDayPanelProvider— one edit fixed all 3 calendar test files without per-test churn.Type
feat— new featureTest plan
renderWithProviderswrapper)pnpm --filter desktop typecheck:webclean,pnpm lint0 errors,pnpm test— 6912 passed, 0 failed.Checklist