diff --git a/public/css/app.css b/public/css/app.css index 304d978..d25fcc0 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -862,13 +862,19 @@ main a:hover { margin: 0.5rem 0 0; } +.manage-record:has(.manage-tools) { + padding-top: 4.35rem; +} + .manage-tools { position: absolute; z-index: 2; top: 1.05rem; right: 1.05rem; + left: 1.05rem; display: flex; align-items: center; + justify-content: flex-end; gap: 0.4rem; margin: 0; } @@ -878,46 +884,11 @@ main a:hover { } .manage-x { - width: 2.5rem; - height: 2.5rem; min-height: 2.5rem; - padding: 0; - border-color: var(--hope-border); - background: #fff; + padding: 0.4rem 0.95rem; box-shadow: none; } -.manage-x::before { - background: var(--hope-yellow); -} - -.manage-x span { - position: relative; - width: 0.7rem; - height: 0.7rem; - font-size: 0; -} - -.manage-x span::before, -.manage-x span::after { - content: ""; - position: absolute; - left: 50%; - top: 50%; - width: 0.7rem; - height: 2px; - border-radius: 1px; - background: currentColor; -} - -.manage-x span::before { - transform: translate(-50%, -50%) rotate(45deg); -} - -.manage-x span::after { - transform: translate(-50%, -50%) rotate(-45deg); -} - .manage-menu { position: relative; } @@ -3057,6 +3028,45 @@ button.btn-quiet::before { color: var(--hope-ink); } +.shift-card a[href^="tel:"], +.shift-card a[href^="mailto:"] { + color: inherit; + font-weight: 650; + text-decoration: underline; + text-underline-offset: 0.12em; +} + +.roster-move { + margin-top: 0.75rem; +} + +.roster-move:not([open]) > .move-form, +.roster-move:not([open])::details-content { + display: none; +} + +.roster-move > summary { + display: inline-flex; + align-items: center; + width: fit-content; + min-height: 2rem; + list-style: none; + cursor: pointer; + color: #4d7494; + font-size: 0.92rem; + font-weight: 650; + text-decoration: underline; + text-underline-offset: 0.12em; +} + +.roster-move > summary::-webkit-details-marker { + display: none; +} + +.roster-move > .move-form { + margin-top: 0.75rem; +} + .event-page .desk-intro .desk-toolbar { align-items: center; } @@ -4341,10 +4351,6 @@ button.btn-quiet::before { width: 100%; } - .manage-record:has(.manage-tools) { - padding-top: 4.35rem; - } - .manage-record:has(.manage-tools) .details { padding-right: 0; } @@ -5831,3 +5837,62 @@ main > .crumb, flex-wrap: wrap; } } + +@media print { + .skip-link, + .header, + .footer, + .session-bar, + .crumb, + .desk-actions, + .desk-inline, + .pick, + .pick-bar, + .notice, + .event-edit, + .walkin-menu, + .roster-move, + .roster-actions, + .signup-form, + .confirm-dialog, + .event-dialog, + button, + .btn { + display: none !important; + } + + body, + main, + .event-page, + .shift-card, + article.shift-card, + .desk-events, + .event-strip, + .manage, + .manage-record { + background: #fff; + box-shadow: none; + color: #000; + } + + .shift-list { + display: block; + } + + .shift-list > li, + li.shift-card { + break-inside: avoid; + margin-bottom: 0.75rem; + border: 1px solid #bbb; + border-radius: 0; + box-shadow: none; + background: #fff; + } + + a, + .shift-card a[href^="tel:"], + .shift-card a[href^="mailto:"] { + color: #000; + text-decoration: none; + } +} diff --git a/public/js/desk.js b/public/js/desk.js index 58a29e7..2889c17 100644 --- a/public/js/desk.js +++ b/public/js/desk.js @@ -1,4 +1,16 @@ (function () { + window.addEventListener( + 'error', + function (event) { + var target = event.target; + if (!target || !target.src || String(target.src).indexOf('challenges.cloudflare.com/turnstile') === -1) return; + document.querySelectorAll('[data-turnstile-fallback]').forEach(function (node) { + node.hidden = false; + }); + }, + true, + ); + var key = 'hope-place'; var place = null; try { diff --git a/public/js/signup-dialog.js b/public/js/signup-dialog.js index 945054d..d60d383 100644 --- a/public/js/signup-dialog.js +++ b/public/js/signup-dialog.js @@ -200,14 +200,28 @@ if (!widget || !sitekey) return; loadTurnstile() .then(function () { - if (!widget.isConnected || !window.turnstile) return; + if (!widget.isConnected || !window.turnstile) { + showTurnstileFallback(scope); + return; + } // turnstile.ready() throws when this script is inserted dynamically. - widgetId = window.turnstile.render(widget, { - sitekey: sitekey, - action: widget.getAttribute('data-action') || 'signup', - }); + try { + widgetId = window.turnstile.render(widget, { + sitekey: sitekey, + action: widget.getAttribute('data-action') || 'signup', + }); + } catch (err) { + showTurnstileFallback(scope); + } }) - .catch(function () {}); + .catch(function () { + showTurnstileFallback(scope); + }); + } + + function showTurnstileFallback(scope) { + var fallback = scope.querySelector('[data-turnstile-fallback]'); + if (fallback) fallback.hidden = false; } function loadTurnstile() { diff --git a/src/admin-pages.tsx b/src/admin-pages.tsx index d90d18e..479472f 100644 --- a/src/admin-pages.tsx +++ b/src/admin-pages.tsx @@ -2007,12 +2007,18 @@ function Roster(props: { config: AppConfig; csrf: string; people: RosterPerson[] {person.name}

{person.groupSize > 1 ?

Holds {person.groupSize} spots

: null} -

{person.email}

- {person.phone ?

{person.phone}

: null} +

+ {person.email} +

+ {person.phone ? ( +

+ +

+ ) : null} {person.notes ?

Note: {person.notes}

: null}

{person.status === 'confirmed' ? 'Confirmed' : 'Cancelled'}

{person.status === 'cancelled' ? ( -

+

-

+

{props.moves && props.moves.targets.length > 0 && props.moves.tokens[person.id] ? ( -
- - - - -
+
+ Move to another shift +
+ + + + +
+
) : null} ) : null} @@ -2053,6 +2062,21 @@ function Roster(props: { config: AppConfig; csrf: string; people: RosterPerson[] ); } +function PhoneLink(props: { phone: string }) { + const href = phoneHref(props.phone); + if (!href) return <>{props.phone}; + return {props.phone}; +} + +/** A 10-digit pantry number dials as +1. Anything else keeps the digits it has. */ +function phoneHref(phone: string): string | null { + const digits = phone.replace(/\D/g, ''); + if (digits.length === 10) return `tel:+1${digits}`; + if (digits.length === 11 && digits.startsWith('1')) return `tel:+${digits}`; + if (digits.length > 0) return `tel:${digits}`; + return null; +} + function LoginForm(props: { config: AppConfig; error?: string }) { return ( <> diff --git a/src/pages.tsx b/src/pages.tsx index dfab6cf..02f4118 100644 --- a/src/pages.tsx +++ b/src/pages.tsx @@ -13,6 +13,9 @@ import { assetHref } from './static-assets.js'; import { appPath } from './url.js'; const PANTRY_SITE = 'https://hopefoodpantrysc.org'; +const PANTRY_PHONE_LABEL = '712\u2011540\u20119351'; +const PANTRY_PHONE_HREF = 'tel:+17125409351'; +const PANTRY_EMAIL = 'hopepantry@gmail.com'; function asset(config: AppConfig, file: string): string { return assetHref(config, file); @@ -136,10 +139,10 @@ export function Layout(props: { {errorEntries.length > 0 ? (