PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m5s
PR Checks / Backend Smoke (pull_request) Successful in 8s
PR Checks / Build Backend (no push) (pull_request) Successful in 13s
PR Checks / Build Frontend (no push) (pull_request) Successful in 45s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 11s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 1m59s
The admissions card measured 1503px on a live school page — half the height of every section put together, and nearly three times the next largest — with its default view rendering as four tiles adrift in about 1080px of blank card. The cause was a layout trick meeting content it was never sized for. The admissions views are stacked in one grid cell so switching them never shifts layout, and the hidden ones keep their box: only visibility is dropped. That works while the views are comparable. The distance view added in #102 carries a chart, a table and a map, came to 1402px against the tile grid's 316px, and pinned every other view to its height — including the one that renders by default, which nobody had clicked. Rather than only unpinning it, the detail moves out. Every other topic on the page is a section with a nav entry, and "how close did we need to live, and would we have got in?" is a topic, not a variant reading of the intake figures. The headline number stays on the Admissions tile where the intake story is; the record behind it now lives in a Distance section directly below. admissions 1503px -> 554px distance new -> 743px (median section on the page is ~528px) Three further changes, each of which also makes the content better rather than only shorter: * The map renders on request. Before a postcode is entered it is a circle drawn round a school, and it costs a Leaflet bundle and 240px to say so; a successful check opens it automatically, which is the point at which it starts answering something. Map height 320px -> 240px. * The chart appears only at the four published years that let the summary state a direction. Below that we already refuse to call the series a trend, and a line through three points asserts one regardless of what the sentence beneath it admits. The table carries those years anyway, with the reasons a line cannot show. * Three caveat paragraphs become one. They said walking-route twice and made the same point about priorities in two voices. It now sits in CutoffDistanceDetail rather than inside the check, so it still renders for a school with coordinates missing, where there is a table but no map and no check. The new e2e guard asserts no section exceeds 2.5x the median section height. Measuring the card's internals cannot catch this: the tile grid is flex: 1, so it absorbs the stretch and every box still looks full. The first version of this test targeted an arbitrary primary, passed against the live bug, and proved nothing; pointed at a school that actually holds cut-off history it fails on staging with "#admissions is 1459px against a 526px median". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDvkyqqHABm4bmth2kjAxE
76 lines
2.9 KiB
TypeScript
76 lines
2.9 KiB
TypeScript
/**
|
|
* CutoffDistanceDetail — the full year-by-year cut-off story.
|
|
*
|
|
* Chart, table, map and postcode check, in that order: the shape of the trend,
|
|
* then what happened in each year, then the same numbers over real streets,
|
|
* then the reader's own address measured against them.
|
|
*
|
|
* Shared by both templates because the content is identical, but placed
|
|
* differently by each. The primary page has a segmented control and gives this
|
|
* its own "Distance" tab; the secondary page is one flat panel by design, so it
|
|
* renders inline beneath the metric cards. Extracting it keeps the caveats and
|
|
* the ordering from drifting apart between the two.
|
|
*
|
|
* Server component — the map and postcode form are the only client parts, and
|
|
* they carry their own boundary.
|
|
*/
|
|
|
|
import type { School } from '@/lib/types';
|
|
import { sectionStyles as styles } from './sectionShared';
|
|
import { CutoffTrendChart } from './charts';
|
|
import { CutoffYearTable } from './CutoffYearTable';
|
|
import { CutoffMapPanel } from './CutoffMapPanel';
|
|
import {
|
|
cutoffTrendSummary, cutoffCoverageNote, CUTOFF_CHECK_CAVEAT,
|
|
type CutoffYearRow,
|
|
} from './lastDistanceOffered';
|
|
|
|
export function CutoffDistanceDetail({
|
|
rows,
|
|
schoolInfo,
|
|
}: {
|
|
rows: CutoffYearRow[];
|
|
schoolInfo: School;
|
|
}) {
|
|
const publishedYears = rows.filter((r) => r.status === 'published').length;
|
|
if (publishedYears < 2) return null;
|
|
|
|
const trendSummary = cutoffTrendSummary(rows);
|
|
const coverageNote = cutoffCoverageNote(rows);
|
|
/*
|
|
* The chart appears at the same four points that let cutoffTrendSummary
|
|
* state a direction. Below that we already refuse to call the series a
|
|
* trend, and drawing a trend line under that refusal contradicts it — three
|
|
* points joined by a line say "look, it is falling" whatever the sentence
|
|
* beneath admits. The table carries every one of those years anyway, with
|
|
* the reasons a line cannot show, so nothing is lost by leaving it out.
|
|
*/
|
|
const showChart = publishedYears >= 4;
|
|
|
|
return (
|
|
<>
|
|
{showChart && (
|
|
<>
|
|
<div className={styles.admissionsChartCap}>Last distance offered, by year</div>
|
|
<CutoffTrendChart rows={rows} />
|
|
<p className={styles.cutoffChartKey}>
|
|
Gaps are years with no published figure — the line is never drawn
|
|
across one. The table says what happened in each.
|
|
</p>
|
|
</>
|
|
)}
|
|
{trendSummary && <p className={styles.admissionsTrendSummary}>{trendSummary}</p>}
|
|
|
|
<CutoffYearTable rows={rows} />
|
|
{coverageNote && <p className={styles.cutoffChartKey}>{coverageNote}</p>}
|
|
|
|
<CutoffMapPanel schoolInfo={schoolInfo} rows={rows} />
|
|
|
|
{/* The single caveat for the whole section. It lives here rather than
|
|
inside the check, so it still renders for a school with no
|
|
coordinates — where there is a table but no map and no check. */}
|
|
<p className={styles.cutoffCheckCaveat}>{CUTOFF_CHECK_CAVEAT}</p>
|
|
</>
|
|
);
|
|
}
|