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.
This commit is contained in:
1 parent
c99465153d
commit
1633bc9293
20 files changed
+1417
-30
No files matched your search
+15
-2
@@ -8,9 +8,10 @@ use gpui::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
data_display::Avatar,
|
||||
motion,
|
||||
primitives::{Icon, IconName, raise},
|
||||
theme::{ActiveTheme, ControlSize, Elevation, IconSize, Radius, TextSize},
|
||||
theme::{ActiveTheme, AvatarSize, ControlSize, Elevation, IconSize, Radius, TextSize},
|
||||
typography::Ellipsis,
|
||||
};
|
||||
|
||||
@@ -20,6 +21,7 @@ pub struct Choice {
|
||||
pub value: SharedString,
|
||||
pub label: SharedString,
|
||||
pub icon: Option<IconName>,
|
||||
pub avatar: Option<SharedString>,
|
||||
pub note: Option<SharedString>,
|
||||
pub disabled: bool,
|
||||
pub depth: usize,
|
||||
@@ -31,6 +33,7 @@ impl Choice {
|
||||
value: value.into(),
|
||||
label: label.into(),
|
||||
icon: None,
|
||||
avatar: None,
|
||||
note: None,
|
||||
disabled: false,
|
||||
depth: 0,
|
||||
@@ -48,6 +51,12 @@ impl Choice {
|
||||
self
|
||||
}
|
||||
|
||||
/// Leads with the initials of `name` on its tone, as a person's row does.
|
||||
pub fn avatar(mut self, name: impl Into<SharedString>) -> Self {
|
||||
self.avatar = Some(name.into());
|
||||
self
|
||||
}
|
||||
|
||||
/// Quiet text at the row's end, such as a count or a shortcut.
|
||||
pub fn note(mut self, note: impl Into<SharedString>) -> Self {
|
||||
self.note = Some(note.into());
|
||||
@@ -100,6 +109,7 @@ pub(crate) fn marked_row(
|
||||
checked: Option<bool>,
|
||||
cx: &App,
|
||||
) -> Stateful<Div> {
|
||||
let id = id.into();
|
||||
let theme = cx.theme();
|
||||
let colors = &theme.colors;
|
||||
let fg = if choice.disabled {
|
||||
@@ -108,7 +118,7 @@ pub(crate) fn marked_row(
|
||||
colors.fg
|
||||
};
|
||||
div()
|
||||
.id(id)
|
||||
.id(id.clone())
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_2()
|
||||
@@ -140,6 +150,9 @@ pub(crate) fn marked_row(
|
||||
.when_some(choice.icon, |row, icon| {
|
||||
row.child(Icon::new(icon).size(IconSize::Sm).color(colors.fg_muted))
|
||||
})
|
||||
.when_some(choice.avatar.clone(), |row, name| {
|
||||
row.child(Avatar::new((id, "avatar"), name).size(AvatarSize::Xs))
|
||||
})
|
||||
.children(mark)
|
||||
.child(
|
||||
div()
|
||||
|
||||
+9
-1
@@ -12,8 +12,9 @@ use super::{
|
||||
options::{OnValue, Pick, Popup, Run, reveal, step},
|
||||
};
|
||||
use crate::{
|
||||
data_display::Avatar,
|
||||
primitives::{Icon, IconName, tab_stop},
|
||||
theme::{ActiveTheme, ControlSize, IconSize, Radius},
|
||||
theme::{ActiveTheme, AvatarSize, ControlSize, IconSize, Radius},
|
||||
typography::Ellipsis,
|
||||
};
|
||||
|
||||
@@ -330,6 +331,13 @@ impl RenderOnce for Select {
|
||||
trigger.child(Icon::new(icon).size(IconSize::Sm).color(colors.fg_muted))
|
||||
},
|
||||
)
|
||||
.when_some(
|
||||
shown.as_ref().and_then(|choice| choice.avatar.clone()),
|
||||
|trigger, name| {
|
||||
let id = (self.id.clone(), "avatar");
|
||||
trigger.child(Avatar::new(id, name).size(AvatarSize::Xs))
|
||||
},
|
||||
)
|
||||
.child(field_text(
|
||||
shown.map(|choice| choice.label),
|
||||
self.placeholder,
|
||||
|
||||
Reference in new issue
Block a user