From b25082b60450e2dc311983808fc0b9064a8393c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 26 Aug 2026 19:53:49 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20fix(detail):=20the=20modal's=20c?= =?UTF-8?q?ontrols=20wear=20the=20house?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The file input hides behind an Attach label and the pick itself submits the form — the Upload button is gone. The native date popup is replaced by a house calendar (month grid, today ringed, chosen day filled, Clear and Today); the value still travels as the same hidden deadline field. The assignee chip carries the full display name, ellipsized by CSS rather than cut at the first word. --- Cargo.lock | 1 + crates/izlek-web/Cargo.toml | 2 + crates/izlek-web/src/detail.rs | 224 ++++++++++++++++++++++++++++++--- style/main.scss | 106 ++++++++++++++-- 4 files changed, 305 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c14b287..477306f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1876,6 +1876,7 @@ dependencies = [ "axum", "console_error_panic_hook", "izlek-core", + "js-sys", "leptos", "leptos_axum", "leptos_meta", diff --git a/crates/izlek-web/Cargo.toml b/crates/izlek-web/Cargo.toml index e89f641..38736e8 100644 --- a/crates/izlek-web/Cargo.toml +++ b/crates/izlek-web/Cargo.toml @@ -39,6 +39,7 @@ serde_json = { workspace = true, optional = true } console_error_panic_hook = { version = "0.1.7", optional = true } wasm-bindgen = { version = "0.2", optional = true } +js-sys = { version = "0.3", optional = true } [features] default = [] @@ -46,6 +47,7 @@ hydrate = [ "leptos/hydrate", "dep:console_error_panic_hook", "dep:wasm-bindgen", + "dep:js-sys", ] ssr = [ "leptos/ssr", diff --git a/crates/izlek-web/src/detail.rs b/crates/izlek-web/src/detail.rs index 9fed9b1..3a79e36 100644 --- a/crates/izlek-web/src/detail.rs +++ b/crates/izlek-web/src/detail.rs @@ -983,6 +983,43 @@ fn DeadlineControl( }); let toggle = format!("deadline-{}", task_id.get_value()); + let initial = parse_ymd(&deadline_input); + let chosen = RwSignal::new(deadline_input); + let view_pos = RwSignal::new(initial.map(|(y, m, _)| (y, m)).unwrap_or((1970, 1))); + let today = RwSignal::new(None::<(i32, u8, u8)>); + Effect::new(move |_| { + #[cfg(feature = "hydrate")] + { + let now = js_sys::Date::new_0(); + let day = ( + now.get_full_year() as i32, + now.get_month() as u8 + 1, + now.get_date() as u8, + ); + today.set(Some(day)); + if initial.is_none() { + view_pos.set((day.0, day.1)); + } + } + }); + + // Copy, not moved: this fires from three separate buttons in the grid and + // footer, and each needs its own call. + let close = move || { + #[cfg(feature = "hydrate")] + { + use leptos::wasm_bindgen::JsCast; + let toggle = format!("deadline-{}", task_id.get_value()); + if let Some(input) = leptos::web_sys::window() + .and_then(|w| w.document()) + .and_then(|doc| doc.get_element_by_id(&toggle)) + .and_then(|el| el.dyn_into::().ok()) + { + input.set_checked(false); + } + } + }; + Either::Right(view! {
{deadline_label} {glyph::chevron()} -
+
- + +
+ + {move || month_title(view_pos.get())} + +
+
+ "M" + "T" + "W" + "T" + "F" + "S" + "S" +
+
+ {move || { + let pos = view_pos.get(); + let selected = parse_ymd(&chosen.get()).map(|(y, m, d)| (y, m, d)); + let today_ymd = today.get(); + month_cells(pos) + .into_iter() + .map(|cell| { + match cell { + None => view! { }.into_any(), + Some(day) => { + let is_today = today_ymd == Some((pos.0, pos.1, day)); + let is_selected = selected == Some((pos.0, pos.1, day)); + view! { + + } + .into_any() + } + } + }) + .collect_view() + }} +
+
+ + +
+ + ().ok() + }) + { + if let Some(form) = input.form() { + let _ = form.request_submit(); + } + } + } + } + /> {refused(upload_refusal)} } @@ -1630,20 +1826,12 @@ fn AssigneeChip( }); let name = person.display_name.clone(); let person_id = person.id.clone(); - // A chip carries a first name or no name at all. Half a name with an - // ellipsis after it — "Be…" — is noise where a name should be, and an - // avatar on its own still says who it is. - let full_name = name.clone(); - let first_name = name - .split_whitespace() - .next() - .unwrap_or(name.as_str()) - .to_owned(); + let remove_title = format!("Take {name} off this task"); view! { - + - {first_name} + {name.clone()} {may_write .then(|| { view! { @@ -1653,7 +1841,7 @@ fn AssigneeChip( diff --git a/style/main.scss b/style/main.scss index 3c96b85..511dbe9 100644 --- a/style/main.scss +++ b/style/main.scss @@ -1033,16 +1033,98 @@ a { .glyph { color: #a04a24; } } -.detail-date { - width: 100%; - height: 32px; - padding: 0 8px; - border: 1px solid var(--border-strong); - border-radius: var(--radius); - background: var(--surface); +// -- deadline calendar ------------------------------------------------------- + +.datepick-panel { width: 190px; } + +.datepick-head { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 6px; +} + +.datepick-title { + font-family: var(--font-mono); + font-size: 11px; + color: var(--ink); +} + +.datepick-nav { + display: inline-flex; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + border: none; + border-radius: 4px; + background: transparent; + color: var(--muted); + cursor: pointer; + + &:hover { background: #f3f1ea; } +} + +.datepick-prev .glyph { transform: rotate(90deg); } +.datepick-next .glyph { transform: rotate(-90deg); } + +.datepick-weekdays, +.datepick-grid { + display: grid; + grid-template-columns: repeat(7, 1fr); +} + +.datepick-weekdays { + margin-bottom: 2px; + font-family: var(--font-mono); + font-size: 10px; + color: var(--muted-soft); + text-align: center; +} + +.datepick-cell { + height: 24px; + border: none; + background: transparent; font-family: inherit; - font-size: 13px; + font-size: 11px; +} + +.datepick-day { + border-radius: 5px; color: var(--ink); + cursor: pointer; + + &:hover { background: #f3f1ea; } +} + +.datepick-today { box-shadow: inset 0 0 0 1px var(--accent); } + +.datepick-selected { + background: var(--accent); + color: var(--surface); + + &:hover { background: var(--accent); } +} + +.datepick-foot { + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 6px; + padding-top: 6px; + border-top: 1px solid var(--border); +} + +.datepick-action { + border: none; + background: transparent; + font-family: inherit; + font-size: 11px; + color: var(--accent); + cursor: pointer; + + &:hover { color: var(--accent-ink); } } // -- assignees -------------------------------------------------------------- @@ -1058,8 +1140,9 @@ a { border-radius: var(--radius); } -// Chips never shrink and never truncate: the row gives up labels instead, and -// what is left is a whole first name or an avatar on its own. +// Chips never shrink: the row gives up labels instead, and what is left is a +// whole name or an avatar on its own. A name too long for the row ellipsizes +// rather than losing whole words. .assignee-chip { display: inline-flex; flex: none; @@ -1073,6 +1156,9 @@ a { } .assignee-name { + max-width: 120px; + overflow: hidden; + text-overflow: ellipsis; font-size: 12px; color: var(--ink); }