- The timeline's ngu-tl classes and keyframes are site-tl; nguLogo is siteLogo; the event card's ngu grid area is org; window.__NGU_SITE__ is window.__SITE__; QR downloads are qr-<page>.png - Browser keys (theme, closed banner and privacy notice, chunk reload) start site-; the page's first script moves any old ngu- values over once, so nobody loses their theme or sees a closed notice again - Session and Google sign-in cookies are site_session and site_oauth (__Host- over https); everyone signs in again once Record ids, server paths, the service and the database file keep their names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2 KiB
TypeScript
69 lines
2 KiB
TypeScript
import { useState } from 'react'
|
||
import type { GroupedYear, SortDirection } from '../../../lib/timeline.ts'
|
||
import TimelineYear from './TimelineYear.tsx'
|
||
|
||
type Props = {
|
||
years: GroupedYear[]
|
||
count: number
|
||
direction?: SortDirection
|
||
openYears: Set<number>
|
||
onToggleYear: (year: number) => void
|
||
}
|
||
|
||
/**
|
||
* Scheduled but not yet happened. Sits above the most recent decade and
|
||
* opens upward: the toggle is first in the DOM and the list is rendered
|
||
* after it, with `flex-direction: column-reverse` flipping the visual
|
||
* order. That keeps the button anchored next to the decade marker
|
||
* instead of drifting up the page as items appear.
|
||
*
|
||
* Membership is decided by date, not by a flag, see partitionByDate.
|
||
* An event moves into the record on its own, with nothing to update.
|
||
*/
|
||
export default function TimelineUpcoming({
|
||
years,
|
||
count,
|
||
direction = 'desc',
|
||
openYears,
|
||
onToggleYear,
|
||
}: Props) {
|
||
const [open, setOpen] = useState(false)
|
||
if (count === 0) return null
|
||
|
||
return (
|
||
<section
|
||
className={`site-tl__upcoming${open ? ' site-tl__upcoming--open' : ''}`}
|
||
aria-label="Upcoming"
|
||
>
|
||
<button
|
||
type="button"
|
||
className="site-tl__upcomingBtn"
|
||
aria-expanded={open}
|
||
onClick={() => setOpen((v) => !v)}
|
||
>
|
||
<span className="site-tl__upcomingDot" aria-hidden="true" />
|
||
<span className="site-tl__upcomingLabel">
|
||
{open
|
||
? 'Hide what’s scheduled'
|
||
: `${count} ${count === 1 ? 'thing' : 'things'} still to come`}
|
||
</span>
|
||
<span className="site-tl__chevron" aria-hidden="true">
|
||
{open ? '▾' : '▴'}
|
||
</span>
|
||
</button>
|
||
|
||
{open ? (
|
||
<div className="site-tl__upcomingList">
|
||
{years.map((year) => (
|
||
<TimelineYear
|
||
key={year.year}
|
||
year={year}
|
||
open={openYears.has(year.year)}
|
||
onToggle={onToggleYear}
|
||
/>
|
||
))}
|
||
</div>
|
||
) : null}
|
||
</section>
|
||
)
|
||
}
|