diff options
Diffstat (limited to 'src/gui/update.rs')
-rw-r--r-- | src/gui/update.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gui/update.rs b/src/gui/update.rs index bd4e7a9..7b3625c 100644 --- a/src/gui/update.rs +++ b/src/gui/update.rs @@ -166,24 +166,32 @@ pub async fn event_handler(rx: Receiver<Msg>, mut app: App) { refresh(&app, &HashSet::from([date])) } Msg::SelectPreviousWeek => { - app.grid.remove_row(4); - app.grid.insert_row(1); + app.calendar.remove_row(4); + app.calendar.insert_row(1); app.start_date -= Duration::days(7); app.end_date -= Duration::days(7); - match db::list_non_recurring_between(&app.conn, app.start_date, app.end_date) { + match db::events::list_non_recurring_between( + &app.conn, + app.start_date, + app.end_date, + ) { Ok(events) => app.events = events, Err(err) => eprintln!("{}", err), }; refresh(&app, &HashSet::from_iter(week_from(app.start_date))); } Msg::SelectNextWeek => { - app.grid.remove_row(1); - app.grid.insert_row(4); + app.calendar.remove_row(1); + app.calendar.insert_row(4); app.start_date += Duration::days(7); app.end_date += Duration::days(7); - match db::list_non_recurring_between(&app.conn, app.start_date, app.end_date) { + match db::events::list_non_recurring_between( + &app.conn, + app.start_date, + app.end_date, + ) { Ok(events) => app.events = events, Err(err) => eprintln!("{}", err), }; @@ -275,7 +283,7 @@ fn refresh(app: &App, dates: &HashSet<NaiveDate>) { for date in dates { if date >= &app.start_date && date <= &app.end_date { - calendar::refresh_date(app, *date, &repetitions) + calendar::refresh_date(app, *date, &repetitions, &app.categories, &app.default_color) } } } |