diff --git a/README.md b/README.md index 951a244..73ab642 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ npm run seed `npm run dev` serves the site on `127.0.0.1` at `BASE_URL` (from `.env`, `http://127.0.0.1:3000`). It is loopback only. Stop it with Ctrl+C. -Open `/` for the weekly pantry sign-up page. **View** starts on **List**: a card for each Wednesday in the next three months, split into that day's shifts. Each shift lists the names of the people who are signed up. A shift that has already ended stays on that day's card, grayed out, until midnight in the event's time zone. At midnight the day leaves the list. Emails, phone numbers, and notes stay off the page. **Calendar** is the other choice in that menu, at `/?view=calendar`, and it stops at that same three-month date. A shift later than that date is left off both views, and the signup form does not take a reservation for it. Shifts on other weekdays stay on the calendar. `/e/weekly-pantry` is the same seeded event. `/privacy` is the unapproved privacy notice. `/healthz` returns `{"ok":true,"database":"ok"}` and nothing else. A shift shows how many spots are filled, such as 3/5 spots filled. A shift with space left uses a soft green label. A full shift uses a soft red label. +Open `/` for the weekly pantry sign-up page. **View** starts on **List**: a card for each day with a shift in the next three months, split into that day's shifts. Each shift lists the names of the people who are signed up. A shift that has already ended stays on that day's card, grayed out, until midnight in the event's time zone. At midnight the day leaves the list. Emails, phone numbers, and notes stay off the page. **Calendar** is the other choice in that menu, at `/?view=calendar`, and it stops at that same three-month date. A shift later than that date is left off both views, and the signup form does not take a reservation for it. `/e/weekly-pantry` is the same seeded event. `/privacy` is the unapproved privacy notice. `/healthz` returns `{"ok":true,"database":"ok"}` and nothing else. A shift shows how many spots are filled, such as 3/5 spots filled. A shift with space left uses a soft green label. A full shift uses a soft red label. An open shift has a signup form. It asks for one person. Another person can use the same email and takes another spot. The same person cannot take a second spot. The form needs JavaScript because of the Turnstile check. Wait a few seconds after the page loads before submitting. The confirmation page shows a private link and says a confirmation email is on the way. That page works without JavaScript. Cancel this signup there to open the spot again. A cancellation email is queued, and a confirmation that has not been sent yet is dropped. That person can sign up again once the cancellation is saved. Someone else can use the email while the first signup is still confirmed. A cancelled signup stays on that private page until the link expires. A private link controls only that signup. Use the separate link for each signup. diff --git a/src/pages.tsx b/src/pages.tsx index cb3d041..e9bab00 100644 --- a/src/pages.tsx +++ b/src/pages.tsx @@ -1,7 +1,7 @@ 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 { 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'; @@ -590,7 +590,7 @@ function PublicSchedule(props: { {calendarView ? ( ) : ( - + )} @@ -613,16 +613,16 @@ function SignupDialog(props: { config: AppConfig }) { ); } -type WednesdayGroup = { +type DayGroup = { date: string; heading: string; + weekdayLabel: string; shifts: PublicShift[]; }; -function wednesdayGroups(shifts: PublicShift[]): WednesdayGroup[] { - const groups: WednesdayGroup[] = []; +function dayGroups(shifts: PublicShift[]): DayGroup[] { + const groups: DayGroup[] = []; for (const shift of shifts) { - if (shift.when.weekday !== WEDNESDAY) continue; const last = groups.at(-1); if (last && last.date === shift.when.date) { last.shifts.push(shift); @@ -631,6 +631,7 @@ function wednesdayGroups(shifts: PublicShift[]): WednesdayGroup[] { groups.push({ date: shift.when.date, heading: comma === -1 ? shift.when.dateLabel : shift.when.dateLabel.slice(comma + 2), + weekdayLabel: shift.when.weekdayLabel, shifts: [shift], }); } @@ -638,11 +639,11 @@ function wednesdayGroups(shifts: PublicShift[]): WednesdayGroup[] { return groups; } -function WednesdayBoard(props: { config: AppConfig; event: PublicEvent; now: string }) { +function DayBoard(props: { config: AppConfig; event: PublicEvent; now: string }) { const today = calendarToday(props.event.timeZone, props.now); - const days = wednesdayGroups(props.event.shifts); + const days = dayGroups(props.event.shifts); if (days.length === 0) { - return

No Wednesday shifts are posted. The calendar lists shifts on other days.

; + return

No upcoming shifts are posted.

; } return (
    @@ -650,7 +651,7 @@ function WednesdayBoard(props: { config: AppConfig; event: PublicEvent; now: str
  1. -

    Wednesday

    +

    {day.weekdayLabel}

    diff --git a/src/schedule.ts b/src/schedule.ts index 5948e70..3f2790b 100644 --- a/src/schedule.ts +++ b/src/schedule.ts @@ -3,9 +3,7 @@ import type Database from 'better-sqlite3'; import { isWithinSignupWindow } from './signup-window.js'; import { formatInstantInZone, localToUtc, todayInZone } from './time.js'; -/** Weekday 0 is Sunday, matching the zoned clock. The public sign-up cards use Wednesday. */ -export const WEDNESDAY = 3; - +/** Weekday 0 is Sunday, matching the zoned clock. */ const WEEKDAY_LABELS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] as const; export type PublicShift = { diff --git a/tests/public-pages.test.ts b/tests/public-pages.test.ts index 59c9531..7c7977a 100644 --- a/tests/public-pages.test.ts +++ b/tests/public-pages.test.ts @@ -47,12 +47,14 @@ describe('public pages', () => { expect(html).toContain('No one signed up yet.'); expect(html).toContain('class="day-card"'); expect(html).toContain('class="shift-pane"'); - expect(html.match(/class="day-card"/g)).toHaveLength(2); - expect(html.match(/
    Thursday'); + expect(html).toContain('class="day-card-dow">Friday'); + expect(html).toContain('Open Sorting'); + expect(html).toContain('Full Intake'); expect(html).toContain('Today'); expect(html).toContain('aria-current="date"'); expect(html).toContain('In progress'); @@ -84,7 +86,7 @@ describe('public pages', () => { expect(html).toContain('Past Setup'); expect(html).not.toContain(`href="/s/${ids.past}"`); expect(html).not.toContain('Hidden draft'); - expect(html).not.toContain('Secret Person'); + expect(html).toContain('Secret Person'); expect(html).not.toContain('secret.person@example.invalid'); expect(html).not.toContain('lane.wednesday@example.invalid'); expect(html).not.toContain('SECRET-PERSON-NOTE'); @@ -299,7 +301,7 @@ describe('public pages', () => { expect(await health.json()).toEqual({ ok: true, database: 'ok' }); }); - it('shows Wednesday cards by default and one calendar month at a time', async () => { + it('shows every shift in the list and one calendar month at a time', async () => { const { app, db } = await buildApp(); const event = db.prepare(`SELECT id AS id FROM events WHERE slug = 'weekly-pantry'`).get() as { id: number }; insertShift(db, event.id, 'November Sorting', '2026-11-04', '09:00', '12:00', 4, 0); @@ -310,8 +312,8 @@ describe('public pages', () => { expect(html).toContain('Wednesday Sorting'); expect(html).toContain('November Sorting'); expect(html).toContain('December Sorting'); - expect(html).not.toContain('Edge Sorting'); - expect(html).not.toContain('Open Sorting'); + expect(html).toContain('Edge Sorting'); + expect(html).toContain('Open Sorting'); expect(html).not.toContain('shift-calendar'); expect(html).not.toContain('Next month'); expect(home).toContain('href="/?view=calendar"'); @@ -385,7 +387,7 @@ describe('public pages', () => { expect(cards).toContain('Window Person'); expect(cards).not.toContain('window.person@example.invalid'); expect(cards).not.toContain('WINDOW-NOTE'); - expect(cards).not.toContain('Deadline Sorting'); + expect(cards).toContain('Deadline Sorting'); expect(cards).not.toContain('Later Sorting'); expect(cards).not.toContain('Spring Sorting'); expect(cards).toContain('Sign-up is open through January 14, 2027.');