diff --git a/crates/izlek-web/src/board.rs b/crates/izlek-web/src/board.rs index 1a5ef4c..ad12115 100644 --- a/crates/izlek-web/src/board.rs +++ b/crates/izlek-web/src/board.rs @@ -516,6 +516,7 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result { "izlek" + (crate::layout::topbar_nav(cx, crate::layout::NavPage::Board, lang).await?)
(crate::layout::user_menu(cx, &user.display_name, &user.email, user.role, lang).await?) diff --git a/crates/izlek-web/src/i18n.rs b/crates/izlek-web/src/i18n.rs index 753e970..212e6a7 100644 --- a/crates/izlek-web/src/i18n.rs +++ b/crates/izlek-web/src/i18n.rs @@ -92,7 +92,7 @@ pub enum Key { Overdue, Blocked, - // Sidenav / chrome shared by settings.rs, rules.rs, logs.rs. + // Topbar nav / chrome shared by board.rs, rules.rs, logs.rs, settings.rs. NavBoard, NavMailRules, NavLogs, diff --git a/crates/izlek-web/src/layout.rs b/crates/izlek-web/src/layout.rs index 01a2ec7..0921bd1 100644 --- a/crates/izlek-web/src/layout.rs +++ b/crates/izlek-web/src/layout.rs @@ -43,6 +43,56 @@ pub async fn user_menu(cx: &Cx, display_name: &str, email: &str, role: izlek_cor } } +/// The four signed-in pages, as the topbar nav links between them. +#[derive(Clone, Copy, PartialEq)] +pub enum NavPage { + Board, + Rules, + Logs, + Settings, +} + +impl NavPage { + const ALL: [Self; 4] = [Self::Board, Self::Rules, Self::Logs, Self::Settings]; + + fn href(self) -> &'static str { + match self { + Self::Board => "/", + Self::Rules => "/rules", + Self::Logs => "/logs", + Self::Settings => "/settings", + } + } + + fn label(self) -> Key { + match self { + Self::Board => Key::NavBoard, + Self::Rules => Key::NavMailRules, + Self::Logs => Key::NavLogs, + Self::Settings => Key::NavSettings, + } + } +} + +/// The topbar's page nav, shared by every signed-in page: the four pages +/// with the current one marked. Plain ``s — the soft-nav forwarder +/// swaps them like any same-origin link, so `data-hard` stays off. +pub async fn topbar_nav(cx: &Cx, active: NavPage, lang: Lang) -> Result { + view! { + cx => + + } +} + /// The page-swap machinery that keeps every mutation on the same document. /// /// Every `/api/*` mutation is a plain form post answered with a 303 — sound diff --git a/crates/izlek-web/src/logs.rs b/crates/izlek-web/src/logs.rs index a2d4874..07f1ea1 100644 --- a/crates/izlek-web/src/logs.rs +++ b/crates/izlek-web/src/logs.rs @@ -393,18 +393,12 @@ async fn logs_screen(cx: &Cx, snapshot: LogsSnapshot) -> Result {
(t(lang, Key::Logs)) + (crate::layout::topbar_nav(cx, crate::layout::NavPage::Logs, lang).await?)
(crate::layout::user_menu(cx, &me.display_name, &me.email, me.role, lang).await?)
- -

(t(lang, Key::Logs))

diff --git a/crates/izlek-web/src/rules.rs b/crates/izlek-web/src/rules.rs index f8e3a3c..aa6e103 100644 --- a/crates/izlek-web/src/rules.rs +++ b/crates/izlek-web/src/rules.rs @@ -717,18 +717,12 @@ async fn rules_page(cx: &Cx) -> Result {
(t(lang, Key::MailRules)) + (crate::layout::topbar_nav(cx, crate::layout::NavPage::Rules, lang).await?)
(crate::layout::user_menu(cx, &user.display_name, &user.email, user.role, lang).await?)
- -

(t(lang, Key::MailRules))

diff --git a/crates/izlek-web/src/settings.rs b/crates/izlek-web/src/settings.rs index 7ee0062..4c23c47 100644 --- a/crates/izlek-web/src/settings.rs +++ b/crates/izlek-web/src/settings.rs @@ -788,25 +788,27 @@ async fn settings_page(cx: &Cx) -> Result {
(t(lang, Key::NavSettings)) + (crate::layout::topbar_nav(cx, crate::layout::NavPage::Settings, lang).await?)
(crate::layout::user_menu(cx, &user.display_name, &user.email, user.role, lang).await?)
- -

(t(lang, Key::NavSettings))

(user.role.as_str().to_string())
+ -
+

(t(lang, Key::YourProfile))

@@ -870,7 +872,7 @@ async fn settings_page(cx: &Cx) -> Result { if let Some(sender) = &sender { let connected = sender.is_connected(); let password_set = sender.password_set; -
+

(t(lang, Key::OutgoingMail))

(t(lang, Key::AdminOnly)) @@ -975,7 +977,7 @@ async fn settings_page(cx: &Cx) -> Result { } if let Some((attachment_limit_mb, photo_limit_mb)) = limits { -
+

(t(lang, Key::WorkspaceLimits))

(t(lang, Key::AdminOnly)) @@ -1031,7 +1033,7 @@ async fn settings_page(cx: &Cx) -> Result { } if let Some(members) = members { -
+

(t(lang, Key::Members))

(t(lang, Key::AdminOnly)) diff --git a/crates/izlek-web/tests/http.rs b/crates/izlek-web/tests/http.rs index 92e3c07..a0bc414 100644 --- a/crates/izlek-web/tests/http.rs +++ b/crates/izlek-web/tests/http.rs @@ -2893,14 +2893,32 @@ async fn creating_a_task_into_a_ruled_column_owes_mail() { } #[tokio::test] -async fn the_settings_sidenav_offers_logs() { +async fn the_topbar_nav_marks_the_active_page() { let app = App::open().await; let admin_cookie = admin(&app).await; - let page = app.get("/settings", Some(&admin_cookie)).await; - assert_eq!(page.status, StatusCode::OK); + for (path, active) in [("/", "/"), ("/rules", "/rules"), ("/logs", "/logs"), ("/settings", "/settings")] { + let page = app.get(path, Some(&admin_cookie)).await; + assert_eq!(page.status, StatusCode::OK); + let html = String::from_utf8_lossy(&page.bytes); + for nav in ["/", "/rules", "/logs", "/settings"] { + let expected = if nav == active { + format!(r#"class="topbar-nav topbar-nav-on" href="{nav}""#) + } else { + format!(r#"class="topbar-nav" href="{nav}""#) + }; + assert!(html.contains(&expected), "page {path} lacks `{expected}`: {html}"); + } + } + + // The settings section list keeps the panels' admin gating: a member + // sees only the Profile anchor. + let member = invited(&app, &admin_cookie, "deniz@izlek.sh", "Deniz", Role::Member).await; + let page = app.get("/settings", Some(&member)).await; let html = String::from_utf8_lossy(&page.bytes); - assert!(html.contains("href=\"/logs\""), "{html}"); + assert!(html.contains(r##"href="#profile""##), "{html}"); + assert!(!html.contains("href=\"#limits\""), "{html}"); + assert!(!html.contains("href=\"#members\""), "{html}"); } /// Polls the store until a `Rule` send for `rule_id` addressed to `recipient` diff --git a/style/main.scss b/style/main.scss index 2ddb58b..0934e02 100644 --- a/style/main.scss +++ b/style/main.scss @@ -377,6 +377,28 @@ a { font-weight: 600; } +.topbar-nav-links { + display: flex; + gap: 16px; +} + +.topbar-nav { + font-family: var(--font-mono); + font-size: 10px; + letter-spacing: 0.08em; + text-transform: uppercase; + color: var(--muted-soft); + text-decoration: none; + padding-bottom: 2px; + + &:hover { color: var(--ink); } + + &-on { + color: var(--ink); + box-shadow: inset 0 -2px 0 var(--ink); + } +} + .scaffold-note { margin: 24px; padding: 20px 24px; @@ -2064,39 +2086,9 @@ a { // --- Settings (Settings and MemberSettings artboards) ---------------------- .settings-shell { - display: flex; - min-height: calc(100vh - var(--topbar-height)); -} - -.sidenav { - width: 220px; - flex-shrink: 0; - border-right: 1px solid var(--border); - padding: 20px 12px; display: flex; flex-direction: column; - gap: 2px; -} - -.sidenav-item { - display: flex; - align-items: center; - height: 36px; - padding: 0 12px; - border-radius: var(--radius); - font-size: 13px; - font-weight: 500; - color: var(--ink-soft); - text-decoration: none; - transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); - - &:hover { background: var(--surface-sunken); color: var(--ink); } - - &-on { - background: var(--accent-tint); - color: var(--accent-ink); - font-weight: 600; - } + min-height: calc(100vh - var(--topbar-height)); } .settings-stage { @@ -2116,6 +2108,23 @@ a { gap: 10px; } +.settings-sections { + display: flex; + flex-wrap: wrap; + gap: 16px; +} + +.settings-section-link { + font-family: var(--font-mono); + font-size: 10px; + letter-spacing: 0.08em; + text-transform: uppercase; + color: var(--muted-soft); + text-decoration: none; + + &:hover { color: var(--ink); } +} + .settings-title { margin: 0; font-size: 18px;