From c576613b9d9d817a5dcf238ea30850bb92299625 Mon Sep 17 00:00:00 2001 From: Cosmically Creative <99832139+Cosmically-Creative@users.noreply.github.com> Date: Fri, 20 Nov 2026 11:44:58 -0600 Subject: [PATCH] feat: coordinator dropdown replaces the tab row - pages.tsx: when signed in, the Coordinator pill in the session bar is a
menu with Shifts, Contacts and Settings, the current section marked. Signed out it stays a plain link to sign-in. Off coordinator pages no section is marked current. CoordinatorTabs is removed. - Phones and tablets (75em and below): no nested menu inside the hamburger overlay; the three sections show as a second row under Sign Up / Log out. - app.css: .coord-menu and .session-sections styles; drop .desk-tabs. - enhance.js: the menu closes on outside click and Esc, like the View menu. - tests: admins.test.ts checks the menu, the phone row, the signed-out link, and no current section on a public page. --- public/css/app.css | 222 +++++++++++++++++++++++++++++++------------ public/js/enhance.js | 2 +- src/pages.tsx | 69 +++++++++----- tests/admins.test.ts | 15 ++- 4 files changed, 218 insertions(+), 90 deletions(-) diff --git a/public/css/app.css b/public/css/app.css index b45bc81..91bab39 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -445,6 +445,131 @@ a.btn:active { content: none; } +/* Coordinator dropdown in the session bar, signed in. Same pattern as the view menu: a white card under the pill. */ +.session-bar .coord-menu { + position: relative; +} + +.session-bar .coord-menu > summary { + position: relative; + display: inline-flex; + align-items: center; + min-height: 44px; + margin: 0; + padding: 0; + list-style: none; + background: transparent; + color: #222; + font: inherit; + font-size: 18px; + font-weight: 400; + line-height: 1; + text-decoration: none; + cursor: pointer; + transition: transform 0.3s; +} + +.session-bar .coord-menu > summary::-webkit-details-marker { + display: none; +} + +.session-bar .coord-menu > summary::marker { + content: ""; +} + +.session-bar .coord-menu > summary::after { + content: ""; + width: 0.4rem; + height: 0.4rem; + margin-left: 0.35rem; + border-right: 2px solid currentColor; + border-bottom: 2px solid currentColor; + transform: translateY(-0.12rem) rotate(45deg); +} + +.session-bar .coord-menu[open] > summary::after { + transform: translateY(0.12rem) rotate(225deg); +} + +.session-bar .coord-menu > summary:hover, +.session-bar .coord-menu > summary:active { + transform: scale(1.1); + background: transparent; + color: #444; +} + +/* On a coordinator page the pill is bold with the same gold line as the session-bar links. */ +.session-bar .coord-menu > summary.session-here { + font-weight: 650; +} + +.session-bar .coord-menu > summary.session-here::before { + content: ""; + position: absolute; + left: 0; + right: 0; + bottom: 7px; + height: 2px; + border-radius: 999px; + background: var(--hope-gold); +} + +.coord-menu-list { + position: absolute; + z-index: 1001; + top: calc(100% + 0.35rem); + right: 0; + display: grid; + min-width: 9.5rem; + padding: 0.3rem; + background: #fff; + border: 1px solid var(--hope-border-2); + border-radius: 1rem; + box-shadow: var(--hope-shadow); +} + +.coord-menu-list a { + position: relative; + display: inline-flex; + align-items: center; + min-height: 44px; + padding: 0.3rem 0.8rem; + border-radius: 0.7rem; + color: var(--hope-ink); + font-size: 1rem; + font-weight: 500; + line-height: 1.2; + text-decoration: none; + white-space: nowrap; +} + +.coord-menu-list a:hover, +.coord-menu-list a:active { + background: var(--hope-blue-75); + color: var(--hope-ink); + text-decoration: none; +} + +.coord-menu-list a[aria-current] { + font-weight: 650; +} + +.coord-menu-list a[aria-current]::after { + content: ""; + position: absolute; + left: 0.8rem; + right: 0.8rem; + bottom: 9px; + height: 2px; + border-radius: 999px; + background: var(--hope-gold); +} + +/* Phone and tablet: no dropdown inside the ☰ menu, a second plain row instead. Hidden on desktop. */ +.session-sections { + display: none; +} + /* Page */ main { @@ -3284,68 +3409,6 @@ button.btn-quiet::before { margin: 0.15rem 0 0; } -/* Coordinator tabs. Same family as the session bar: a white pill, plain links, a gold line under the current one. */ -.desk-tabs { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 0 1.75rem; - width: fit-content; - max-width: 100%; - margin: 0 0 1.25rem; - padding: 0 1.5rem; - background: #fff; - border: 1px solid #e6eef3; - border-radius: 999px; - box-shadow: var(--hope-shadow-soft); -} - -.desk-tabs a { - position: relative; - display: inline-flex; - align-items: center; - min-height: 48px; - color: var(--hope-ink); - font-size: 1.05rem; - font-weight: 500; - line-height: 1; - text-decoration: none; -} - -.desk-tabs a:hover { - color: var(--hope-ink-2); -} - -.desk-tabs a[aria-current] { - font-weight: 650; -} - -.desk-tabs a[aria-current]::after { - content: ""; - position: absolute; - left: 0; - right: 0; - bottom: 10px; - height: 2px; - border-radius: 999px; - background: var(--hope-gold); -} - -.desk-tabs a:focus-visible { - outline: 2px solid var(--hope-ink); - outline-offset: 3px; - border-radius: 4px; -} - -@media (max-width: 42em) { - .desk-tabs { - width: 100%; - justify-content: space-between; - gap: 0 1rem; - padding: 0 1.25rem; - } -} - .coordinator-board { display: grid; gap: 1rem; @@ -4283,6 +4346,7 @@ button.btn-quiet::before { left: 0; bottom: 28px; z-index: 1001; + flex-wrap: wrap; justify-content: center; gap: 22px; width: auto; @@ -4299,6 +4363,39 @@ button.btn-quiet::before { transition: transform 0.4s ease-in, opacity 0.4s ease-in; } + .coord-menu { + display: none; + } + + .session-sections { + display: flex; + flex: 0 0 100%; + align-items: center; + justify-content: center; + gap: 22px; + } + + .session-sections-label { + color: var(--hope-ink-2); + font-size: 0.875rem; + font-weight: 500; + } + + .session-sections a[aria-current] { + font-weight: 650; + } + + .session-sections a[aria-current]::after { + content: ""; + position: absolute; + left: 0; + right: 0; + bottom: 7px; + height: 2px; + border-radius: 999px; + background: var(--hope-gold); + } + .header.nav-open ~ main .session-bar { opacity: 1; visibility: visible; @@ -5901,7 +5998,6 @@ main > .crumb, .header, .footer, .session-bar, - .desk-tabs, .crumb, .desk-actions, .desk-inline, diff --git a/public/js/enhance.js b/public/js/enhance.js index 801d5ae..7bd69a8 100644 --- a/public/js/enhance.js +++ b/public/js/enhance.js @@ -27,7 +27,7 @@ } function bindViewMenu() { - var menus = document.querySelectorAll('details.view-menu, details.manage-menu'); + var menus = document.querySelectorAll('details.view-menu, details.manage-menu, details.coord-menu'); if (!menus.length) return; document.addEventListener('click', function (event) { for (var i = 0; i < menus.length; i += 1) { diff --git a/src/pages.tsx b/src/pages.tsx index f5d6489..d9eb205 100644 --- a/src/pages.tsx +++ b/src/pages.tsx @@ -38,6 +38,8 @@ export function Layout(props: { const home = appPath(props.config, '/'); const coordinator = appPath(props.config, props.account ? '/admin' : '/login'); const coordinatorHere = pathIs(props.path, coordinator); + const adminHere = pathIs(props.path, appPath(props.config, '/admin')); + const sections = props.account ? coordinatorSections(props.config, props.path) : []; const volunteeringCurrent = props.path === home ? 'page' : undefined; const logo = asset(props.config, '/img/logo.png'); const menu = asset(props.config, '/img/icons/menu.svg'); @@ -110,17 +112,39 @@ export function Layout(props: { Sign Up - - Coordinator - + {props.account ? ( +
+ Coordinator +
+ {sections.map((section) => ( + + {section.label} + + ))} +
+
+ ) : ( + + Coordinator + + )} {props.account ? (
) : null} + {props.account ? ( + + ) : null} - {props.account && pathIs(props.path, appPath(props.config, '/admin')) ? : null} {props.children}