/** * CutoffYearTable — the last distance offered, year by year. * * The table is where the chart's gaps get explained. Each year says which of * the three things happened, in words, because "no figure" alone is the least * useful thing we could tell a parent about a year. * * Server component: it is static markup over data the page already holds. */ import type { CutoffYearRow, CutoffYearStatus } from './lastDistanceOffered'; import { sectionStyles as styles } from './sectionShared'; const STATUS_LABEL: Record = { published: 'Oversubscribed', // Precisely what the EES field supports, and no more: first preferences did // not exceed places. It does not establish that every applicant was offered // a place, so it must not be worded as though it did. 'not-oversubscribed': 'Places available on first preferences', 'not-published': 'Not published', }; const STATUS_CLASS: Record = { published: styles.cutoffPillOver, 'not-oversubscribed': styles.cutoffPillOk, 'not-published': styles.cutoffPillNa, }; const DISTANCE_TEXT: Record = { published: '', 'not-oversubscribed': 'No cut-off needed', 'not-published': '—', }; export function CutoffYearTable({ rows }: { rows: CutoffYearRow[] }) { if (rows.length === 0) return null; const showPlaces = rows.some((r) => r.placesOffered != null); return (
{showPlaces && } {rows.map((r, i) => ( {showPlaces && ( )} ))}
Last distance offered by year, with the reason where no figure was published
Year Last distancePlacesStatus
{r.year} {r.status === 'published' ? r.figure : DISTANCE_TEXT[r.status]} {r.status === 'published' && (r.routeCount ?? 1) > 1 && ( {' '}furthest of {r.routeCount} )} {r.placesOffered ?? '—'} {STATUS_LABEL[r.status]}
); }