diff --git a/crates/izlek-web/src/board.rs b/crates/izlek-web/src/board.rs index 7618483..1aa4ec8 100644 --- a/crates/izlek-web/src/board.rs +++ b/crates/izlek-web/src/board.rs @@ -490,6 +490,7 @@ async fn card_menu_script(cx: &Cx) -> Result { #[query_params(error = redirect("/"))] struct BoardQuery { task: Option, + tab: Option, file: Option, refusal: Option, on: Option, @@ -585,7 +586,7 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result { if let Some(task_id) = &open_task { - (crate::detail::task_modal(cx, task_id, query.confirm.as_deref() == Some("delete")).await?) + (crate::detail::task_modal(cx, task_id, query.confirm.as_deref() == Some("delete"), crate::detail::Tab::from_query(query.tab.as_deref())).await?) if let Some(file_id) = &query.file { (crate::detail::file_viewer_modal(cx, task_id, file_id).await?) } diff --git a/crates/izlek-web/src/detail.rs b/crates/izlek-web/src/detail.rs index b40a584..4055961 100644 --- a/crates/izlek-web/src/detail.rs +++ b/crates/izlek-web/src/detail.rs @@ -1328,9 +1328,54 @@ async fn comment_row(cx: &Cx, comment: &Comment, zone: UtcOffset) -> Result { /// The task modal's markup: title, description, assignees, deadline, /// dependencies, files, comments, activity and delete, exactly as the +/// Which region of the task detail panel is showing. Only one is drawn at a +/// time; a `tab=` name it does not recognize falls back to `Task`, same as +/// `logs.rs`/`settings.rs`'s own rail sections. +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum Tab { + Task, + Files, + Comments, + Activity, + Mail, +} + +impl Tab { + pub fn from_query(tab: Option<&str>) -> Tab { + match tab { + Some("files") => Tab::Files, + Some("comments") => Tab::Comments, + Some("activity") => Tab::Activity, + Some("mail") => Tab::Mail, + _ => Tab::Task, + } + } + + fn slug(self) -> &'static str { + match self { + Tab::Task => "task", + Tab::Files => "files", + Tab::Comments => "comments", + Tab::Activity => "activity", + Tab::Mail => "mail", + } + } +} + +/// The class a tab link wears: lit on the tab it points to when that is the +/// one showing, plain otherwise — same idiom as `logs.rs`/`settings.rs`'s +/// `rail_class`. +fn tab_class(current: Tab, target: Tab) -> &'static str { + if current == target { + "detail-tab detail-tab-on" + } else { + "detail-tab" + } +} + /// artboard draws them. Wiring `?task=` on the board page is a later /// integration slice — this only renders the fragment. -pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result { +pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) -> Result { let snapshot = match load_snapshot(cx, task_id).await? { Ok(snapshot) => snapshot, Err(refusal) => { @@ -1394,7 +1439,10 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result