Type src/ against API and database shapes, fixing implicit anys

Adds .d.ts declarations beside the untyped JS modules imported from
TS (api.js, navConfig.js, adminSchema.js, adminNav.js, src/data/*),
with shapes taken from the server routes and migrations. get/post/
patch/del now return unknown unless the caller names the response.

Fixes found along the way:
- website/email/instagram are bare strings from splitLinks, not Link
  objects; OrganizationDetail's website and email pills rendered with
  no href or label and now link correctly.
- The chapter map falls back to FALLBACK_COLOR for a region with no
  colour instead of painting its tiles black.

Adds defineSection() so each page manifest entry's props are checked
against its own Component.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-25 04:13:46 -05:00
parent 5286cae9ca
commit 2428f4412a
39 changed files with 1318 additions and 343 deletions

View file

@ -1,5 +1,5 @@
import PageShell from "../components/PageShell.tsx";
import { useSectionManifest } from "../lib/sections.tsx";
import { defineSection, useSectionManifest } from "../lib/sections.tsx";
import EventListCards, { EventCardsToggle } from "./sections/EventList-Cards.tsx";
/* ═══════════════════════════════════════════════════════════════
@ -35,10 +35,10 @@ const CARD_VIEWS = { options: ["carousel", "grid"], Toggle: EventCardsToggle };
/* Pinned on every band. Named rather than repeated so turning this
page into "everything, filtered" later is one deletion. */
const RETREATS = { type: "retreat" };
const RETREATS = { type: "retreat" } as const;
const SECTIONS = [
{
defineSection({
id: "national",
title: "National Retreats",
blurb: "Our flagship gatherings, open to young adults across the country.",
@ -47,8 +47,8 @@ const SECTIONS = [
Component: EventListCards,
props: { section: "national", ...RETREATS },
views: { ...CARD_VIEWS, default: "carousel" },
},
{
}),
defineSection({
id: "regional",
title: "Regional Retreats",
blurb: "Smaller gatherings hosted by regions throughout the year.",
@ -57,8 +57,8 @@ const SECTIONS = [
Component: EventListCards,
props: { section: "regional", ...RETREATS },
views: { ...CARD_VIEWS, default: "grid" },
},
{
}),
defineSection({
id: "partner",
title: "Partner Events",
blurb: "Retreats hosted by organizations we collaborate with.",
@ -67,13 +67,13 @@ const SECTIONS = [
Component: EventListCards,
props: { section: "partner", ...RETREATS },
views: { ...CARD_VIEWS, default: "grid" },
},
}),
/* The other three scopes, ready to uncomment. Each needs an accent
and a background of its own — those are presentation and live
here, not in event_sections.
{
defineSection({
id: "local",
title: "Local Events",
blurb: "Hosted by individual chapters.",
@ -82,8 +82,8 @@ const SECTIONS = [
Component: EventListCards,
props: { section: "local", ...RETREATS_ONLY },
views: { ...CARD_VIEWS, default: "grid" },
},
{
}),
defineSection({
id: "international",
title: "International Events",
blurb: "Gatherings beyond the US.",
@ -92,8 +92,8 @@ const SECTIONS = [
Component: EventListCards,
props: { section: "international", ...RETREATS_ONLY },
views: { ...CARD_VIEWS, default: "grid" },
},
{
}),
defineSection({
id: "other",
title: "Other Events",
blurb: "Everything that doesn't fit the categories above.",
@ -102,7 +102,7 @@ const SECTIONS = [
Component: EventListCards,
props: { section: "other", ...RETREATS_ONLY },
views: { ...CARD_VIEWS, default: "grid" },
},
}),
*/
];