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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user