PageBackdrop draws flat, overlapping palette circles behind the public site and eases them to a new tone as each section reaches the middle of the window, so sections no longer paint their own bands (PageShell's background field is gone). The hero's brand backdrop is a flat teal with the dove, its two buttons one cell cut by a slash, and the countdown straddles the hero and the band below. No glows: the drifting blobs, rings, live-dot pulse and the stats band's blurred circle are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
97 lines
3.1 KiB
TypeScript
97 lines
3.1 KiB
TypeScript
/* ═══════════════════════════════════════════════════════════════
|
||
PAGE STATE
|
||
|
||
The three ways a detail page can fail to be a detail page. All
|
||
four of them need the same thing, and it should be the same thing:
|
||
a visitor who hits a dead retreat link and a dead group link
|
||
shouldn't get two different pages.
|
||
|
||
Rendered inside PageShell so the chrome doesn't flicker in and
|
||
out between loading and loaded.
|
||
|
||
A 404 gets no retry button: the slug doesn't exist and trying
|
||
again won't change that. Anything else does, because a dropped
|
||
connection is the usual cause and one tap fixes it.
|
||
═══════════════════════════════════════════════════════════════ */
|
||
|
||
import { Link } from 'react-router-dom'
|
||
import PageShell from './PageShell.tsx'
|
||
import { accentText, BRAND } from '../lib/color.ts'
|
||
|
||
const BODY = 'var(--color-muted)'
|
||
|
||
export default function PageState({
|
||
loading,
|
||
error,
|
||
notFound,
|
||
onRetry,
|
||
noun,
|
||
backTo,
|
||
backLabel,
|
||
}: {
|
||
loading: boolean
|
||
error: string | null
|
||
notFound: boolean
|
||
onRetry: () => void
|
||
/** Lowercase, as it appears mid-sentence: "retreat", "group". */
|
||
noun: string
|
||
backTo: string
|
||
backLabel: string
|
||
}) {
|
||
let title: string
|
||
let content: React.ReactNode
|
||
|
||
if (notFound) {
|
||
title = 'Not found'
|
||
content = (
|
||
<div className="max-w-6xl mx-auto px-6">
|
||
<p style={{ color: BODY }}>
|
||
There’s no {noun} at this address. It may have been renamed, or taken
|
||
down.
|
||
</p>
|
||
<Link
|
||
to={backTo}
|
||
className="mt-4 inline-block btn border px-4 py-1.5 text-sm transition-colors hover:bg-tint"
|
||
style={{ borderColor: BRAND, color: accentText(BRAND) }}
|
||
>
|
||
{backLabel}
|
||
</Link>
|
||
</div>
|
||
)
|
||
} else if (error) {
|
||
title = 'Something went wrong'
|
||
content = (
|
||
<div className="max-w-6xl mx-auto px-6">
|
||
<p className="text-danger">Couldn’t load this {noun}. {error}</p>
|
||
<button
|
||
type="button"
|
||
onClick={onRetry}
|
||
className="mt-3 btn border px-4 py-1.5 text-sm transition-colors hover:bg-tint"
|
||
style={{ borderColor: BRAND, color: accentText(BRAND) }}
|
||
>
|
||
Try again
|
||
</button>
|
||
</div>
|
||
)
|
||
} else {
|
||
title = 'Loading…'
|
||
content = (
|
||
<div className="max-w-6xl mx-auto px-6" role="status">
|
||
<span className="sr-only">Loading this {noun}…</span>
|
||
<div aria-hidden="true" className="space-y-4">
|
||
<div className="skeleton !min-h-0 h-8 w-2/3" />
|
||
<div className="skeleton !min-h-0 h-4 w-full" />
|
||
<div className="skeleton !min-h-0 h-4 w-5/6" />
|
||
<div className="skeleton !min-h-0 mt-8 aspect-video w-full max-w-3xl" />
|
||
</div>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
return (
|
||
<PageShell
|
||
title={title}
|
||
sections={[{ id: 'status', title: '', accent: BRAND, content }]}
|
||
/>
|
||
)
|
||
}
|