Add a reusable event calendar and put it on the front page
EventCalendar shows events on a month grid or as a list of the month. Multi-day events are lane-packed bars that break at week edges, series events appear on every meeting with their time, and clicking a day lists everything on it. Phones get the list. Visitors can narrow by scope, type, online only and search, all starting at "all"; a page can pin section, host or type through props, which hides that control. Migration 019 rebuilds front_page_sections to allow a 'calendar' band and slots it in after the retreats carousel, so it can be reordered, retitled or hidden from the Front page editor. useEvents drops its empty fallback so a failed request surfaces as an error rather than an empty list, and returns the scope list alongside the events for the calendar's scope filter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
641ab167b0
commit
2e125b4629
10 changed files with 947 additions and 8 deletions
|
|
@ -948,13 +948,14 @@ const timeline = {
|
|||
the page. Photos and the livestream are editable whatever the
|
||||
mode, so either can be ready before the switch is flipped.
|
||||
|
||||
Section keys and stat sources are the CHECK lists in migration
|
||||
017. The labels here are what the admin reads; the values are
|
||||
Section keys and stat sources are the CHECK lists in migrations
|
||||
017 and 019. The labels here are what the admin reads; the values are
|
||||
what the page and the API key on. */
|
||||
|
||||
const FRONT_PAGE_SECTIONS = [
|
||||
["countdown", "Countdown to the next event"],
|
||||
["retreats", "National Retreats carousel"],
|
||||
["calendar", "Event calendar"],
|
||||
["stats", "Numbers"],
|
||||
["timeline", "Featured timeline"],
|
||||
["connect", "Find your way in"],
|
||||
|
|
|
|||
|
|
@ -171,6 +171,39 @@ export function upcomingOccurrences(
|
|||
return out
|
||||
}
|
||||
|
||||
/** Every meeting between two dates, inclusive, in order. For a
|
||||
* calendar page: `from` and `to` are the visible range. */
|
||||
export function occurrencesBetween(
|
||||
series: EventSeries | null | undefined,
|
||||
startsOn: string | null | undefined,
|
||||
endsOn: string | null | undefined,
|
||||
from: string,
|
||||
to: string,
|
||||
): string[] {
|
||||
if (!series) return []
|
||||
const out: string[] = []
|
||||
for (const date of occurrences(series, startsOn, endsOn)) {
|
||||
if (date > to) break
|
||||
if (date >= from) out.push(date)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
/** The first meeting on or after `from`, or null if the series has
|
||||
* ended by then. */
|
||||
export function firstOccurrenceFrom(
|
||||
series: EventSeries | null | undefined,
|
||||
startsOn: string | null | undefined,
|
||||
endsOn: string | null | undefined,
|
||||
from: string,
|
||||
): string | null {
|
||||
if (!series) return null
|
||||
for (const date of occurrences(series, startsOn, endsOn)) {
|
||||
if (date >= from) return date
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/* ── Words ───────────────────────────────────────────────────── */
|
||||
|
||||
const ORDINALS = ['', '1st', '2nd', '3rd', '4th', 'last']
|
||||
|
|
|
|||
|
|
@ -16,7 +16,13 @@ import type { EventSeries } from './eventSeries.ts'
|
|||
export type HeroMode = 'brand' | 'photos' | 'livestream'
|
||||
|
||||
/** The CHECK list on front_page_sections.section. */
|
||||
export type FrontPageSectionKey = 'countdown' | 'retreats' | 'stats' | 'timeline' | 'connect'
|
||||
export type FrontPageSectionKey =
|
||||
| 'countdown'
|
||||
| 'retreats'
|
||||
| 'calendar'
|
||||
| 'stats'
|
||||
| 'timeline'
|
||||
| 'connect'
|
||||
|
||||
export type HeroButton = { label: string; url: string }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue