Calendar · Time grid: week and day views, drag to make and to resize
TimeGrid sets days side by side under a column of hours. Each event is a card by its hours, clipped to each day it touches, and events that overlap share the width in lanes. A drag on empty time makes an event by quarter hours through forms::pen; a drag on an event's lower edge, on the day it ends, moves its end, each drag checked against its owner. The grid opens at half past seven, or an hour and a half before now when today is shown and that is later. CurrentTimeIndicator marks the minute now on today and moves with the clock. TimezoneOverlay adds another zone's hours beside the grid's. AllDayRow lays whole days across their columns in lanes. CalendarWeekView and CalendarDayView are one view of seven days or one: a header that steps and comes back to today, the days' names stacked so they fit narrow columns, the whole days, then the hours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f316ab56ba
commit
a41cb2f9c2
18 files changed
+1577
-36
No files matched your search
@@ -7,7 +7,7 @@ use gpui::{
|
||||
};
|
||||
use jiff::civil::Date;
|
||||
|
||||
use super::{events, here, quiet};
|
||||
use super::{events, here, plan, quiet};
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{change, keep, section, set},
|
||||
@@ -37,11 +37,12 @@ fn viewing(window: &mut Window, cx: &mut App) -> Entity<Viewing> {
|
||||
}
|
||||
|
||||
pub fn month(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
let (zone, today) = here();
|
||||
let (zone, _) = here();
|
||||
let viewing = viewing(window, cx);
|
||||
let now = viewing.read(cx).clone();
|
||||
let (turned, opened, pressed) = (viewing.clone(), viewing.clone(), viewing);
|
||||
let view = CalendarMonthView::new("calendar-month", now.month, events(today, &zone))
|
||||
let events = plan(window, cx).read(cx).clone();
|
||||
let view = CalendarMonthView::new("calendar-month", now.month, events)
|
||||
.zone(zone)
|
||||
.on_month(move |first, _, cx| change(&turned, cx, |viewing| viewing.month = first))
|
||||
.on_day(move |day, _, cx| {
|
||||
@@ -92,6 +93,7 @@ pub fn mini(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
|
||||
pub fn year(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
let (zone, today) = here();
|
||||
let events = plan(window, cx).read(cx).clone();
|
||||
let said = keep("calendar-year-said", || None::<SharedString>, window, cx);
|
||||
let shown = said.read(cx).clone();
|
||||
section(
|
||||
@@ -107,7 +109,7 @@ pub fn year(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
.flex_col()
|
||||
.gap_3()
|
||||
.child(
|
||||
YearView::new("calendar-year", today.year(), events(today, &zone))
|
||||
YearView::new("calendar-year", today.year(), events)
|
||||
.zone(zone)
|
||||
.on_day(move |day, _, cx| {
|
||||
let opened = format!("Opened {}.", day.strftime("%A, %B %-d"));
|
||||
|
||||
Reference in new issue
Block a user