import type { Child } from 'hono/jsx'; import type { AppConfig } from './config.js'; import { WEEKDAY_SHORT, calendarMonth, calendarToday, chooseCalendarMonth, monthStep, type CalendarDay } from './calendar.js'; import { WEDNESDAY, spotsSentence, type PublicEvent, type PublicShift } from './schedule.js'; import { SIGNUP_TOO_EARLY, signupDeadlineLabel } from './signup-window.js'; import { partyChoiceLabel, partyChoices, type SignupErrors, type SignupValues } from './signup-form.js'; import type { MoveTarget } from './admin/store.js'; import { ShiftTargetOptions } from './shift-options.js'; import type { ManageView } from './signup.js'; import { assetHref } from './static-assets.js'; import { appPath } from './url.js'; const PANTRY_SITE = 'https://hopefoodpantrysc.org'; function asset(config: AppConfig, file: string): string { return assetHref(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; path?: string; turnstile?: boolean; account?: { csrf: string } | null; children?: Child; }) { const home = appPath(props.config, '/'); 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'); const facebook = asset(props.config, '/img/icons/facebook.svg'); const instagram = asset(props.config, '/img/icons/instagram.svg'); const wave = asset(props.config, '/img/wave-secondary.svg'); return ( {props.title}