Add calendar/contacts toggle to the right sidebar panel#2593
Add calendar/contacts toggle to the right sidebar panel#2593
Conversation
|
3 potential issues found:
Resolved (3 issues)
This PR replaces the two separate sidebar registrations (
Waiting for CI checks...
|
Replace the separate SidebarParticipantPicker and SidebarPluginContainer registrations with a unified SidebarViewSwitcher that provides a segmented control at the top of the right panel. Users can switch between "Contacts" (the existing participant profile view) and "Calendar" (a compact agenda- style day view showing today's events with day-by-day navigation). New components: - SidebarViewToggle: segmented control for switching views - SidebarCalendarDayView: compact event list using CalendarDataSource - SidebarViewSwitcher: orchestrates toggle + both views https://claude.ai/code/session_016hcccJaZPjExmSfK8Bff8V
Replace the custom SidebarCalendarDayView with SidebarAgendaView that wraps the new AgendaView from main-calendar. The AgendaView provides a multi-day vertical scrolling event list that fits the sidebar well. Sidebar-specific LESS overrides compact the header, event cards, and day headers for the narrow panel width (150-300px). Also rename the "Contacts" tab to "Participants" to better match the existing participant profile terminology. https://claude.ai/code/session_016hcccJaZPjExmSfK8Bff8V
1b19c98 to
123f2c1
Compare
| }; | ||
|
|
||
| _onEventDoubleClick = (event: EventOccurrence) => { | ||
| const el = document.getElementById(event.id); |
There was a problem hiding this comment.
Dead code with a latent bug: AgendaView handles double-click internally via _onAgendaEventDoubleClick (line 184 of agenda-view.tsx) using e.currentTarget, and never calls this.props.onEventDoubleClick. So this handler is never invoked.
Additionally, if it were called, document.getElementById(event.id) would always return null because AgendaView renders event elements with day-unique IDs: id={\${event.id}-${dayKey}`}. The _onEventFocused` handler (line 93) delegates here, so it has the same issue.
Consider removing these handlers and passing no-ops, or fixing the lookup to match the actual DOM IDs.
| @@ -0,0 +1,125 @@ | |||
| import moment, { Moment } from 'moment'; | |||
| import React from 'react'; | |||
| import { Rx, DatabaseStore, Calendar, Actions, localized } from 'mailspring-exports'; | |||
There was a problem hiding this comment.
Unused imports: localized is imported here but never used in this file. Also CalendarView (line 10) is imported but unused.
| import { Rx, DatabaseStore, Calendar, Actions, localized } from 'mailspring-exports'; | |
| import { Rx, DatabaseStore, Calendar, Actions } from 'mailspring-exports'; |
- Hide the Day/Week/Month/Agenda view-controls in the sidebar since we always show the agenda view - Hide the absolutely-positioned "Today" button that overlapped the date range title - Remove the fixed 275px title width so it sizes naturally and centers within the sidebar - Remove aggressive font-size overrides on event cards to preserve the original agenda-view styling - Reduce event-list padding and let the time column auto-size for the narrow sidebar width https://claude.ai/code/session_016hcccJaZPjExmSfK8Bff8V
The AgendaView's LESS styles are all scoped under .mailspring-calendar (the class from MailspringCalendar's KeyCommandsRegion). Since SidebarAgendaView renders AgendaView directly without that parent, none of the .agenda-day, .agenda-event, etc. styles were being applied. Fix by adding the mailspring-calendar class to the sidebar wrapper div, and add flex: 1 to .agenda-scroll-region so it fills the available space. https://claude.ai/code/session_016hcccJaZPjExmSfK8Bff8V
In the full calendar, agenda events use a horizontal two-column layout (time | title+location). In the narrow sidebar this caused time and title to run together on the same line. Use flex-wrap to stack the event content vertically: color-bar on the left, time on the first row, then title and location below, indented to align with the time. https://claude.ai/code/session_016hcccJaZPjExmSfK8Bff8V
Use space-between on .center-controls so the prev/next navigation buttons sit at the left and right edges of the panel, with the date range title centered between them via flex: 1. https://claude.ai/code/session_016hcccJaZPjExmSfK8Bff8V
Replace flex-wrap approach with a 2-column CSS grid on .agenda-event: the color bar spans all rows in the first column, while time and details stack vertically in the second column with no gap. This eliminates the blank space that appeared when details wrapped to a separate flex row. https://claude.ai/code/session_016hcccJaZPjExmSfK8Bff8V
codeCraft-Ritik
left a comment
There was a problem hiding this comment.
Well structured code, especially the separation of concerns
Replace the separate SidebarParticipantPicker and SidebarPluginContainer
registrations with a unified SidebarViewSwitcher that provides a segmented
control at the top of the right panel. Users can switch between "Contacts"
(the existing participant profile view) and "Calendar" (a compact agenda-
style day view showing today's events with day-by-day navigation).
New components:
https://claude.ai/code/session_016hcccJaZPjExmSfK8Bff8V