Add date picker and task improvements

This commit is contained in:
2026-09-10 14:08:54 +02:00
parent cd00f19c4c
commit c520847146
10 changed files with 499 additions and 57 deletions
+26 -6
View File
@@ -6,6 +6,7 @@ use crate::components::action_button::ActionButton;
use crate::components::button::Dropdown;
use crate::components::chip::{Chip, ChipVariant};
use crate::components::confirm_dialog::ConfirmDialog;
use crate::components::date_picker::DatePicker;
use crate::components::field_row::{FieldRow, KvRow};
use crate::components::input::Input;
use crate::components::label::Label;
@@ -116,7 +117,7 @@ pub(super) fn render_task_detail_panel<OnCloseClick>(
annotation_input: &gpui::Entity<Input>,
description_input: &gpui::Entity<Input>,
project_input: &gpui::Entity<Input>,
due_input: &gpui::Entity<Input>,
due_picker: &gpui::Entity<DatePicker>,
tags_input: &gpui::Entity<Input>,
status_dropdown: &gpui::Entity<Dropdown>,
priority_dropdown: &gpui::Entity<Dropdown>,
@@ -246,7 +247,7 @@ where
&priority_label,
description_input,
project_input,
due_input,
due_picker,
status_dropdown,
priority_dropdown,
theme,
@@ -468,7 +469,7 @@ fn render_overview_section(
priority_label: &str,
description_input: &gpui::Entity<Input>,
project_input: &gpui::Entity<Input>,
due_input: &gpui::Entity<Input>,
due_picker: &gpui::Entity<DatePicker>,
status_dropdown: &gpui::Entity<Dropdown>,
priority_dropdown: &gpui::Entity<Dropdown>,
theme: &Theme,
@@ -588,14 +589,33 @@ fn render_overview_section(
let due_value = if is_editing {
let focused = modal_focus == ModalFocus::Due;
let theme_clone = theme.clone();
let picker_clone = due_picker.clone();
crate::ui::focus_wrap(due_input.clone(), focused, theme)
gpui::div()
.relative()
.when(focused, |d| {
d.border_2()
.border_color(theme_clone.focus_ring)
.rounded_md()
.p_px()
})
.on_mouse_down(
gpui::MouseButton::Left,
cx.listener(|modal, _, window, cx| {
modal.set_modal_focus_and_edit(ModalFocus::Due, Some(window), cx);
cx.listener(move |modal, _, window, cx| {
modal.set_modal_focus(ModalFocus::Due, Some(window), cx);
let picker = picker_clone.clone();
cx.defer(move |cx| {
picker.update(cx, |d, cx| {
if !d.is_open() {
d.open(cx);
}
});
});
}),
)
.child(due_picker.clone())
.into_any_element()
} else {
value_label(due_text, theme.foreground)