Mail · Sorting: a label picker and a snooze menu

LabelPicker puts labels on a message: a field finds them by name,
arrows move and a press or Enter turns one on or off, each row with its
check and its hue. A name no label has can be made into one, and the
field starts over. Its rows are the option rows every list shares;
forms::marked_row leads one with a mark. The cursor shows only while
the field has focus.

SnoozePicker offers later today, tomorrow, this weekend and next week,
each with its day and hour, or a time picked in a dialog. It shares
mail::times with ScheduleSend: the names, the dialog, which now waits
for a time ahead of now, and a rule that a moment comes once, so on a
Sunday tomorrow morning no longer repeats as Monday morning.
This commit is contained in:
ZacharyZhang-NY committed 2026-09-27 01:16:24 -04:00
1 parent 14b5faa80c
commit ccbc0970e5
16 files changed
+1037 -144

No files matched your search

+6 -11
View File
@@ -1,10 +1,11 @@
use ely_gpui_component::{
chat::Attachment,
mail::{Contact, MailComposer, ScheduleSend, SignatureEditor},
theme::{ActiveTheme, Radius, TextSize},
theme::{ActiveTheme, Radius},
};
use gpui::{App, IntoElement, ParentElement, SharedString, Styled, Window, div, px};
use super::{day_and_hour, quiet};
use crate::{
probe::probe,
ui::{change, keep, section, set},
@@ -39,14 +40,6 @@ struct Writing {
said: Option<SharedString>,
}
fn quiet(text: SharedString, cx: &App) -> impl IntoElement + use<> {
let theme = cx.theme();
div()
.text_size(theme.text_size(TextSize::Sm))
.text_color(theme.colors.fg_muted)
.child(text)
}
pub fn composer(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
let writing = keep(
"mail-writing",
@@ -83,7 +76,7 @@ pub fn composer(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
change(&sent, cx, |writing| writing.said = Some(said.into()))
})
.on_schedule(move |draft, at, _, cx| {
let said = format!("{} will go at {at}.", draft.subject);
let said = format!("{} goes {}.", draft.subject, day_and_hour(at));
change(&later, cx, |writing| writing.said = Some(said.into()))
})
.on_discard(move |_, cx| {
@@ -164,7 +157,9 @@ pub fn schedule(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
.child(
ScheduleSend::new("mail-schedule")
.on_send(move |_, cx| set(&sent, Some("Sent now.".into()), cx))
.on_schedule(move |at, _, cx| set(&later, Some(format!("Goes at {at}.").into()), cx)),
.on_schedule(move |at, _, cx| {
set(&later, Some(format!("Goes {}.", day_and_hour(at)).into()), cx)
}),
)
.children(shown.map(|shown| quiet(shown, cx))),
))