Project · Tasks: priorities, issues, statuses, assignees, task rows

A new chapter, src/project. PriorityIndicator shows how urgent a task
is in three bars, urgent in red, its words in a tip or beside it.
IssueIdBadge names an issue by its team's key and number, as ENG-123.
StatusSelect picks a status from the workflow, each with its mark, and
AssigneePicker picks a person or no one; DueDatePicker is the forms
DatePicker. TaskItem is a task in a row: its box, priority and issue,
its title, then its due day, red when past and still open, and who has
it. TaskList puts them in a SelectableList: arrows move, Enter opens,
and a box's press or keys stay at the box. SubtaskList is the
documents Checklist, which gains a field that adds a step on Enter.

Along the way: forms::Choice::avatar leads a person's row with their
initials, in lists and in a Select's trigger; ListItem::struck strikes
a closed task's title; typography::Ellipsis now shapes with the text
style's run, so a strike or underline on its box shows; two Lucide
icons, circle-dashed and circle-dot-dashed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-09-27 04:48:54 -04:00
1 parent e2eb1cfc41
commit 9b506e5d54
20 files changed
+1417 -30

No files matched your search

+36 -5
View File
@@ -1,12 +1,12 @@
use std::rc::Rc;
use gpui::{
App, ElementId, FontWeight, IntoElement, ParentElement, RenderOnce, SharedString, Styled,
Window, div, prelude::*,
App, ElementId, FontWeight, InteractiveElement, IntoElement, ParentElement, RenderOnce,
SharedString, Styled, Window, div, prelude::*,
};
use crate::{
forms::{Checkbox, OnFlag},
forms::{Checkbox, Enter, Input, OnFlag, OnValue, TextInput},
motion::ProgressBar,
theme::{ActiveTheme, TextSize},
typography::tabular,
@@ -59,13 +59,14 @@ impl RenderOnce for TodoItem {
}
}
/// To-dos under a title, with how many are done as a count and a bar.
/// To-dos under a title, with how many are done as a count and a bar. With `on_add`, a field under them adds one.
#[derive(IntoElement)]
pub struct Checklist {
id: ElementId,
title: SharedString,
items: Vec<(SharedString, bool)>,
on_toggle: Option<OnItem>,
adding: Option<(SharedString, OnValue)>,
}
impl Checklist {
@@ -82,9 +83,20 @@ impl Checklist {
.map(|(label, done)| (label.into(), done))
.collect(),
on_toggle: None,
adding: None,
}
}
/// A field under the items: Enter hands on its words, trimmed, and clears it.
pub fn on_add(
mut self,
placeholder: impl Into<SharedString>,
handler: impl Fn(&SharedString, &mut Window, &mut App) + 'static,
) -> Self {
self.adding = Some((placeholder.into(), Rc::new(handler)));
self
}
/// Tells which item changed, by index, and whether it is now done.
pub fn on_toggle(
mut self,
@@ -96,7 +108,25 @@ impl Checklist {
}
impl RenderOnce for Checklist {
fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement {
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement {
let add = self.adding.map(|(placeholder, on_add)| {
let field = window.use_keyed_state((self.id.clone(), "add"), cx, |window, cx| {
TextInput::new(window, cx).placeholder(placeholder)
});
let (id, typed) = (self.id.clone(), field.clone());
div()
.capture_action(move |_: &Enter, window, cx| {
let words = typed.read(cx).text().trim().to_string();
if words.is_empty() {
return;
}
cx.stop_propagation();
log::info!("checklist {id:?}: add {words}");
typed.update(cx, |input, cx| input.set_text(String::new(), cx));
on_add(&words.into(), window, cx);
})
.child(Input::new(&field))
});
let theme = cx.theme();
let done = self.items.iter().filter(|(_, done)| *done).count();
let total = self.items.len();
@@ -142,5 +172,6 @@ impl RenderOnce for Checklist {
}
}),
)
.children(add)
}
}