NGU-Web/src/pages/History.tsx
Zaldimmar 048c7599ce Fix dark mode and bring the public design in line with the taste audit
- Dark mode: the countdown card, timeline section, Giving text, error
  text, the Leadership button, skeletons and the admin's dark text all
  follow the tokens; logos get a light plate in dark mode
- One BRAND accent (the button token, so the admin palette reaches
  every page) and one ACCENTS family in color.ts, replacing 20 local
  teal constants and the purple, ochre and rust section colours;
  neon green and gold become mint and brand green
- Shadows are tinted with the site's ink; glow shadows are gone
- One giving label, Give, in the nav, footer and Giving page
- Phosphor icons replace the hand-drawn SVGs and the glyph icons;
  Pathfinder paths pick a named icon (emoji still shown) and lose the
  watermark
- Home keeps two eyebrows; StatsBand's title is a real heading;
  section headings step down under the page title
- Nav links switch to the menu below lg, so they never wrap; jump
  links land clear of the header; press feedback on buttons
- Empty sections say what's coming and who to ask; loading is a
  skeleton; form placeholders and borders are readable; one
  corner-radius rule; theme-color for both modes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:54:03 -05:00

88 lines
2.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import PageShell from "../components/PageShell.tsx";
import { sitePage } from "../lib/site.ts";
import HistoryTimeline from "./sections/history/HistoryTimeline.tsx";
import { HISTORY_DECADES } from "../data/historyDecades.ts";
import { useHistory } from "../lib/useHistory.ts";
import { BRAND } from "../lib/color.ts"
/* Title and intro: site.json, which also gives the search metadata. */
const PAGE = sitePage("/history");
/**
* Year the program starts. Decades ending before this render with the
* pre-program treatment, so the gap moves if the founding date is ever
* corrected, no hardcoded 2000 anywhere in the components.
*/
const PROGRAM_START_YEAR = 2000;
const BACKGROUND = "var(--color-surface)";
export default function History() {
const { items, loading, error, reload } = useHistory();
// Section renders `content` outside its own max-width wrapper, so the
// container lives here. The custom properties bind the timeline to
// this section's accent and background, --tl-surface must match
// `background` or the rail will show through the year dots.
const wrap = (children: React.ReactNode) => (
<div
className="max-w-6xl mx-auto px-6"
style={{ "--tl-accent": BRAND, "--tl-surface": BACKGROUND } as React.CSSProperties}
>
{children}
</div>
);
let content: React.ReactNode;
if (loading) {
content = wrap(
<p className="py-12 text-muted" role="status">
Loading the timeline…
</p>,
);
} else if (error) {
// Say what failed and offer the one action that might fix it.
// A history page that silently renders nothing looks like an
// organization with no history.
content = wrap(
<div className="py-12">
<p className="text-danger">Couldn’t load the timeline. {error}</p>
<button
type="button"
onClick={reload}
className="mt-3 rounded-full border border-brand px-4 py-1.5 text-sm font-medium text-link transition-colors hover:bg-tint"
>
Try again
</button>
</div>,
);
} else {
content = wrap(
<HistoryTimeline
items={items}
decades={HISTORY_DECADES}
direction="desc"
programStartYear={PROGRAM_START_YEAR}
/>,
);
}
return (
<PageShell
title={PAGE.title}
intro={PAGE.description}
sections={[
{
id: "timeline",
title: "NGU Timeline",
blurb:
"Open a year to see what happened.",
accent: BRAND,
background: BACKGROUND,
content,
},
]}
/>
);
}