feat: give the app its own nav under the pantry header

Site links now follow hopefoodpantrysc.org. Calendar, Coordinator, and Log out sit in a separate white pill on every page.
This commit is contained in:
blake committed 2026-10-17 15:47:27 -05:00
1 parent ec259f58b2
commit 03da30dbbc
5 files changed
+628 -426

No files matched your search

+506 -336
View File
@@ -96,7 +96,7 @@ body {
border-radius: 999px;
border: 1px solid var(--hope-gold);
box-shadow: var(--hope-shadow-soft);
z-index: 40;
z-index: 1100;
text-decoration: none;
font-weight: 650;
}
@@ -115,180 +115,7 @@ main:focus-visible {
outline: none;
}
/* Header. Matches the pantry site: a faded wash, then a blue pill around the links. */
.site-header {
position: fixed;
z-index: 30;
top: 0;
left: 0;
right: 0;
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 0.65rem 5%;
background: linear-gradient(
to bottom,
color-mix(in srgb, var(--hope-blue-75) 75%, transparent) 0,
color-mix(in srgb, var(--hope-blue-75) 75%, transparent) calc(100% - 1.75rem),
transparent 100%
);
pointer-events: none;
}
.site-header a,
.site-header button,
.site-header label,
.nav-toggle {
pointer-events: auto;
}
.logo-link {
display: flex;
flex: none;
position: relative;
z-index: 36;
line-height: 0;
}
.logo {
width: min(14.5rem, 42vw);
height: auto;
}
.logo-link:hover .logo {
transform: scale(1.06);
}
.logo {
transition: transform 0.4s ease;
}
.nav-toggle {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
.btn-mobile-nav {
display: none;
z-index: 36;
width: 3rem;
height: 3rem;
padding: 0;
border: 0;
background: transparent;
cursor: pointer;
place-items: center;
}
.btn-mobile-nav .icon-mobile-nav {
grid-area: 1 / 1;
}
.icon-mobile-nav {
width: 2.6rem;
height: 2.6rem;
}
.icon-close {
display: none;
}
.nav-toggle:focus-visible + .btn-mobile-nav {
outline: 3px solid var(--hope-ink);
outline-offset: 3px;
border-radius: 0.4rem;
}
.nav-links {
list-style: none;
display: flex;
flex-wrap: wrap;
gap: 0.35rem 1.35rem;
align-items: center;
justify-content: flex-end;
margin: 0;
padding: 0.55rem 0.7rem 0.55rem 1.35rem;
background: var(--hope-blue-100);
border-radius: 999px;
box-shadow: 0 4px 4px #22222240;
pointer-events: auto;
}
.nav-links a,
.nav-logout button {
color: var(--hope-ink);
text-decoration: none;
min-height: 44px;
display: inline-flex;
align-items: center;
background: transparent;
}
.main-nav-link {
transition: transform 0.3s ease, color 0.3s ease;
}
.main-nav-link:hover,
.main-nav-link:active,
.nav-logout button:hover {
color: var(--hope-ink-2);
transform: scale(1.08);
}
.nav-links a[aria-current="page"] {
font-weight: 650;
}
.header-side {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 0.15rem;
min-width: 0;
}
.utility-links {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 0.1rem 1.15rem;
list-style: none;
margin: 0;
padding: 0 0.85rem 0 0;
}
.utility-links a,
.utility-logout button {
color: var(--hope-ink-2);
text-decoration: none;
min-height: 44px;
display: inline-flex;
align-items: center;
background: transparent;
font-size: 1rem;
}
.utility-links a:hover,
.utility-logout button:hover {
color: var(--hope-ink);
}
.utility-logout {
margin: 0;
}
.nav-logout {
margin: 0;
}
/* Header. Pixel sizes match hopefoodpantrysc.org, whose root font size is 10px. */
a.btn,
button,
@@ -343,21 +170,220 @@ a.btn:active {
color: var(--hope-ink);
}
.nav-logout button,
.utility-logout button {
font: inherit;
font-weight: 500;
border: 0;
padding: 0;
background: transparent;
box-shadow: none;
border-radius: 0;
overflow: visible;
min-height: 44px;
.header {
position: relative;
font-size: 18px;
line-height: 1.8;
font-weight: 400;
color: #222;
}
.nav-logout button::before,
.utility-logout button::before {
.nav {
left: 0;
position: fixed;
z-index: 999;
padding: 10px 5%;
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
background: linear-gradient(
to bottom,
rgb(236 247 252 / 0.75) 0%,
rgb(236 247 252 / 0.75) 50%,
transparent 100%
);
}
.logo {
max-width: 230px;
height: auto;
margin-bottom: 0.5925em;
transition: all 0.5s;
}
.logo:hover {
transform: scale(1.1);
}
.nav-links {
list-style: none;
display: flex;
gap: 50px;
margin: 0;
background-color: #e4f3fb;
padding: 15px 30px;
border-radius: 50px;
box-shadow: 0 4px 4px #22222240;
justify-content: center;
align-items: center;
}
.main-nav-link:link,
.main-nav-link:visited {
display: inline-block;
text-decoration: none;
color: #222;
transition: all 0.3s;
}
.main-nav-link:hover,
.main-nav-link:active {
text-decoration: none;
transform: scale(1.1);
color: #444;
}
.nav-links .btn:link,
.nav-links .btn:visited {
min-height: 0;
padding: 10px 30px;
border-radius: 50px;
border: 1px solid #fbcd62;
background-color: #f9e194;
color: #222;
box-shadow: 0 2px 2px #22222240;
font-weight: 400;
gap: 0;
transition: all 0.3s;
}
.nav-links .btn:hover,
.nav-links .btn:active {
transform: scale(1.1);
color: #222;
text-decoration: none;
}
.btn-mobile-nav {
display: none;
z-index: 1000;
margin: 0;
padding: 0;
border: 0;
border-radius: 0;
background: none;
box-shadow: none;
min-height: 0;
overflow: visible;
line-height: 0;
cursor: pointer;
}
.btn-mobile-nav::before {
content: none;
}
.btn-mobile-nav:hover,
.btn-mobile-nav:active {
transform: none;
background: none;
}
.icon-mobile-nav {
width: 50px;
height: 50px;
}
.icon-mobile-nav[name="close"] {
display: none;
}
.header.nav-open .icon-mobile-nav[name="close"] {
display: block;
}
.header.nav-open .icon-mobile-nav[name="open"] {
display: none;
}
.session-bar {
position: fixed;
z-index: 1000;
top: 118px;
right: 5%;
display: flex;
flex-wrap: nowrap;
align-items: center;
gap: 28px;
margin: 0;
padding: 4px 30px;
background: #fff;
border: 1px solid var(--hope-border-2);
border-radius: 50px;
box-shadow: none;
font-size: 18px;
line-height: 1;
}
.session-bar a,
.session-logout button {
position: relative;
display: inline-flex;
align-items: center;
min-height: 44px;
margin: 0;
padding: 0;
border: 0;
border-radius: 0;
background: transparent;
box-shadow: none;
overflow: visible;
color: #222;
font: inherit;
font-size: 18px;
font-weight: 400;
line-height: 1;
text-decoration: none;
cursor: pointer;
transition: transform 0.3s;
}
.session-bar a:hover,
.session-bar a:active,
.session-logout button:hover,
.session-logout button:active {
transform: scale(1.1);
background: transparent;
color: #444;
}
.session-bar a.session-entry,
.session-bar a[aria-current="page"] {
font-weight: 650;
}
.session-bar a[aria-current="page"]::after {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: 7px;
height: 2px;
border-radius: 999px;
background: var(--hope-gold);
}
.session-logout {
display: flex;
align-items: center;
position: relative;
width: max-content;
margin: 0;
padding-left: 28px;
}
.session-logout::before {
content: "";
position: absolute;
left: 0;
top: 50%;
height: 18px;
transform: translateY(-50%);
border-left: 1px solid var(--hope-border);
}
.session-logout button::before {
content: none;
}
@@ -1212,7 +1238,7 @@ article.shift-card {
.event-dialog[open] {
position: fixed;
z-index: 40;
z-index: 1100;
inset: 0;
display: grid;
place-items: center;
@@ -1285,7 +1311,7 @@ article.shift-card {
.confirm-dialog[open] {
position: fixed;
z-index: 40;
z-index: 1100;
inset: 0;
display: grid;
place-items: center;
@@ -1629,6 +1655,12 @@ button.btn-quiet::before {
margin: 0;
}
@media (min-width: 75.001em) {
.event-page .desk-intro {
padding-top: 1.75rem;
}
}
.event-page .shift-list {
margin: 0;
}
@@ -1868,116 +1900,125 @@ button.btn-quiet::before {
}
}
/* Footer */
/* Footer. Pixel sizes match hopefoodpantrysc.org. */
.site-footer {
.footer {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 100px;
width: 100%;
margin: max(8rem, 22vw) 0 0;
padding: 3.5rem 6% 1.75rem;
background: var(--hope-blue-100);
color: var(--hope-ink-2);
margin: 220px 0 0;
padding: 250px 5% 30px;
background-color: #e4f3fb;
color: #222;
font-size: 18px;
line-height: 1.8;
font-weight: 400;
}
.footer-wave {
.footer .wave {
position: absolute;
left: 0;
bottom: calc(100% - 1.5rem);
width: 100%;
height: auto;
display: block;
bottom: -6%;
pointer-events: none;
}
.footer .wave-secondary {
top: -40%;
}
.footer-nav {
position: relative;
z-index: 1;
display: grid;
grid-template-columns: 1.3fr 1fr 1fr 1fr;
gap: 2rem 2.25rem;
grid-template-columns: repeat(4, 1fr);
width: 100%;
justify-items: center;
align-items: start;
}
.footer-brand .logo {
width: min(12rem, 70%);
margin-bottom: 0.8rem;
.footer-nav-links {
list-style: none;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin: 0;
padding: 0;
justify-content: center;
align-items: start;
}
.footer-cell {
display: flex;
flex-direction: column;
gap: 0.45rem;
gap: 15px;
}
.footer-cell h2 {
margin: 0 0 0.35rem;
font-size: 1.35rem;
font-weight: 650;
color: var(--hope-ink);
.footer h3 {
margin: 0;
font-size: 30px;
font-weight: 700;
letter-spacing: -1.5px;
line-height: 1.2;
color: #222;
}
.footer-cell p,
.equal-text,
address {
.footer p,
.footer address {
margin: 0;
font-style: normal;
}
.equal-text {
max-width: 16rem;
font-size: 0.98rem;
}
.footer-links {
list-style: none;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.35rem 1rem;
margin: 0;
padding: 0;
}
.site-footer a {
color: var(--hope-ink);
text-decoration: none;
min-height: 44px;
display: inline-flex;
align-items: center;
}
.site-footer a:hover {
color: var(--hope-ink-2);
}
.social-links {
display: flex;
flex-direction: column;
gap: 0.15rem;
margin-top: 0.35rem;
}
.social-flex {
display: flex;
align-items: center;
gap: 0.7rem;
}
.social-links img {
width: 2.15rem;
height: auto;
transition: transform 0.3s ease;
}
.social-links a:hover img {
transform: scale(1.08);
font-size: 12.5px;
color: #444;
}
.copyright-text {
position: relative;
z-index: 1;
margin: 2rem 0 0;
margin: 0;
text-align: center;
font-size: 0.95rem;
font-size: 15px;
color: #444;
}
.footer a:link,
.footer a:visited,
.footer a:active {
color: #222;
transition: all 0.3s;
}
.footer a:hover {
color: #444;
}
.social-links {
display: flex;
flex-direction: column;
justify-content: center;
gap: 15px;
}
.social-links img {
width: 40px;
height: auto;
transition: all 0.3s;
}
.social-links img:hover {
filter: invert(25%) sepia(5%) saturate(19%) hue-rotate(314deg) brightness(95%) contrast(89%);
}
.social-flex {
display: flex;
align-items: center;
}
@media (min-width: 48rem) {
@@ -1986,86 +2027,130 @@ address {
}
}
@media (min-width: 75.001em) {
/* The menu control is only for the narrow layout. On a wide screen it is an extra tab stop with nothing to show. */
.nav-toggle {
display: none;
@media (max-width: 100em) {
.footer {
margin-top: 160px;
padding: 50px 5% 30px;
}
.footer-nav {
grid-template-columns: 1fr 1fr;
justify-items: start;
gap: 50px;
margin-top: 100px;
width: 70%;
}
.footer-nav > :nth-child(4) {
grid-column: 2 / 3;
grid-row: 1 / 2;
}
.footer .wave-secondary {
top: -20%;
}
}
@media (max-width: 85em) {
.nav-links {
gap: 40px;
}
.footer h3 {
font-size: 25px;
}
.footer-nav {
width: 80%;
}
}
@media (max-width: 75em) {
.btn-mobile-nav {
display: grid;
margin-left: auto;
}
.site-header nav {
position: absolute;
}
.utility-links {
position: fixed;
left: 0;
right: 0;
bottom: 2.5rem;
z-index: 35;
justify-content: center;
gap: 0.35rem 1.75rem;
padding: 0 1.5rem;
transform: translateX(100%);
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: transform 0.4s ease, opacity 0.4s ease;
}
.utility-links a,
.utility-logout button {
color: var(--hope-ink);
font-size: 1.15rem;
}
.nav-links {
position: fixed;
inset: 0;
z-index: 34;
border-radius: 0;
flex-direction: column;
flex-wrap: nowrap;
justify-content: center;
gap: 0.35rem;
padding: 5rem 1.5rem 2rem;
background: rgb(228 243 251 / 0.95);
box-shadow: none;
font-size: 1.45rem;
font-weight: 650;
transform: translateX(100%);
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: transform 0.4s ease, opacity 0.4s ease;
}
.nav-toggle:checked ~ .btn-mobile-nav .icon-open {
display: none;
}
.nav-toggle:checked ~ .btn-mobile-nav .icon-close {
display: block;
}
.nav-toggle:checked ~ .header-side nav .nav-links,
.nav-toggle:checked ~ .header-side .utility-links {
transform: none;
.nav-links {
border-radius: 0;
background: linear-gradient(rgb(228 243 251 / 0.95));
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100vh;
transform: translateX(100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 72px 24px 180px;
transition: all 0.4s ease-in;
font-size: 25px;
font-weight: 700;
opacity: 0;
pointer-events: none;
visibility: hidden;
box-shadow: none;
}
.session-bar {
top: auto;
right: 0;
left: 0;
bottom: 28px;
z-index: 1001;
justify-content: center;
gap: 22px;
width: auto;
padding: 14px 24px 0;
background: transparent;
border: 0;
border-radius: 0;
box-shadow: none;
border-top: 1px solid var(--hope-border);
transform: translateX(100%);
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: transform 0.4s ease-in, opacity 0.4s ease-in;
}
.header.nav-open ~ main .session-bar {
opacity: 1;
visibility: visible;
pointer-events: auto;
transform: translateX(0);
}
.session-logout {
margin: 0;
padding: 0;
}
.session-logout::before {
content: none;
}
.header.nav-open .nav-links {
opacity: 1;
pointer-events: auto;
visibility: visible;
transform: translateX(0);
}
.nav-links .btn:link,
.nav-links .btn:visited {
font-weight: 700;
}
.footer-nav {
width: 90%;
}
}
@media (max-width: 62em) {
.footer-nav {
grid-template-columns: 1fr 1fr;
.footer .wave-secondary {
top: -10%;
}
}
@@ -2079,25 +2164,37 @@ address {
font-size: 2.15rem;
}
.footer {
margin-top: 48px;
padding: 50px 5% 30px;
}
.footer-nav {
grid-template-columns: 1fr;
justify-items: center;
text-align: center;
}
.footer-brand,
.footer-cell,
.equal-text {
align-items: center;
max-width: none;
.footer-nav > :nth-child(4) {
grid-column: 1 / 2;
grid-row: 2 / 3;
}
.footer-links {
justify-items: center;
.footer .wave-secondary {
top: -5%;
}
.social-flex {
justify-content: center;
.footer-cell {
width: 250px;
}
.logo {
max-width: 200px;
}
.nav-links .btn:link,
.nav-links .btn:visited {
padding: 20px 30px;
width: 250px;
}
.manage-actions {
@@ -2185,6 +2282,79 @@ address {
}
}
@media (max-width: 33em) {
.header,
.footer {
font-size: 13.824px;
}
.nav {
padding-top: 7.68px;
padding-bottom: 7.68px;
}
.footer {
gap: 76.8px;
padding: 38.4px 5% 23.04px;
}
.footer-nav {
gap: 38.4px;
margin-top: 76.8px;
}
.footer-nav-links {
gap: 15.36px;
}
.footer-cell {
width: 192px;
gap: 11.52px;
}
.footer h3 {
font-size: 17.28px;
}
.equal-text {
font-size: 9.6px;
}
.copyright-text {
display: flex;
flex-direction: column;
align-items: center;
font-size: 11.52px;
}
.social-links {
gap: 11.52px;
}
.social-links img {
width: 30.72px;
}
.nav-links {
font-size: 19.2px;
}
.logo {
max-width: 153.6px;
}
.icon-mobile-nav {
width: 38.4px;
height: 38.4px;
}
.nav-links .btn:link,
.nav-links .btn:visited {
padding: 23.04px 15.36px;
width: 230.4px;
}
}
/* Hamburger widths. Shift names are not squeezed into the day cells. */
@media (max-width: 75em) {
.cal-day {
+20
View File
@@ -1,10 +1,30 @@
(function () {
bindNav();
bindCalendar();
document.querySelectorAll('[data-contact]').forEach(bindContact);
document.querySelectorAll('[data-see-more]').forEach(bindSeeMore);
var boxes = document.querySelectorAll('[data-under-18]');
for (var i = 0; i < boxes.length; i += 1) bind(boxes[i]);
function bindNav() {
var header = document.querySelector('.header');
var button = document.querySelector('.btn-mobile-nav');
if (!header || !button) return;
button.addEventListener('click', function () {
var open = header.classList.toggle('nav-open');
button.setAttribute('aria-expanded', open ? 'true' : 'false');
});
var close = function () {
header.classList.remove('nav-open');
button.setAttribute('aria-expanded', 'false');
};
var links = document.querySelectorAll('.main-nav-link, .session-bar a');
for (var i = 0; i < links.length; i += 1) links[i].addEventListener('click', close);
document.addEventListener('keydown', function (event) {
if (event.key === 'Escape') close();
});
}
function bindCalendar() {
var calendar = document.querySelector('.shift-calendar');
var weeks = document.querySelectorAll('.cal-week');
+66 -62
View File
@@ -13,6 +13,11 @@ function asset(config: AppConfig, file: string): string {
return appPath(config, file);
}
function pathIs(path: string | undefined, target: string): boolean {
if (!path) return false;
return path === target || path.startsWith(`${target}/`);
}
export function Layout(props: {
config: AppConfig;
title: string;
@@ -22,8 +27,9 @@ export function Layout(props: {
children?: Child;
}) {
const home = appPath(props.config, '/');
const privacy = appPath(props.config, '/privacy');
const coordinator = appPath(props.config, props.account ? '/admin' : '/login');
const coordinatorHere = pathIs(props.path, coordinator);
const volunteeringCurrent = props.path === home ? 'page' : undefined;
const logo = asset(props.config, '/img/logo.png');
const menu = asset(props.config, '/img/icons/menu.svg');
const close = asset(props.config, '/img/icons/close.svg');
@@ -46,18 +52,11 @@ export function Layout(props: {
<a class="skip-link" href="#content">
Skip to content
</a>
<header class="site-header">
<a class="logo-link" href={`${PANTRY_SITE}/`}>
<img class="logo" src={logo} alt="Hope Food Pantry" />
<header class="header">
<nav class="nav" aria-label="Primary">
<a href={`${PANTRY_SITE}/`}>
<img class="logo" src={logo} alt="Hope Food Pantry logo" />
</a>
<input class="nav-toggle" id="nav-toggle" type="checkbox" />
<label class="btn-mobile-nav" for="nav-toggle">
<img class="icon-mobile-nav icon-open" src={menu} alt="" />
<img class="icon-mobile-nav icon-close" src={close} alt="" />
<span class="sr-only">Menu</span>
</label>
<div class="header-side">
<nav aria-label="Primary">
<ul class="nav-links">
<li>
<a class="main-nav-link" href={`${PANTRY_SITE}/`}>
@@ -65,17 +64,17 @@ export function Layout(props: {
</a>
</li>
<li>
<a class="main-nav-link" href={`${PANTRY_SITE}/about.html`}>
<a class="main-nav-link" href={`${PANTRY_SITE}/about`}>
About
</a>
</li>
<li>
<a class="main-nav-link" href={`${PANTRY_SITE}/faq.html`}>
<a class="main-nav-link" href={`${PANTRY_SITE}/faq`}>
FAQ
</a>
</li>
<li>
<a class="main-nav-link" href={home} aria-current={props.path === home ? 'page' : undefined}>
<a class="main-nav-link" href={home} aria-current={volunteeringCurrent}>
Volunteering
</a>
</li>
@@ -90,41 +89,35 @@ export function Layout(props: {
</a>
</li>
</ul>
<button class="btn-mobile-nav" type="button" aria-expanded="false" aria-label="Menu">
<img class="icon-mobile-nav" src={menu} alt="" name="open" />
<img class="icon-mobile-nav" src={close} alt="" name="close" />
</button>
</nav>
<ul class="utility-links">
<li>
</header>
<main id="content" tabIndex={-1}>
<div class="session-bar">
<a href={home} aria-current={props.path === home ? 'page' : undefined}>
Calendar
</a>
</li>
<li>
<a href={privacy} aria-current={props.path === privacy ? 'page' : undefined}>
Privacy
<a href={coordinator} class={props.account ? undefined : 'session-entry'} aria-current={coordinatorHere ? 'page' : undefined}>
Coordinator
</a>
</li>
<li>
<a href={coordinator}>Coordinator</a>
</li>
{props.account ? (
<li>
<form method="post" action={appPath(props.config, '/logout')} class="utility-logout">
<form method="post" action={appPath(props.config, '/logout')} class="session-logout">
<input type="hidden" name="csrf" value={props.account.csrf} />
<button type="submit">Log out</button>
</form>
</li>
) : null}
</ul>
</div>
</header>
<main id="content" tabIndex={-1}>
{props.children}
</main>
<footer class="site-footer">
<img class="footer-wave" src={wave} alt="" />
<div class="footer-nav">
<div class="footer-brand">
<a class="logo-link" href={`${PANTRY_SITE}/`}>
<img class="logo" src={logo} alt="Hope Food Pantry" />
<footer class="footer">
<img class="wave wave-secondary" src={wave} alt="" />
<nav class="footer-nav" aria-label="Footer">
<div>
<a href={`${PANTRY_SITE}/`}>
<img class="logo" src={logo} alt="Hope Food Pantry logo" />
</a>
<p class="equal-text">
Hope Food Pantry is an{' '}
@@ -134,30 +127,30 @@ export function Layout(props: {
</p>
</div>
<div class="footer-cell">
<h2>Contact Us</h2>
<h3>Contact Us</h3>
<p>
<a href="tel:+17125409351">712-540-9351</a>
<a href="tel:+17125409351">712‑540‑9351</a>
</p>
<p>
<a href="mailto:hopepantry@gmail.com">hopepantry@gmail.com</a>
</p>
<div class="social-links">
<a href="https://www.facebook.com/schopefoodpantry" target="_blank" rel="noopener noreferrer">
<span class="social-flex">
<img src={facebook} alt="" />
<span>schopefoodpantry</span>
</span>
<div class="social-flex">
<img src={facebook} alt="facebook icon" />
<p>schopefoodpantry</p>
</div>
</a>
<a href="https://www.instagram.com/hopefoodpantrysc" target="_blank" rel="noopener noreferrer">
<span class="social-flex">
<img src={instagram} alt="" />
<span>hopefoodpantrysc</span>
</span>
<div class="social-flex">
<img src={instagram} alt="instagram icon" />
<p>hopefoodpantrysc</p>
</div>
</a>
</div>
</div>
<div class="footer-cell">
<h2>Address</h2>
<h3>Address</h3>
<address>
<p>
4155 US 75 Ave
@@ -166,41 +159,52 @@ export function Layout(props: {
<br />
(Rear of Property)
</p>
<br />
<p>Mail to: PO Box 21</p>
</address>
</div>
<div class="footer-cell">
<h2>Navigation</h2>
<ul class="footer-links">
<h3>Navigation</h3>
<ul class="footer-nav-links">
<li>
<a href={`${PANTRY_SITE}/`}>Home</a>
<a class="main-nav-link" href={`${PANTRY_SITE}/`}>
Home
</a>
</li>
<li>
<a href={`${PANTRY_SITE}/about.html`}>About</a>
<a class="main-nav-link" href={`${PANTRY_SITE}/about`}>
About
</a>
</li>
<li>
<a href={`${PANTRY_SITE}/faq.html`}>FAQ</a>
<a class="main-nav-link" href={`${PANTRY_SITE}/faq`}>
FAQ
</a>
</li>
<li>
<a href={home} aria-current={props.path === home ? 'page' : undefined}>
<a class="main-nav-link" href={home} aria-current={volunteeringCurrent}>
Volunteering
</a>
</li>
<li>
<a href={`${PANTRY_SITE}/#contact`}>Contact</a>
<a class="main-nav-link" href={`${PANTRY_SITE}/#contact`}>
Contact
</a>
</li>
<li>
<a href="https://donorbox.org/hope-food-pantry-1">Donate</a>
</li>
<li>
<a href={privacy} aria-current={props.path === privacy ? 'page' : undefined}>
Privacy
<a class="main-nav-link" href="https://donorbox.org/hope-food-pantry-1">
Donate
</a>
</li>
</ul>
</div>
</div>
<p class="copyright-text">Hope Food Pantry, Sioux Center, Iowa</p>
</nav>
<p class="copyright-text">
Hope Food Pantry © 2026 | Design & Development by{' '}
<a href="https://cosmicallycreative.com" target="_blank" rel="noopener noreferrer">
Cosmically Creative
</a>
</p>
</footer>
{props.turnstile ? <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer /> : null}
<script src={appPath(props.config, '/js/enhance.js')} defer />
+16 -14
View File
@@ -5,6 +5,7 @@ import type { Context } from 'hono';
import type { Hono } from 'hono';
import type { Child } from 'hono/jsx';
import { listMoveTargets, switchSignup } from './admin/store.js';
import { readSession } from './auth/session.js';
import { cancelTokenMatches, issueCancelToken, issueReminderPageToken, issueSwitchToken, reminderPageTokenMatches, switchTokenMatches } from './cancel-token.js';
import { clientAddress } from './client-ip.js';
import { confirmationCookie, openConfirmation, sealConfirmation } from './confirm-cookie.js';
@@ -65,7 +66,7 @@ export function registerPublicSignup(app: Hono, services: SignupServices): void
app.get(appPath(config, '/s/:id'), (c) => {
const shift = loadShift(services, c.req.param('id') ?? '');
if (!shift) return html(c, config, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
if (!shift) return html(c, services, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
return shiftResponse(c, services, shift, 200, blankForm(services, shift));
});
@@ -73,14 +74,14 @@ export function registerPublicSignup(app: Hono, services: SignupServices): void
app.get(appPath(config, '/s/:id/confirmed'), (c) => {
const shift = loadShift(services, c.req.param('id') ?? '');
if (!shift) return html(c, config, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
if (!shift) return html(c, services, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
const seal = openConfirmation(config.sessionSecret, c.req.header('cookie'), epochMs(services.now()));
const manage = seal && seal.shiftId === shift.id ? readManageSignup(services.db, seal.token, services.now()) : null;
const matches = Boolean(manage && seal && manage.signupId === seal.signupId);
const cancelled = matches && manage?.status === 'cancelled';
return html(
c,
config,
services,
cancelled ? 'This signup is cancelled · Hope Volunteer' : "You're signed up · Hope Volunteer",
<ConfirmationPage
config={config}
@@ -103,7 +104,7 @@ async function submitSignup(c: Context, services: SignupServices): Promise<Respo
const { config, db } = services;
const now = services.now();
const shift = loadShift(services, c.req.param('id') ?? '');
if (!shift) return html(c, config, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
if (!shift) return html(c, services, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
const ip = clientAddress(config.trustProxy, peerAddress(c, services.clientIp), c.req.header('x-forwarded-for'));
if (!originAllowed(c, config.baseUrl)) {
return shiftResponse(c, services, shift, 403, formFor(services, shift, EMPTY_SIGNUP, {}, null), ORIGIN);
@@ -174,7 +175,7 @@ async function submitSignup(c: Context, services: SignupServices): Promise<Respo
mail: mailIdentity(db, config),
});
if (reserved.ok) return redirectConfirmed(c, services, shift.id, reserved.manageToken ? { signupId: reserved.signupId, token: reserved.manageToken } : null);
if (reserved.reason === 'not_found') return html(c, config, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
if (reserved.reason === 'not_found') return html(c, services, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
if (reserved.reason === 'closed') return shiftResponse(c, services, loadShift(services, String(shift.id)) ?? shift, 400, null, CLOSED);
if (reserved.reason === 'full') return shiftResponse(c, services, loadShift(services, String(shift.id)) ?? shift, 409, null, FULL);
if (reserved.reason === 'duplicate') {
@@ -221,7 +222,7 @@ function shiftResponse(
const showForm = signup !== null && !current.cancelled && !current.ended && !current.full;
return html(
c,
services.config,
services,
`${current.role} · Hope Volunteer`,
<ShiftPage config={services.config} shift={current} signup={showForm ? signup : null} notice={notice} />,
status,
@@ -306,7 +307,7 @@ function showManage(c: Context, services: SignupServices, token: string, status:
const note = manageNote(c.req.query('notice'));
return html(
c,
services.config,
services,
'Your signup · Hope Volunteer',
<ManagePage
signup={signup}
@@ -330,9 +331,9 @@ function missingManage(c: Context, services: SignupServices) {
const limit = recordInvalidManageToken(services.db, services.config.sessionSecret, services.now(), ip);
if (limit.limited) {
c.header('Retry-After', String(limit.retryAfter));
return html(c, services.config, 'Please wait · Hope Volunteer', <WaitPage />, 429);
return html(c, services, 'Please wait · Hope Volunteer', <WaitPage />, 429);
}
return html(c, services.config, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
return html(c, services, 'That page is not available · Hope Volunteer', <NotFoundPage />, 404);
}
async function submitCancel(c: Context, services: SignupServices): Promise<Response> {
@@ -362,7 +363,7 @@ async function submitSwitch(c: Context, services: SignupServices): Promise<Respo
const token = c.req.param('token') ?? '';
const signup = readManageSignup(services.db, token, services.now());
if (!originAllowed(c, services.config.baseUrl)) {
if (!signup) return html(c, services.config, 'Your signup · Hope Volunteer', <SwitchAlreadyPage />, 403);
if (!signup) return html(c, services, 'Your signup · Hope Volunteer', <SwitchAlreadyPage />, 403);
return showManage(c, services, token, 403, SWITCH_ORIGIN);
}
const body = await c.req.parseBody();
@@ -388,7 +389,7 @@ async function submitSwitch(c: Context, services: SignupServices): Promise<Respo
}
const result = switchSignup(services.db, signup.signupId, destination, formToken.claims.operationId, services.now(), mailIdentity(services.db, services.config));
if (!result.ok) return showManage(c, services, token, 400, result.error);
if (!result.manageToken) return html(c, services.config, 'Your signup · Hope Volunteer', <SwitchAlreadyPage />);
if (!result.manageToken) return html(c, services, 'Your signup · Hope Volunteer', <SwitchAlreadyPage />);
c.header('Cache-Control', 'no-store');
return c.redirect(appPath(services.config, `/m/${result.manageToken}?notice=switched`), 303);
} catch (err) {
@@ -404,7 +405,7 @@ function switchedAlready(c: Context, services: SignupServices, token: string, bo
if (!formToken.ok) return missingManage(c, services);
const shiftId = confirmedOperationShift(services.db, formToken.claims.operationId);
if (shiftId === null) return missingManage(c, services);
return html(c, services.config, 'Your signup · Hope Volunteer', <SwitchAlreadyPage />);
return html(c, services, 'Your signup · Hope Volunteer', <SwitchAlreadyPage />);
}
function switchForm(services: SignupServices, token: string, signup: { status: 'confirmed' | 'cancelled'; shiftId: number; eventId: number; name: string; email: string }): SwitchForm | null {
@@ -471,15 +472,16 @@ function cancelForm(services: SignupServices, token: string, status: 'confirmed'
function html(
c: Context,
config: AppConfig,
services: SignupServices,
title: string,
body: Child,
status: 200 | 400 | 403 | 404 | 409 | 429 | 503 = 200,
turnstile = false,
) {
c.header('Cache-Control', 'no-store');
const account = readSession(services.db, c.req.header('cookie'), services.now());
return c.html(
<Layout config={config} title={title} path={c.req.path} turnstile={turnstile}>
<Layout config={services.config} title={title} path={c.req.path} turnstile={turnstile} account={account ? { csrf: account.csrf } : null}>
{body}
</Layout>,
status,
+20 -14
View File
@@ -45,20 +45,28 @@ describe('public pages', () => {
expect(html).toContain('aria-current="date"');
expect(html).toContain('In progress');
expect(html).not.toContain('Volunteer tools');
const header = html.slice(html.indexOf('class="site-header"'), html.indexOf('<main'));
expect(header).toContain('Coordinator');
expect(header).toContain('>Privacy</a>');
expect(header).toContain('href="/" aria-current="page">Calendar</a>');
const header = html.slice(html.indexOf('class="header"'), html.indexOf('<main'));
expect(header).toContain('class="main-nav-link" href="/" aria-current="page">Volunteering</a>');
expect(header).not.toContain('href="/privacy" aria-current="page"');
expect(header).toContain('href="https://hopefoodpantrysc.org/"');
expect(header).toContain('href="https://hopefoodpantrysc.org/about"');
expect(header).toContain('href="https://hopefoodpantrysc.org/faq"');
expect(header).toContain('href="https://hopefoodpantrysc.org/#contact"');
expect(header).toContain('https://donorbox.org/hope-food-pantry-1');
expect(header).not.toContain('Coordinator');
expect(header).not.toContain('>Privacy</a>');
expect(header).not.toContain('Calendar');
expect(header).not.toContain('Log out');
const nav = html.slice(html.indexOf('class="nav-links"'), html.indexOf('</nav>'));
const nav = html.slice(html.indexOf('class="nav-links"'), html.indexOf('</ul>'));
expect(nav).toContain('Donate');
expect(nav).not.toContain('Coordinator');
expect(nav).not.toContain('Privacy');
expect(nav).not.toContain('Log out');
const footer = html.slice(html.indexOf('site-footer'));
expect(footer).toContain('Privacy');
const footer = html.slice(html.indexOf('class="footer"'));
expect(footer).toContain('equal opportunity provider');
expect(footer).toContain('Cosmically Creative');
expect(footer).toContain('712\u2011540\u20119351');
expect(footer).toContain('class="main-nav-link" href="/" aria-current="page">Volunteering</a>');
expect(footer).not.toContain('Privacy');
expect(footer).not.toContain('Coordinator');
expect(html).not.toContain('Cancelled Distribution');
expect(html).not.toContain('Past Setup');
@@ -99,7 +107,7 @@ describe('public pages', () => {
expect(shift.status).toBe(200);
expect(shiftHtml).toContain('Open Sorting');
expect(shiftHtml).not.toContain('class="crumb"');
const shiftMain = shiftHtml.slice(shiftHtml.indexOf('<main'), shiftHtml.indexOf('site-footer'));
const shiftMain = shiftHtml.slice(shiftHtml.indexOf('<main'), shiftHtml.indexOf('class="footer"'));
expect(shiftMain).not.toContain('Weekly pantry');
expect(shiftMain).not.toContain('sunburst');
expect(shiftHtml).toContain('1/3 spots filled');
@@ -144,7 +152,7 @@ describe('public pages', () => {
it('leaves the event name and sunburst off shift pages', async () => {
const { app, ids } = await buildApp();
const shiftHtml = await (await app.request(`/s/${ids.open}`)).text();
const shiftMain = shiftHtml.slice(shiftHtml.indexOf('<main'), shiftHtml.indexOf('site-footer'));
const shiftMain = shiftHtml.slice(shiftHtml.indexOf('<main'), shiftHtml.indexOf('class="footer"'));
expect(shiftMain).toContain('Open Sorting');
expect(shiftMain).not.toContain('class="crumb"');
expect(shiftMain).not.toContain('Weekly pantry');
@@ -159,10 +167,8 @@ describe('public pages', () => {
const privacy = await app.request('/privacy');
const privacyHtml = await privacy.text();
expect(privacy.status).toBe(200);
expect(privacyHtml).toContain('href="/">Calendar</a>');
expect(privacyHtml).toContain('class="main-nav-link" href="/">Volunteering</a>');
expect(privacyHtml).not.toContain('href="/" aria-current="page"');
expect(privacyHtml).toContain('href="/privacy" aria-current="page">Privacy</a>');
expect(privacyHtml).not.toContain('aria-current="page"');
expect(privacyHtml).toContain('does not have an approved privacy notice yet');
expect(privacyHtml).toContain('This page is not a privacy policy.');
expect(privacyHtml).not.toContain('24 months');
@@ -196,7 +202,7 @@ describe('public pages', () => {
expect(html).toContain('Weekly pantry');
expect(html).not.toContain('Upcoming shifts');
expect((await app.request('/volunteer/e/weekly-pantry')).status).toBe(200);
expect(html).toContain('href="/volunteer/privacy"');
expect(html).toContain('class="main-nav-link" href="/volunteer" aria-current="page">Volunteering</a>');
expect(html).toMatch(/href="\/volunteer\/s\/\d+"/);
const slash = await app.request('/volunteer/');
expect(slash.status).toBe(302);