forge
Explore
Log in

Don't you dare go Hollow

The task detail takes tabs — one room at a time

Browse files at this commit

6d8b4a6823042efbe15e78dfe81ff8b758907d08Ahmet Kaan GümüşParent: 6b0ddff98549c1
  • feat
    • the task detail takes tabs — one room at a time
Show full message
✨ feat(web): the task detail takes tabs — one room at a time

Merges task-detail-tabs. Tests that read files, notifications or activity
now ask for the tab those regions moved to.
crates/izlek-web/src/board.rsmodified+2 -1
@@ -490,6 +490,7 @@ async fn card_menu_script(cx: &Cx) -> Result {
490 #[query_params(error = redirect("/"))]490 #[query_params(error = redirect("/"))]
491 struct BoardQuery {491 struct BoardQuery {
492 task: Option<String>,492 task: Option<String>,
493+ tab: Option<String>,
493 file: Option<String>,494 file: Option<String>,
494 refusal: Option<String>,495 refusal: Option<String>,
495 on: Option<String>,496 on: Option<String>,
@@ -585,7 +586,7 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result {
585 </div>586 </div>
586 </main>587 </main>
587 if let Some(task_id) = &open_task {588 if let Some(task_id) = &open_task {
588- (crate::detail::task_modal(cx, task_id, query.confirm.as_deref() == Some("delete")).await?)589+ (crate::detail::task_modal(cx, task_id, query.confirm.as_deref() == Some("delete"), crate::detail::Tab::from_query(query.tab.as_deref())).await?)
589 if let Some(file_id) = &query.file {590 if let Some(file_id) = &query.file {
590 (crate::detail::file_viewer_modal(cx, task_id, file_id).await?)591 (crate::detail::file_viewer_modal(cx, task_id, file_id).await?)
591 }592 }
crates/izlek-web/src/detail.rsmodified+75 -5
@@ -1328,9 +1328,54 @@ async fn comment_row(cx: &Cx, comment: &Comment, zone: UtcOffset) -> Result {
1328 1328
1329 /// The task modal's markup: title, description, assignees, deadline,1329 /// The task modal's markup: title, description, assignees, deadline,
1330 /// dependencies, files, comments, activity and delete, exactly as the1330 /// dependencies, files, comments, activity and delete, exactly as the
1331+/// Which region of the task detail panel is showing. Only one is drawn at a
1332+/// time; a `tab=` name it does not recognize falls back to `Task`, same as
1333+/// `logs.rs`/`settings.rs`'s own rail sections.
1334+#[derive(Clone, Copy, PartialEq, Eq)]
1335+pub enum Tab {
1336+ Task,
1337+ Files,
1338+ Comments,
1339+ Activity,
1340+ Mail,
1341+}
1342+
1343+impl Tab {
1344+ pub fn from_query(tab: Option<&str>) -> Tab {
1345+ match tab {
1346+ Some("files") => Tab::Files,
1347+ Some("comments") => Tab::Comments,
1348+ Some("activity") => Tab::Activity,
1349+ Some("mail") => Tab::Mail,
1350+ _ => Tab::Task,
1351+ }
1352+ }
1353+
1354+ fn slug(self) -> &'static str {
1355+ match self {
1356+ Tab::Task => "task",
1357+ Tab::Files => "files",
1358+ Tab::Comments => "comments",
1359+ Tab::Activity => "activity",
1360+ Tab::Mail => "mail",
1361+ }
1362+ }
1363+}
1364+
1365+/// The class a tab link wears: lit on the tab it points to when that is the
1366+/// one showing, plain otherwise — same idiom as `logs.rs`/`settings.rs`'s
1367+/// `rail_class`.
1368+fn tab_class(current: Tab, target: Tab) -> &'static str {
1369+ if current == target {
1370+ "detail-tab detail-tab-on"
1371+ } else {
1372+ "detail-tab"
1373+ }
1374+}
1375+
1331 /// artboard draws them. Wiring `?task=<id>` on the board page is a later1376 /// artboard draws them. Wiring `?task=<id>` on the board page is a later
1332 /// integration slice — this only renders the fragment.1377 /// integration slice — this only renders the fragment.
1333-pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result {1378+pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) -> Result {
1334 let snapshot = match load_snapshot(cx, task_id).await? {1379 let snapshot = match load_snapshot(cx, task_id).await? {
1335 Ok(snapshot) => snapshot,1380 Ok(snapshot) => snapshot,
1336 Err(refusal) => {1381 Err(refusal) => {
@@ -1394,7 +1439,10 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result
1394 <div class="modal-scrim">1439 <div class="modal-scrim">
1395 <div class="modal modal-task" tabindex="-1">1440 <div class="modal modal-task" tabindex="-1">
1396 <header class="detail-head">1441 <header class="detail-head">
1397- <span class="detail-key">(detail.task_key.clone())</span>1442+ <div class="detail-headline">
1443+ <span class="detail-key">(detail.task_key.clone())</span>
1444+ (title_control(cx, &detail, may_write, lang).await?)
1445+ </div>
1398 <span class="detail-state">1446 <span class="detail-state">
1399 if may_write {1447 if may_write {
1400 <form class="status-form" method="post" action="/api/move_card">1448 <form class="status-form" method="post" action="/api/move_card">
@@ -1421,9 +1469,22 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result
1421 <a class="quiet detail-board" href="/">(format!("<- {}", t(lang, Key::NavBoard)))</a>1469 <a class="quiet detail-board" href="/">(format!("<- {}", t(lang, Key::NavBoard)))</a>
1422 </header>1470 </header>
1423 1471
1424- <div class="detail-body">1472+ <nav class="detail-tabs">
1425- (title_control(cx, &detail, may_write, lang).await?)1473+ <a class=(tab_class(tab, Tab::Task)) href=(format!("/?task={}&tab={}", detail.id, Tab::Task.slug()))>(t(lang, Key::TabTask))</a>
1474+ <a class=(tab_class(tab, Tab::Files)) href=(format!("/?task={}&tab={}", detail.id, Tab::Files.slug()))>
1475+ (t(lang, Key::Files))
1476+ if !detail.files.is_empty() { <span class="detail-tab-count">(detail.files.len())</span> }
1477+ </a>
1478+ <a class=(tab_class(tab, Tab::Comments)) href=(format!("/?task={}&tab={}", detail.id, Tab::Comments.slug()))>
1479+ (t(lang, Key::Comments))
1480+ if !detail.comments.is_empty() { <span class="detail-tab-count">(detail.comments.len())</span> }
1481+ </a>
1482+ <a class=(tab_class(tab, Tab::Activity)) href=(format!("/?task={}&tab={}", detail.id, Tab::Activity.slug()))>(t(lang, Key::Activity))</a>
1483+ <a class=(tab_class(tab, Tab::Mail)) href=(format!("/?task={}&tab={}", detail.id, Tab::Mail.slug()))>(t(lang, Key::TabMail))</a>
1484+ </nav>
1426 1485
1486+ <div class="detail-body">
1487+ if tab == Tab::Task {
1427 <div class="detail-fields">1488 <div class="detail-fields">
1428 <div class="detail-field detail-field-status">1489 <div class="detail-field detail-field-status">
1429 <span class="detail-label">(t(lang, Key::Status))</span>1490 <span class="detail-label">(t(lang, Key::Status))</span>
@@ -1491,7 +1552,9 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result
1491 <p class="detail-prose detail-prose-empty">(t(lang, Key::NoDependencies))</p>1552 <p class="detail-prose detail-prose-empty">(t(lang, Key::NoDependencies))</p>
1492 }1553 }
1493 </section>1554 </section>
1555+ }
1494 1556
1557+ if tab == Tab::Files {
1495 <section class="detail-block">1558 <section class="detail-block">
1496 <div class="detail-block-head">1559 <div class="detail-block-head">
1497 <span class="detail-label">(t(lang, Key::Files))</span>1560 <span class="detail-label">(t(lang, Key::Files))</span>
@@ -1517,7 +1580,9 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result
1517 (refused(cx, "upload_file", lang).await?)1580 (refused(cx, "upload_file", lang).await?)
1518 }1581 }
1519 </section>1582 </section>
1583+ }
1520 1584
1585+ if tab == Tab::Comments {
1521 <section class="detail-block">1586 <section class="detail-block">
1522 <div class="detail-block-head">1587 <div class="detail-block-head">
1523 <span class="detail-label">(t(lang, Key::Comments))</span>1588 <span class="detail-label">(t(lang, Key::Comments))</span>
@@ -1529,7 +1594,9 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result
1529 }1594 }
1530 </div>1595 </div>
1531 </section>1596 </section>
1597+ }
1532 1598
1599+ if tab == Tab::Activity {
1533 <section class="detail-block">1600 <section class="detail-block">
1534 <span class="detail-label">(t(lang, Key::Activity))</span>1601 <span class="detail-label">(t(lang, Key::Activity))</span>
1535 <div class="activity-list">1602 <div class="activity-list">
@@ -1542,7 +1609,9 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result
1542 }1609 }
1543 </div>1610 </div>
1544 </section>1611 </section>
1612+ }
1545 1613
1614+ if tab == Tab::Mail {
1546 <section class="detail-block">1615 <section class="detail-block">
1547 <span class="detail-label">(t(lang, Key::Notifications))</span>1616 <span class="detail-label">(t(lang, Key::Notifications))</span>
1548 <div class="activity-list">1617 <div class="activity-list">
@@ -1585,6 +1654,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result
1585 }1654 }
1586 </div>1655 </div>
1587 </section>1656 </section>
1657+ }
1588 1658
1589 (refused(cx, "delete_task", lang).await?)1659 (refused(cx, "delete_task", lang).await?)
1590 1660
@@ -1623,7 +1693,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool) -> Result
1623 </footer>1693 </footer>
1624 </div>1694 </div>
1625 1695
1626- if may_comment {1696+ if tab == Tab::Comments && may_comment {
1627 <form class="comment-composer" method="post" action="/api/post_comment">1697 <form class="comment-composer" method="post" action="/api/post_comment">
1628 <input type="hidden" name="task_id" value=(detail.id.clone())>1698 <input type="hidden" name="task_id" value=(detail.id.clone())>
1629 <textarea class="detail-textarea comment-input" name="body" rows="3" placeholder=(t(lang, Key::WriteAComment)) required=""></textarea>1699 <textarea class="detail-textarea comment-input" name="body" rows="3" placeholder=(t(lang, Key::WriteAComment)) required=""></textarea>
crates/izlek-web/src/i18n.rsmodified+6 -0
@@ -73,9 +73,11 @@ pub enum Key {
73 Deadline,73 Deadline,
74 Description,74 Description,
75 Dependencies,75 Dependencies,
76+ TabTask,
76 Files,77 Files,
77 File,78 File,
78 Comments,79 Comments,
80+ TabMail,
79 WriteAComment,81 WriteAComment,
80 Comment,82 Comment,
81 Activity,83 Activity,
@@ -410,12 +412,16 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
410 (Description, Tr) => "AÇIKLAMA",412 (Description, Tr) => "AÇIKLAMA",
411 (Dependencies, En) => "DEPENDENCIES",413 (Dependencies, En) => "DEPENDENCIES",
412 (Dependencies, Tr) => "BAĞIMLILIKLAR",414 (Dependencies, Tr) => "BAĞIMLILIKLAR",
415+ (TabTask, En) => "Task",
416+ (TabTask, Tr) => "Görev",
413 (Files, En) => "FILES",417 (Files, En) => "FILES",
414 (Files, Tr) => "DOSYALAR",418 (Files, Tr) => "DOSYALAR",
415 (File, En) => "File",419 (File, En) => "File",
416 (File, Tr) => "Dosya",420 (File, Tr) => "Dosya",
417 (Comments, En) => "COMMENTS",421 (Comments, En) => "COMMENTS",
418 (Comments, Tr) => "YORUMLAR",422 (Comments, Tr) => "YORUMLAR",
423+ (TabMail, En) => "Mail",
424+ (TabMail, Tr) => "Posta",
419 (WriteAComment, En) => "Write a comment…",425 (WriteAComment, En) => "Write a comment…",
420 (WriteAComment, Tr) => "Bir yorum yaz…",426 (WriteAComment, Tr) => "Bir yorum yaz…",
421 (Comment, En) => "Comment",427 (Comment, En) => "Comment",
crates/izlek-web/tests/http.rsmodified+206 -7
@@ -2866,7 +2866,7 @@ async fn the_files_section_is_on_the_detail_page() {
2866 let task = a_task(&app, &admin_cookie, &column, "Attach something to me").await;2866 let task = a_task(&app, &admin_cookie, &column, "Attach something to me").await;
2867 2867
2868 let page = app2868 let page = app
2869- .get(&format!("/?task={task}"), Some(&admin_cookie))2869+ .get(&format!("/?task={task}&tab=files"), Some(&admin_cookie))
2870 .await;2870 .await;
2871 assert_eq!(page.status, StatusCode::OK);2871 assert_eq!(page.status, StatusCode::OK);
2872 let html = String::from_utf8_lossy(&page.bytes);2872 let html = String::from_utf8_lossy(&page.bytes);
@@ -2993,7 +2993,7 @@ async fn a_member_uploads_a_file_and_the_chip_comes_back() {
2993 .await;2993 .await;
2994 let file_id = attachment_id_named(&snapshot.body, "spec.png");2994 let file_id = attachment_id_named(&snapshot.body, "spec.png");
2995 2995
2996- let page = app.get(&format!("/?task={task}"), Some(&member)).await;2996+ let page = app.get(&format!("/?task={task}&tab=files"), Some(&member)).await;
2997 assert_eq!(page.status, StatusCode::OK);2997 assert_eq!(page.status, StatusCode::OK);
2998 let html = String::from_utf8_lossy(&page.bytes);2998 let html = String::from_utf8_lossy(&page.bytes);
2999 assert!(2999 assert!(
@@ -3795,8 +3795,9 @@ async fn a_task_modal_stamp_shifts_with_the_viewers_stored_timezone() {
3795 let column = first_column(&app).await;3795 let column = first_column(&app).await;
3796 let task = a_task(&app, &admin_cookie, &column, "Ship it").await;3796 let task = a_task(&app, &admin_cookie, &column, "Ship it").await;
3797 3797
3798+ // Activity lives behind its own tab now, so the stamp is asked for there.
3798 let page = app3799 let page = app
3799- .get(&format!("/?task={task}"), Some(&admin_cookie))3800+ .get(&format!("/?task={task}&tab=activity"), Some(&admin_cookie))
3800 .await;3801 .await;
3801 let html = String::from_utf8_lossy(&page.bytes);3802 let html = String::from_utf8_lossy(&page.bytes);
3802 let utc_at = activity_stamp_of(&html).to_string();3803 let utc_at = activity_stamp_of(&html).to_string();
@@ -3819,7 +3820,7 @@ async fn a_task_modal_stamp_shifts_with_the_viewers_stored_timezone() {
3819 );3820 );
3820 3821
3821 let shifted_page = app3822 let shifted_page = app
3822- .get(&format!("/?task={task}"), Some(&admin_cookie))3823+ .get(&format!("/?task={task}&tab=activity"), Some(&admin_cookie))
3823 .await;3824 .await;
3824 let shifted_html = String::from_utf8_lossy(&shifted_page.bytes);3825 let shifted_html = String::from_utf8_lossy(&shifted_page.bytes);
3825 let shifted_at = activity_stamp_of(&shifted_html).to_string();3826 let shifted_at = activity_stamp_of(&shifted_html).to_string();
@@ -5274,7 +5275,7 @@ async fn a_tasks_notifications_show_the_recipient_and_the_rule_name_is_admin_onl
5274 let (task, _send_id) =5275 let (task, _send_id) =
5275 a_task_with_a_notification(&app, &admin_cookie, "Wraps up the sprint").await;5276 a_task_with_a_notification(&app, &admin_cookie, "Wraps up the sprint").await;
5276 5277
5277- let member_page = app.get(&format!("/?task={task}"), Some(&member)).await;5278+ let member_page = app.get(&format!("/?task={task}&tab=mail"), Some(&member)).await;
5278 let member_html = String::from_utf8_lossy(&member_page.bytes);5279 let member_html = String::from_utf8_lossy(&member_page.bytes);
5279 assert!(member_html.contains("ada@izlek.sh"), "{member_html}");5280 assert!(member_html.contains("ada@izlek.sh"), "{member_html}");
5280 assert!(5281 assert!(
@@ -5286,7 +5287,7 @@ async fn a_tasks_notifications_show_the_recipient_and_the_rule_name_is_admin_onl
5286 "a member was shown the rule's name: {member_html}"5287 "a member was shown the rule's name: {member_html}"
5287 );5288 );
5288 5289
5289- let admin_page = app.get(&format!("/?task={task}"), Some(&admin_cookie)).await;5290+ let admin_page = app.get(&format!("/?task={task}&tab=mail"), Some(&admin_cookie)).await;
5290 let admin_html = String::from_utf8_lossy(&admin_page.bytes);5291 let admin_html = String::from_utf8_lossy(&admin_page.bytes);
5291 assert!(admin_html.contains("ada@izlek.sh"), "{admin_html}");5292 assert!(admin_html.contains("ada@izlek.sh"), "{admin_html}");
5292 assert!(admin_html.contains("Wraps up the sprint"), "{admin_html}");5293 assert!(admin_html.contains("Wraps up the sprint"), "{admin_html}");
@@ -5301,7 +5302,7 @@ async fn a_task_with_no_mail_shows_the_quiet_notifications_line() {
5301 let column = first_column(&app).await;5302 let column = first_column(&app).await;
5302 let task = a_task(&app, &admin_cookie, &column, "Nobody mails me").await;5303 let task = a_task(&app, &admin_cookie, &column, "Nobody mails me").await;
5303 5304
5304- let page = app.get(&format!("/?task={task}"), Some(&admin_cookie)).await;5305+ let page = app.get(&format!("/?task={task}&tab=mail"), Some(&admin_cookie)).await;
5305 let html = String::from_utf8_lossy(&page.bytes);5306 let html = String::from_utf8_lossy(&page.bytes);
5306 assert!(html.contains("NOTIFICATIONS"), "{html}");5307 assert!(html.contains("NOTIFICATIONS"), "{html}");
5307 assert!(html.contains("Nothing yet."), "{html}");5308 assert!(html.contains("Nothing yet."), "{html}");
@@ -5564,3 +5565,201 @@ async fn an_unknown_recipient_refuses_and_never_broadcasts() {
5564 let sends = app.store.mail_queue(10, izlek_core::store::FeedPage::Newest).await.unwrap();5565 let sends = app.store.mail_queue(10, izlek_core::store::FeedPage::Newest).await.unwrap();
5565 assert!(sends.iter().all(|send| send.kind != SendKind::Notice), "{sends:?}");5566 assert!(sends.iter().all(|send| send.kind != SendKind::Notice), "{sends:?}");
5566 }5567 }
5568+
5569+
5570+/// The markup inside a single tab anchor: found by its `tab=<slug>` href, up
5571+/// to that anchor's own closing tag — for asserting a `detail-tab-count`
5572+/// span is (or is not) inside the one tab it belongs to, not just somewhere
5573+/// on the page.
5574+fn tab_anchor<'a>(html: &'a str, slug: &str) -> &'a str {
5575+ let needle = format!("&amp;tab={slug}\">");
5576+ let (_, after) = html
5577+ .split_once(&needle)
5578+ .unwrap_or_else(|| panic!("no {slug} tab anchor: {html}"));
5579+ after
5580+ .split_once("</a>")
5581+ .map(|(inner, _)| inner)
5582+ .expect("unterminated tab anchor")
5583+}
5584+
5585+#[tokio::test]
5586+async fn opening_the_task_with_no_tab_shows_the_task_region_and_the_strip() {
5587+ let app = App::open().await;
5588+ let admin_cookie = admin(&app).await;
5589+ let column = first_column(&app).await;
5590+ let task = a_task(&app, &admin_cookie, &column, "Land on the task tab").await;
5591+
5592+ let page = app.get(&format!("/?task={task}"), Some(&admin_cookie)).await;
5593+ assert_eq!(page.status, StatusCode::OK);
5594+ let html = String::from_utf8_lossy(&page.bytes);
5595+ assert!(
5596+ html.contains(r#"class="detail-tabs""#),
5597+ "no tab strip: {html}"
5598+ );
5599+ assert!(
5600+ html.contains(r#"class="detail-fields""#),
5601+ "no task fields grid: {html}"
5602+ );
5603+ assert!(
5604+ !html.contains("comment-composer"),
5605+ "composer shown on the task tab: {html}"
5606+ );
5607+}
5608+
5609+#[tokio::test]
5610+async fn each_tab_renders_only_its_own_region() {
5611+ let app = App::open().await;
5612+ let admin_cookie = admin(&app).await;
5613+ let column = first_column(&app).await;
5614+ let task = a_task(&app, &admin_cookie, &column, "Walk every tab").await;
5615+
5616+ let files = app
5617+ .get(&format!("/?task={task}&tab=files"), Some(&admin_cookie))
5618+ .await;
5619+ let files_html = String::from_utf8_lossy(&files.bytes);
5620+ assert!(
5621+ files_html.contains("multipart/form-data"),
5622+ "no files region: {files_html}"
5623+ );
5624+ assert!(
5625+ !files_html.contains("comment-composer"),
5626+ "composer shown on the files tab: {files_html}"
5627+ );
5628+
5629+ let comments = app
5630+ .get(&format!("/?task={task}&tab=comments"), Some(&admin_cookie))
5631+ .await;
5632+ let comments_html = String::from_utf8_lossy(&comments.bytes);
5633+ assert!(
5634+ comments_html.contains("comment-composer"),
5635+ "no composer on the comments tab: {comments_html}"
5636+ );
5637+
5638+ let activity = app
5639+ .get(&format!("/?task={task}&tab=activity"), Some(&admin_cookie))
5640+ .await;
5641+ let activity_html = String::from_utf8_lossy(&activity.bytes);
5642+ assert!(
5643+ activity_html.contains("activity-stamp"),
5644+ "no activity stamp: {activity_html}"
5645+ );
5646+
5647+ let mail = app
5648+ .get(&format!("/?task={task}&tab=mail"), Some(&admin_cookie))
5649+ .await;
5650+ let mail_html = String::from_utf8_lossy(&mail.bytes);
5651+ assert!(
5652+ mail_html.contains("NOTIFICATIONS"),
5653+ "no notifications heading: {mail_html}"
5654+ );
5655+}
5656+
5657+#[tokio::test]
5658+async fn a_tab_name_it_does_not_know_falls_back_to_the_task_region() {
5659+ let app = App::open().await;
5660+ let admin_cookie = admin(&app).await;
5661+ let column = first_column(&app).await;
5662+ let task = a_task(&app, &admin_cookie, &column, "Land on garbage").await;
5663+
5664+ let page = app
5665+ .get(&format!("/?task={task}&tab=zzz"), Some(&admin_cookie))
5666+ .await;
5667+ assert_eq!(page.status, StatusCode::OK);
5668+ let html = String::from_utf8_lossy(&page.bytes);
5669+ assert!(
5670+ html.contains(r#"class="detail-fields""#),
5671+ "garbage tab did not fall back to the task region: {html}"
5672+ );
5673+}
5674+
5675+#[tokio::test]
5676+async fn the_tab_strip_counts_files_and_comments_and_is_silent_when_there_are_none() {
5677+ let app = App::open().await;
5678+ let admin_cookie = admin(&app).await;
5679+ let column = first_column(&app).await;
5680+ let task = a_task(&app, &admin_cookie, &column, "Nothing attached yet").await;
5681+
5682+ let page = app.get(&format!("/?task={task}"), Some(&admin_cookie)).await;
5683+ let html = String::from_utf8_lossy(&page.bytes);
5684+ assert!(
5685+ !tab_anchor(&html, "files").contains("detail-tab-count"),
5686+ "count shown with no files: {html}"
5687+ );
5688+ assert!(
5689+ !tab_anchor(&html, "comments").contains("detail-tab-count"),
5690+ "count shown with no comments: {html}"
5691+ );
5692+
5693+ let png = [0x89u8, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 1, 2, 3, 4];
5694+ app.post_multipart(
5695+ "/files",
5696+ Some(&admin_cookie),
5697+ &[("task_id", &task)],
5698+ Some(("spec.png", "image/png", &png)),
5699+ )
5700+ .await;
5701+ app.post(
5702+ "/api/post_comment",
5703+ Some(&admin_cookie),
5704+ &[("task_id", &task), ("body", "One comment")],
5705+ )
5706+ .await;
5707+
5708+ let page = app.get(&format!("/?task={task}"), Some(&admin_cookie)).await;
5709+ let html = String::from_utf8_lossy(&page.bytes);
5710+ assert!(
5711+ tab_anchor(&html, "files").contains(r#"class="detail-tab-count">1<"#),
5712+ "no file count of 1: {html}"
5713+ );
5714+ assert!(
5715+ tab_anchor(&html, "comments").contains(r#"class="detail-tab-count">1<"#),
5716+ "no comment count of 1: {html}"
5717+ );
5718+}
5719+
5720+#[tokio::test]
5721+async fn the_title_renders_on_every_tab() {
5722+ let app = App::open().await;
5723+ let admin_cookie = admin(&app).await;
5724+ let column = first_column(&app).await;
5725+ let task = a_task(&app, &admin_cookie, &column, "Carry my title everywhere").await;
5726+
5727+ for tab in ["task", "files"] {
5728+ let page = app
5729+ .get(&format!("/?task={task}&tab={tab}"), Some(&admin_cookie))
5730+ .await;
5731+ let html = String::from_utf8_lossy(&page.bytes);
5732+ assert!(
5733+ html.contains(r#"class="detail-headline""#),
5734+ "no headline on tab={tab}: {html}"
5735+ );
5736+ assert!(
5737+ html.contains("Carry my title everywhere"),
5738+ "no title text on tab={tab}: {html}"
5739+ );
5740+ }
5741+}
5742+
5743+#[tokio::test]
5744+async fn a_member_who_may_only_read_still_gets_the_tab_strip() {
5745+ let app = App::open().await;
5746+ let admin_cookie = admin(&app).await;
5747+ let member = invited(
5748+ &app,
5749+ &admin_cookie,
5750+ "reads@izlek.sh",
5751+ "Reader Only",
5752+ Role::Member,
5753+ )
5754+ .await;
5755+ let column = first_column(&app).await;
5756+ let task = a_task(&app, &admin_cookie, &column, "A member can still see this").await;
5757+
5758+ let page = app.get(&format!("/?task={task}"), Some(&member)).await;
5759+ assert_eq!(page.status, StatusCode::OK);
5760+ let html = String::from_utf8_lossy(&page.bytes);
5761+ assert!(
5762+ html.contains(r#"class="detail-tabs""#),
5763+ "no tab strip for a member: {html}"
5764+ );
5765+}
style/_instrument.scssmodified+14 -4
@@ -35,6 +35,11 @@
35 box-shadow: inset 0 -2px 0 var(--accent);35 box-shadow: inset 0 -2px 0 var(--accent);
36 }36 }
37 37
38+ // Active detail tab underlines in accent, same idiom as the topbar nav.
39+ .detail-tab-on {
40+ box-shadow: inset 0 -2px 0 var(--accent);
41+ }
42+
38 // --- Instrument skin: board (ruled columns) --------------------------------43 // --- Instrument skin: board (ruled columns) --------------------------------
39 44
40 // Columns are not floating wells; they are panels separated by hairline45 // Columns are not floating wells; they are panels separated by hairline
@@ -210,13 +215,18 @@
210 box-shadow: var(--shadow-3);215 box-shadow: var(--shadow-3);
211 }216 }
212 217
213-// Header: key left, Esc and the close cross right. The header's own state218+// Header: key + title left (stacked), Esc and the close cross right. The
214-// chip is suppressed — status lives in the body's field grid.219+// header's own state chip is suppressed — status lives in the body's field
220+// grid. The tab strip sits directly under it, so the header itself carries
221+// no bottom rule any more.
215 [data-ui="instrument"] .modal-task .detail-head {222 [data-ui="instrument"] .modal-task .detail-head {
216- align-items: center;223+ align-items: flex-start;
217 gap: 12px;224 gap: 12px;
218 padding: 14px 16px;225 padding: 14px 16px;
219- border-bottom: 1px solid var(--border);226+}
227+
228+[data-ui="instrument"] .detail-tabs {
229+ padding: 0 16px;
220 }230 }
221 231
222 [data-ui="instrument"] .detail-state,232 [data-ui="instrument"] .detail-state,
style/_ledger.scssmodified+13 -2
@@ -130,6 +130,11 @@
130 box-shadow: none;130 box-shadow: none;
131 }131 }
132 132
133+ .detail-tab-on {
134+ border-bottom: 2px solid var(--ink);
135+ box-shadow: none;
136+ }
137+
133 // --- Ledger skin: chips as inked text ----------------------------------------138 // --- Ledger skin: chips as inked text ----------------------------------------
134 139
135 .chip {140 .chip {
@@ -293,6 +298,11 @@
293 padding: 0;298 padding: 0;
294 }299 }
295 300
301+[data-ui="ledger"] .detail-tabs {
302+ padding: 0;
303+ margin-top: 14px;
304+}
305+
296 [data-ui="ledger"] .modal-task .detail-esc,306 [data-ui="ledger"] .modal-task .detail-esc,
297 [data-ui="ledger"] .modal-task .detail-close,307 [data-ui="ledger"] .modal-task .detail-close,
298 [data-ui="ledger"] .detail-body .detail-field-status {308 [data-ui="ledger"] .detail-body .detail-field-status {
@@ -356,8 +366,9 @@
356 }366 }
357 367
358 // Serif title over a heavy rule; the edit form gets the same rule so the368 // Serif title over a heavy rule; the edit form gets the same rule so the
359-// title area holds still while editing.369+// title area holds still while editing. The title now lives in the header,
360-[data-ui="ledger"] .detail-body .detail-title,370+// stacked under the key, ahead of the tab strip.
371+[data-ui="ledger"] .detail-head .detail-title,
361 [data-ui="ledger"] .title-form {372 [data-ui="ledger"] .title-form {
362 padding-bottom: 10px;373 padding-bottom: 10px;
363 border-bottom: 2px solid var(--ink);374 border-bottom: 2px solid var(--ink);
style/main.scssmodified+23 -0
@@ -1392,6 +1392,29 @@ img.avatar {
1392 min-width: 0;1392 min-width: 0;
1393 }1393 }
1394 1394
1395+// -- tab strip ----------------------------------------------------------
1396+
1397+.detail-tabs {
1398+ display: flex;
1399+ gap: 2px;
1400+ flex: none;
1401+ padding: 0 16px;
1402+ border-bottom: 1px solid var(--border);
1403+}
1404+
1405+.detail-tab {
1406+ padding: 9px 10px;
1407+ font-family: var(--font-mono);
1408+ font-size: 10px;
1409+ letter-spacing: 0.08em;
1410+ text-transform: uppercase;
1411+ color: var(--muted);
1412+}
1413+
1414+.detail-tab-on { color: var(--ink); }
1415+
1416+.detail-tab-count { margin-left: 4px; color: var(--muted-soft); }
1417+
1395 .detail-key {1418 .detail-key {
1396 display: block;1419 display: block;
1397 font-family: var(--font-mono);1420 font-family: var(--font-mono);