Add mini-calendar sidebar to Calendar TUI

- Add MonthCalendar widget as a collapsible sidebar (toggle with 's')
- Sidebar syncs with main week grid (week highlight, selected date)
- Click dates in sidebar to navigate week grid to that date
- Click month navigation arrows to change displayed month
- Add goto_date() method to WeekGrid for date navigation
This commit is contained in:
Bendt
2025-12-19 10:40:33 -05:00
parent 48d2455b9c
commit a82f001918
3 changed files with 116 additions and 1 deletions

View File

@@ -761,3 +761,20 @@ class WeekGrid(Vertical):
event = self.get_event_at_cursor()
if event:
self.post_message(self.EventSelected(event))
def goto_date(self, target_date: date) -> None:
"""Navigate to a specific date.
Sets the week to contain the target date and places cursor on that day.
"""
# Get the week start for the target date
week_start_date = get_week_start_for_date(target_date)
if self.week_start != week_start_date:
self.week_start = week_start_date
# Set cursor column to the target date
col = get_day_column_for_date(target_date, self.week_start)
if not self.include_weekends and col >= 5:
col = 4 # Last weekday if weekend
self.cursor_col = col