the family hides behind the monogram: the in im iz row in the topbar nav goes, and the siblings become a flyout that drops under the İz mark on hover and on keyboard focus — the mark is already the link home, so focus-within opens it and Tab from it reaches the sibling links; the flyout stays in the DOM at opacity zero with no gap to the mark, so the pointer can travel down into it, no script; every signed-in topbar renders the family mark in place of the bare one, a mirror without siblings renders the bare mark, and the http test now asserts the siblings alone
Browse files at this commitcf63971fea59f0e3e7f2c0fa11c4e343b6d30b3bParent: 3502c7f9 changed files +88 -56
- crates/iz-web/src/board.rs +1 -1
- crates/iz-web/src/layout.rs +30 -26
- crates/iz-web/src/logs.rs +1 -1
- crates/iz-web/src/people.rs +1 -1
- crates/iz-web/src/rules.rs +1 -1
- crates/iz-web/src/settings.rs +1 -1
- crates/iz-web/src/tags.rs +1 -1
- crates/iz-web/tests/http.rs +14 -14
- style/main.scss +38 -10
crates/iz-web/src/board.rsmodified+1 -1
| @@ -742,7 +742,7 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result { | |||
| 742 | view! { | 742 | view! { |
| 743 | cx => | 743 | cx => |
| 744 | <header class="topbar"> | 744 | <header class="topbar"> |
| 745 | - (crate::layout::mark(cx).await?) | 745 | + (crate::layout::family_mark(cx).await?) |
| 746 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Board, user.role, lang).await?) | 746 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Board, user.role, lang).await?) |
| 747 | <div class="spacer"></div> | 747 | <div class="spacer"></div> |
| 748 | (crate::layout::user_menu(cx, &crate::detail::Me::from(user), lang).await?) | 748 | (crate::layout::user_menu(cx, &crate::detail::Me::from(user), lang).await?) |
crates/iz-web/src/layout.rsmodified+30 -26
| @@ -212,7 +212,6 @@ impl NavPage { | |||
| 212 | pub async fn topbar_nav(cx: &Cx, active: NavPage, role: iz_core::Role, lang: Lang) -> Result { | 212 | pub async fn topbar_nav(cx: &Cx, active: NavPage, role: iz_core::Role, lang: Lang) -> Result { |
| 213 | view! { | 213 | view! { |
| 214 | cx => | 214 | cx => |
| 215 | - (service_switcher(cx).await?) | ||
| 216 | <nav class="topbar-nav-links"> | 215 | <nav class="topbar-nav-links"> |
| 217 | for page in NavPage::ALL { | 216 | for page in NavPage::ALL { |
| 218 | if role.can_administer() || !matches!(page, NavPage::Rules | NavPage::Logs | NavPage::Tags) { | 217 | if role.can_administer() || !matches!(page, NavPage::Rules | NavPage::Logs | NavPage::Tags) { |
| @@ -240,39 +239,44 @@ async fn family_of(cx: &Cx) -> Vec<iz_client::FamilyService> { | |||
| 240 | } | 239 | } |
| 241 | } | 240 | } |
| 242 | 241 | ||
| 243 | -/// The family's wordmark switcher — `in im iz` — as the topbar's way | 242 | +/// The monogram with the family behind it — the way between the apps of |
| 244 | -/// between the apps of dizey.sh. The current app is held in ink and | 243 | +/// dizey.sh. The mark alone stands in the chrome; the siblings' wordmarks |
| 245 | -/// marked `aria-current`; the others are plain doors out, titled with the | 244 | +/// hang in a flyout that opens under it on hover and on keyboard focus (the |
| 246 | -/// human name im's admin panel gives them. The list is the app's own | 245 | +/// mark is an `<a href="/">`, so it is already focusable and `:focus-within` |
| 247 | -/// mirror of im's `/family` ([`family_of`]), so the panel decides the | 246 | +/// carries it), middots between, each titled with the human name im's admin |
| 248 | -/// trio without a deploy here, and a mirror that has not arrived yet — | 247 | +/// panel gives it. No script: the flyout is CSS, and it stays in the DOM at |
| 249 | -/// or a deployment standing alone — shows a chrome without the trio. The | 248 | +/// opacity zero so Tab reaches its links. The list is the app's own mirror |
| 250 | -/// links leave this origin, so they carry `data-hard`, like the issuer | 249 | +/// of im's `/family` ([`family_of`]), minus this app's own row — a door back |
| 250 | +/// into the room one is standing in is no door — so the panel decides the | ||
| 251 | +/// family without a deploy here, and a mirror that has not arrived yet, or a | ||
| 252 | +/// deployment standing alone, renders the bare mark: nothing to reveal. | ||
| 253 | +/// The links leave this origin, so they carry `data-hard`, like the issuer | ||
| 251 | /// link in the user menu. | 254 | /// link in the user menu. |
| 252 | -async fn service_switcher(cx: &Cx) -> Result { | 255 | +pub(crate) async fn family_mark(cx: &Cx) -> Result { |
| 253 | const SELF: &str = "iz"; | 256 | const SELF: &str = "iz"; |
| 254 | - let family = family_of(cx).await; | 257 | + let siblings: Vec<_> = family_of(cx) |
| 258 | + .await | ||
| 259 | + .into_iter() | ||
| 260 | + .filter(|service| service.key != SELF) | ||
| 261 | + .collect(); | ||
| 262 | + if siblings.is_empty() { | ||
| 263 | + return mark(cx).await; | ||
| 264 | + } | ||
| 255 | view! { | 265 | view! { |
| 256 | cx => | 266 | cx => |
| 257 | - if !family.is_empty() { | 267 | + <div class="wordmark-family"> |
| 268 | + (mark(cx).await?) | ||
| 258 | <nav class="service-switcher"> | 269 | <nav class="service-switcher"> |
| 259 | - for service in family { | 270 | + for (at, service) in siblings.iter().enumerate() { |
| 260 | - if service.key == SELF { | 271 | + if at > 0 { |
| 261 | - <span | 272 | + <span class="service-sep">"·"</span> |
| 262 | - class="service-mark service-mark-on" | ||
| 263 | - aria-current="page" | ||
| 264 | - title=(service.name) | ||
| 265 | - > | ||
| 266 | - (service.key) | ||
| 267 | - </span> | ||
| 268 | - } else { | ||
| 269 | - <a class="service-mark" href=(service.url) title=(service.name) data-hard=""> | ||
| 270 | - (service.key) | ||
| 271 | - </a> | ||
| 272 | } | 273 | } |
| 274 | + <a class="service-mark" href=(service.url.clone()) title=(service.name.clone()) data-hard=""> | ||
| 275 | + (service.key.clone()) | ||
| 276 | + </a> | ||
| 273 | } | 277 | } |
| 274 | </nav> | 278 | </nav> |
| 275 | - } | 279 | + </div> |
| 276 | } | 280 | } |
| 277 | } | 281 | } |
| 278 | 282 | ||
crates/iz-web/src/logs.rsmodified+1 -1
| @@ -1013,7 +1013,7 @@ async fn logs_screen( | |||
| 1013 | view! { | 1013 | view! { |
| 1014 | cx => | 1014 | cx => |
| 1015 | <header class="topbar"> | 1015 | <header class="topbar"> |
| 1016 | - (crate::layout::mark(cx).await?) | 1016 | + (crate::layout::family_mark(cx).await?) |
| 1017 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Logs, me.role, lang).await?) | 1017 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Logs, me.role, lang).await?) |
| 1018 | <div class="spacer"></div> | 1018 | <div class="spacer"></div> |
| 1019 | (crate::layout::user_menu(cx, &me, lang).await?) | 1019 | (crate::layout::user_menu(cx, &me, lang).await?) |
crates/iz-web/src/people.rsmodified+1 -1
| @@ -108,7 +108,7 @@ async fn people_page(cx: &Cx) -> Result { | |||
| 108 | view! { | 108 | view! { |
| 109 | cx => | 109 | cx => |
| 110 | <header class="topbar"> | 110 | <header class="topbar"> |
| 111 | - (crate::layout::mark(cx).await?) | 111 | + (crate::layout::family_mark(cx).await?) |
| 112 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Settings, user.role, lang).await?) | 112 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Settings, user.role, lang).await?) |
| 113 | <div class="spacer"></div> | 113 | <div class="spacer"></div> |
| 114 | (crate::layout::user_menu(cx, &crate::detail::Me::from(&user), lang).await?) | 114 | (crate::layout::user_menu(cx, &crate::detail::Me::from(&user), lang).await?) |
crates/iz-web/src/rules.rsmodified+1 -1
| @@ -876,7 +876,7 @@ async fn rules_page(cx: &Cx) -> Result { | |||
| 876 | 876 | ||
| 877 | view! { | 877 | view! { |
| 878 | <header class="topbar"> | 878 | <header class="topbar"> |
| 879 | - (crate::layout::mark(cx).await?) | 879 | + (crate::layout::family_mark(cx).await?) |
| 880 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Rules, user.role, lang).await?) | 880 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Rules, user.role, lang).await?) |
| 881 | <div class="spacer"></div> | 881 | <div class="spacer"></div> |
| 882 | (crate::layout::user_menu(cx, &crate::detail::Me::from(&user), lang).await?) | 882 | (crate::layout::user_menu(cx, &crate::detail::Me::from(&user), lang).await?) |
crates/iz-web/src/settings.rsmodified+1 -1
| @@ -1248,7 +1248,7 @@ async fn settings_page(cx: &Cx) -> Result { | |||
| 1248 | view! { | 1248 | view! { |
| 1249 | cx => | 1249 | cx => |
| 1250 | <header class="topbar"> | 1250 | <header class="topbar"> |
| 1251 | - (crate::layout::mark(cx).await?) | 1251 | + (crate::layout::family_mark(cx).await?) |
| 1252 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Settings, user.role, lang).await?) | 1252 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Settings, user.role, lang).await?) |
| 1253 | <div class="spacer"></div> | 1253 | <div class="spacer"></div> |
| 1254 | (crate::layout::user_menu(cx, &crate::detail::Me::from(&user), lang).await?) | 1254 | (crate::layout::user_menu(cx, &crate::detail::Me::from(&user), lang).await?) |
crates/iz-web/src/tags.rsmodified+1 -1
| @@ -371,7 +371,7 @@ async fn tags_page(cx: &Cx) -> Result { | |||
| 371 | 371 | ||
| 372 | view! { | 372 | view! { |
| 373 | <header class="topbar"> | 373 | <header class="topbar"> |
| 374 | - (crate::layout::mark(cx).await?) | 374 | + (crate::layout::family_mark(cx).await?) |
| 375 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Tags, user.role, lang).await?) | 375 | (crate::layout::topbar_nav(cx, crate::layout::NavPage::Tags, user.role, lang).await?) |
| 376 | <div class="spacer"></div> | 376 | <div class="spacer"></div> |
| 377 | (crate::layout::user_menu(cx, &crate::detail::Me::from(&user), lang).await?) | 377 | (crate::layout::user_menu(cx, &crate::detail::Me::from(&user), lang).await?) |
crates/iz-web/tests/http.rsmodified+14 -14
| @@ -9644,10 +9644,10 @@ async fn a_sign_out_hands_the_browser_to_the_providers_logout_pointed_home() { | |||
| 9644 | assert_eq!(raw.location.as_deref(), Some(expected.as_str())); | 9644 | assert_eq!(raw.location.as_deref(), Some(expected.as_str())); |
| 9645 | } | 9645 | } |
| 9646 | 9646 | ||
| 9647 | -/// The switcher renders the family list the app mirrors from im — the | 9647 | +/// The flyout under the monogram renders the family list the app mirrors |
| 9648 | -/// stored JSON, in stored order, with the current app held in ink with | 9648 | +/// from im — the stored JSON, in stored order, minus this app's own row, |
| 9649 | -/// `aria-current`, the others plain links out. A list that is absent, | 9649 | +/// each sibling a plain link out. A list that is absent, empty, will not |
| 9650 | -/// empty, or will not parse shows no switcher at all. | 9650 | +/// parse, or holds this app alone shows the bare mark and no flyout. |
| 9651 | #[tokio::test] | 9651 | #[tokio::test] |
| 9652 | async fn the_topbar_shows_the_family_switcher_and_marks_this_app_only_when_configured() { | 9652 | async fn the_topbar_shows_the_family_switcher_and_marks_this_app_only_when_configured() { |
| 9653 | let family = "\ | 9653 | let family = "\ |
| @@ -9658,20 +9658,20 @@ async fn the_topbar_shows_the_family_switcher_and_marks_this_app_only_when_confi | |||
| 9658 | let app = App::build_with(Mail::silent(), Some(family), "").await; | 9658 | let app = App::build_with(Mail::silent(), Some(family), "").await; |
| 9659 | let board_admin = admin(&app).await; | 9659 | let board_admin = admin(&app).await; |
| 9660 | let html = String::from_utf8_lossy(&app.get("/", Some(&board_admin)).await.bytes).to_string(); | 9660 | let html = String::from_utf8_lossy(&app.get("/", Some(&board_admin)).await.bytes).to_string(); |
| 9661 | + assert!(html.contains("wordmark-family"), "{html}"); | ||
| 9661 | assert!(html.contains("service-switcher"), "{html}"); | 9662 | assert!(html.contains("service-switcher"), "{html}"); |
| 9662 | - assert!(html.contains("service-mark-on"), "{html}"); | 9663 | + // This app has no door back into itself: only the siblings hang there, |
| 9663 | - assert!(html.contains("aria-current=\"page\""), "{html}"); | 9664 | + // in the order im served them. |
| 9664 | - // The mirror reads in the order im served it, with the current app | 9665 | + assert!(!html.contains("href=\"http://127.0.0.1:7654\""), "{html}"); |
| 9665 | - // between its neighbours, not pushed to an end. | ||
| 9666 | let in_at = html.find("href=\"http://127.0.0.1:7655\"").unwrap(); | 9666 | let in_at = html.find("href=\"http://127.0.0.1:7655\"").unwrap(); |
| 9667 | - let iz_at = html.find("service-mark-on").unwrap(); | ||
| 9668 | let im_at = html.find("href=\"http://127.0.0.1:7650\"").unwrap(); | 9667 | let im_at = html.find("href=\"http://127.0.0.1:7650\"").unwrap(); |
| 9669 | - assert!(in_at < iz_at && iz_at < im_at, "marks out of order: {html}"); | 9668 | + assert!(in_at < im_at, "marks out of order: {html}"); |
| 9670 | 9669 | ||
| 9671 | - // A list that will not parse hides the switcher rather than rendering | 9670 | + // A list that will not parse hides the flyout rather than rendering |
| 9672 | - // half of it — and so does an empty one, and a mirror that never | 9671 | + // half of it — and so do an empty one, a list holding this app alone, |
| 9673 | - // arrived. | 9672 | + // and a mirror that never arrived. |
| 9674 | - for broken in ["[".to_string(), "[]".to_string()] { | 9673 | + let alone = "[{\"key\":\"iz\",\"name\":\"Board\",\"url\":\"http://127.0.0.1:7654\"}]"; |
| 9674 | + for broken in ["[".to_string(), "[]".to_string(), alone.to_string()] { | ||
| 9675 | let app = App::build_with(Mail::silent(), Some(broken), "").await; | 9675 | let app = App::build_with(Mail::silent(), Some(broken), "").await; |
| 9676 | let board_admin = admin(&app).await; | 9676 | let board_admin = admin(&app).await; |
| 9677 | let html = | 9677 | let html = |
style/main.scssmodified+38 -10
| @@ -449,14 +449,44 @@ a { | |||
| 449 | background: var(--border); | 449 | background: var(--border); |
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | -// The family switcher: the dizey wordmarks, lowercase like the brand's own | 452 | +// The family behind the monogram: the sibling apps' wordmarks, lowercase |
| 453 | -// name, standing with the mark while the page nav keeps its auto-margin | 453 | +// like the brand's own name, in a flyout that hangs under the mark and |
| 454 | -// place on the right. The current app is ink; the others are muted until | 454 | +// shows on hover or on keyboard focus (the mark is the topbar's `<a>`, so |
| 455 | -// the pointer finds them. | 455 | +// focus-within carries it). Absolutely placed, so the chrome keeps the bare |
| 456 | +// mark's height and the page nav its auto-margin place on the right; left | ||
| 457 | +// under the mark, because this chrome is anchored there. It stays in the | ||
| 458 | +// DOM so the links are reachable by tab, and there is no gap between mark | ||
| 459 | +// and flyout, so the pointer can travel down into it without it closing. | ||
| 460 | +// Under the page's own menus (z 20 and up), over everything else. | ||
| 461 | +.wordmark-family { | ||
| 462 | + position: relative; | ||
| 463 | + display: flex; | ||
| 464 | + | ||
| 465 | + &:hover .service-switcher, | ||
| 466 | + &:focus-within .service-switcher { | ||
| 467 | + opacity: 1; | ||
| 468 | + transform: translate(0, 0); | ||
| 469 | + pointer-events: auto; | ||
| 470 | + } | ||
| 471 | +} | ||
| 472 | + | ||
| 456 | .service-switcher { | 473 | .service-switcher { |
| 474 | + position: absolute; | ||
| 475 | + top: 100%; | ||
| 476 | + left: 0; | ||
| 477 | + z-index: 5; | ||
| 457 | display: flex; | 478 | display: flex; |
| 458 | - align-items: center; | 479 | + align-items: baseline; |
| 459 | - gap: 12px; | 480 | + gap: 10px; |
| 481 | + padding: 6px 12px; | ||
| 482 | + background: var(--surface); | ||
| 483 | + border: 1px solid var(--border); | ||
| 484 | + border-radius: var(--radius); | ||
| 485 | + box-shadow: var(--shadow-2); | ||
| 486 | + opacity: 0; | ||
| 487 | + transform: translate(0, -4px); | ||
| 488 | + pointer-events: none; | ||
| 489 | + transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); | ||
| 460 | } | 490 | } |
| 461 | 491 | ||
| 462 | .service-mark { | 492 | .service-mark { |
| @@ -469,12 +499,10 @@ a { | |||
| 469 | white-space: nowrap; | 499 | white-space: nowrap; |
| 470 | 500 | ||
| 471 | &:hover { color: var(--ink); } | 501 | &:hover { color: var(--ink); } |
| 472 | - | ||
| 473 | - &-on { | ||
| 474 | - color: var(--ink); | ||
| 475 | - } | ||
| 476 | } | 502 | } |
| 477 | 503 | ||
| 504 | +.service-sep { color: var(--muted-soft); } | ||
| 505 | + | ||
| 478 | .topbar-nav-links { | 506 | .topbar-nav-links { |
| 479 | display: flex; | 507 | display: flex; |
| 480 | gap: 16px; | 508 | gap: 16px; |