Calendar · Months: a month view, a year view, event chips and cards

CalendarMonthView lays a month in week rows. An event across days lies
over them as a bar in the first free lane, cut at the week's edge;
the rest sit by the hour as chips, and a crowded day keeps the rest
behind "N more". Arrows move a day, Page keys turn the month, and
Enter or a double press opens the day; the cursor holds through the
owner's echo of a turn. Days sit at sevenths of their row, as the bars
do, so text never widens a column.

YearView shows twelve small months; a day with something on it wears a
dot in its first event's hue. EventChip is an event in a line and
EventCard a block with its hours and place. MiniCalendar points to
forms::Calendar. Palette::hue is now the one home for a chart color by
index, for mail labels and events alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-09-27 02:49:37 -04:00
1 parent c1a5603184
commit f316ab56ba
22 files changed
+2121 -20

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
use gpui::Rems;
use super::{Theme, tokens::px_to_rems};
/// Calendar's measures.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CalendarSizes {
/// An event's chip in a day, tall.
pub chip: Rems,
/// Rows of events a month's day holds under its number.
pub day_rows: usize,
/// A day in a year's small months, square.
pub mini_day: Rems,
}
impl Theme {
pub fn calendar(&self) -> CalendarSizes {
CalendarSizes {
chip: px_to_rems(20.0),
day_rows: 3,
mini_day: px_to_rems(28.0),
}
}
}
+2
View File
@@ -1,3 +1,4 @@
mod calendar;
mod chart;
mod files;
mod generative;
@@ -11,6 +12,7 @@ use std::time::{Duration, Instant};
use gpui::{App, Global, SharedString, WindowAppearance};
use crate::motion;
pub use calendar::CalendarSizes;
pub use chart::ChartSizes;
pub use files::FileSizes;
pub use generative::GenerativeSizes;
+8
View File
@@ -118,6 +118,14 @@ fn c8<const N: usize>(hex: [u32; N]) -> [Hsla; N] {
}
impl Palette {
/// The chart color at `hue`; a hue past the chart fails, naming `owner`.
pub fn hue(&self, hue: usize, owner: impl std::fmt::Display) -> Hsla {
*self
.chart
.get(hue)
.unwrap_or_else(|| panic!("{owner}: no chart hue {hue}"))
}
pub fn light(high_contrast: bool) -> Self {
let mut palette = Self {
bg: c(0xfcfaf7),