diff --git a/public/css/app.css b/public/css/app.css index 91bab39..c35f867 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -445,39 +445,12 @@ 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. */ +/* Coordinator menu in the session bar, signed in. A real pill link with the three sections in a card; opens on hover on desktop. */ .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 { +.session-bar .coord-menu > a::after { content: ""; width: 0.4rem; height: 0.4rem; @@ -487,39 +460,17 @@ a.btn:active { transform: translateY(-0.12rem) rotate(45deg); } -.session-bar .coord-menu[open] > summary::after { +.session-bar .coord-menu:hover > a::after, +.session-bar .coord-menu:focus-within > a::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; + display: none; min-width: 9.5rem; padding: 0.3rem; background: #fff; @@ -528,6 +479,21 @@ a.btn:active { box-shadow: var(--hope-shadow); } +/* Invisible bridge over the gap, so the card stays open while the pointer crosses it. */ +.coord-menu-list::before { + content: ""; + position: absolute; + top: -0.5rem; + left: 0; + right: 0; + height: 0.5rem; +} + +.session-bar .coord-menu:hover .coord-menu-list, +.session-bar .coord-menu:focus-within .coord-menu-list { + display: grid; +} + .coord-menu-list a { position: relative; display: inline-flex; @@ -543,28 +509,15 @@ a.btn:active { white-space: nowrap; } +/* The session-bar links scale up on hover; the menu links must not, so the highlight stays inside the card. */ .coord-menu-list a:hover, .coord-menu-list a:active { + transform: none; 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; @@ -4381,21 +4334,6 @@ button.btn-quiet::before { 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; diff --git a/public/js/enhance.js b/public/js/enhance.js index 7bd69a8..dd741c0 100644 --- a/public/js/enhance.js +++ b/public/js/enhance.js @@ -2,6 +2,7 @@ bindNav(); bindCalendar(); bindViewMenu(); + bindCoordMenu(); bindManage(); bindSignupDates(); document.querySelectorAll('[data-contact]').forEach(bindContact); @@ -27,7 +28,7 @@ } function bindViewMenu() { - var menus = document.querySelectorAll('details.view-menu, details.manage-menu, details.coord-menu'); + var menus = document.querySelectorAll('details.view-menu, details.manage-menu'); if (!menus.length) return; document.addEventListener('click', function (event) { for (var i = 0; i < menus.length; i += 1) { @@ -41,6 +42,16 @@ }); } + function bindCoordMenu() { + var menu = document.querySelector('.coord-menu'); + if (!menu) return; + menu.addEventListener('keydown', function (event) { + if (event.key !== 'Escape') return; + var active = document.activeElement; + if (active && menu.contains(active)) active.blur(); + }); + } + function bindCalendar() { var calendar = document.querySelector('.shift-calendar'); var weeks = document.querySelectorAll('.cal-week'); diff --git a/src/admin-http.tsx b/src/admin-http.tsx index 085005d..126bc51 100644 --- a/src/admin-http.tsx +++ b/src/admin-http.tsx @@ -298,7 +298,7 @@ function showHome( return html( c, services, - newEvent ? 'New event · Hope Volunteer' : 'Coordinator · Hope Volunteer', + newEvent ? 'New event · Hope Volunteer' : 'Shifts · Hope Volunteer',
-

Coordinator

+

Shifts

{clock.dateLabel}

Signed in as {props.name}. This sign-in ends on {sessionEnds.dateLabel}. @@ -534,7 +534,6 @@ export function AdminsPage(props: { <> {event ? (

- +

{props.heading}

@@ -970,7 +968,7 @@ export function TemplateEditor(props: { <> {props.account ? ( -
- Coordinator +
+
) : ( Coordinator diff --git a/tests/admins.test.ts b/tests/admins.test.ts index 75c0641..0666c2a 100644 --- a/tests/admins.test.ts +++ b/tests/admins.test.ts @@ -43,16 +43,16 @@ describe('administrators', () => { const cookie = await signIn(app, db, 'coordinator@example.invalid'); const home = await app.request('/admin', { headers: { cookie } }); const homeHtml = await home.text(); - expect(homeHtml).toContain('
'); - expect(homeHtml).toContain('Coordinator'); + expect(homeHtml).toContain('
'); + expect(homeHtml).toContain('Coordinator'); expect(homeHtml).toContain('Shifts'); expect(homeHtml).toContain('Contacts'); expect(homeHtml).toContain('Settings'); expect(homeHtml).not.toContain('href="/admin/admins"'); expect(homeHtml).toContain('