facett-calendar — design note
Status: builds (egui 0.33 + chrono) + 4 unit tests green. In ordning/crates/widgets/facett-calendar; destined for facett.
What it is
A Monday-first (Swedish/ISO week) month grid with a date picker and marked events: case deadlines (SLA/handläggningstid due), statutory frister (e.g. FL §12 six-month mark), planned absence (drives the handover model), and appointments (hearings/sammanträden). Navigate months; click a day to select; days with events show a colored dot + count (strongest event kind by rank wins the color).
API
let mut cal = Calendar::new("Frister", 2026, 6).with_today(today); // host supplies "today"
cal.set_events(vec![ Event{ date, label, kind: EventKind::Frist, case: Some("ÖK-3".into()) }, … ]);
if let Some(date) = cal.ui(ui) { /* user clicked a day */ }
let picked = cal.selected_date();
Design decisions
- Deterministic / testable: the widget never reads the clock — the host passes the displayed month and an optional
todaymarker. Sostate_jsonand behavior are reproducible (tests assert exact months/markers). (Mirrors the nornir/facett "noDate::nowin code you want to test/replay" discipline.) - Monday-first + Swedish month/day names — the public-sector audience. (Locale becomes a setting when it moves to facett.)
- Event kinds rank (Frist > Deadline > Appointment > Absence) so the most urgent color shows on a day with several events; the count badge shows there's more.
EventKind::Fristis red — the legally hard deadline. - Today marked with the Tillsynia-yellow accent bar (matches the design system).
state_jsonexposes the displayed month, selection, today, and all marked events (date/kind/ label/case) — headless-observable.
Move-to-facett notes
- Add
impl facett_core::Facetunder afacettfeature;caps() = SELECTABLE. - Swap hardcoded colors for
facett_core::theme()ramps; the yellow "today" bar → theme accent. - Add a week and day view (the facet cycles month/week/day like the manual's view switch).
- Hook the absence events to the availability model so a handläggare's leave shows here and triggers the auto-handover (manual ch.07).
TODO when it matures
- Range select (for entering an absence span).
- Drag an event to reschedule (with host validation, like kanban's drag-to-transition).
- Keyboard navigation (arrows move the selected day; Enter picks).