From 3cb72d0a0f4057fbe3fdbd70bc8183ab51a0f6d2 Mon Sep 17 00:00:00 2001
From: Tudor
Date: Wed, 15 Jul 2026 07:29:24 +0100
Subject: [PATCH] fix(compare): remove the year-by-year data table from Explore
trends
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The mockup's Explore trends section is the measure picker + chart only —
no data table. Removes the table (and the now-unused progressBand / band
chip / formatMetricValue plumbing that only fed it).
Co-Authored-By: Claude Fable 5
Claude-Session: https://claude.ai/code/session_0146VHeLAWjDVE2B5uU67jCB
---
.../compare/TrendsExplorer.module.css | 31 --------
.../components/compare/TrendsExplorer.tsx | 77 ++-----------------
2 files changed, 5 insertions(+), 103 deletions(-)
diff --git a/nextjs-app/components/compare/TrendsExplorer.module.css b/nextjs-app/components/compare/TrendsExplorer.module.css
index 61f17fa..7c74367 100644
--- a/nextjs-app/components/compare/TrendsExplorer.module.css
+++ b/nextjs-app/components/compare/TrendsExplorer.module.css
@@ -75,34 +75,3 @@
height: 360px;
}
}
-
-.tableWrapper {
- overflow-x: auto;
- margin-top: 1.5rem;
-}
-
-.table {
- width: 100%;
- border-collapse: collapse;
- font-size: 0.9rem;
-}
-
-.table th,
-.table td {
- text-align: left;
- padding: 0.6rem 0.75rem;
- border-bottom: 1px solid var(--border-light);
-}
-
-.table th {
- background: var(--bg-secondary);
- font-size: 0.8rem;
- text-transform: uppercase;
- letter-spacing: 0.03em;
- color: var(--text-secondary);
-}
-
-.yearCell {
- font-weight: 600;
- white-space: nowrap;
-}
diff --git a/nextjs-app/components/compare/TrendsExplorer.tsx b/nextjs-app/components/compare/TrendsExplorer.tsx
index 6cd5a6e..0a5f83e 100644
--- a/nextjs-app/components/compare/TrendsExplorer.tsx
+++ b/nextjs-app/components/compare/TrendsExplorer.tsx
@@ -1,19 +1,17 @@
/**
* Explore trends — the full grouped metric catalogue (nothing from the old
- * compare page is lost; spec §4's tier 3) driving the year-by-year chart
- * with its England reference line, plus the year-by-year table. Progress
- * metrics carry CI-based bands for the years DfE published them.
+ * compare page is lost; spec §4's tier 3) driving the year-by-year chart with
+ * its England reference line. Matches the mockup: a measure picker and the
+ * chart only (no data table).
*/
'use client';
import dynamic from 'next/dynamic';
-import { progressBand } from '@/lib/compareLogic';
import type { ComparisonData, MetricDefinition, NationalAverages, School } from '@/lib/types';
-import { formatAcademicYear, formatMetricValue, metricKind } from '@/lib/utils';
import { track } from '@/lib/analytics';
-import { Chip, Section, sectionStyles as s } from './sectionShared';
+import { Section } from './sectionShared';
import styles from './TrendsExplorer.module.css';
const ComparisonChart = dynamic(
@@ -40,14 +38,6 @@ const SECONDARY_OPTGROUPS: { label: string; category: string }[] = [
export const PRIMARY_CATEGORIES = PRIMARY_OPTGROUPS.map((g) => g.category);
export const SECONDARY_CATEGORIES = SECONDARY_OPTGROUPS.map((g) => g.category);
-const PROGRESS_CI: Record = {
- reading_progress: ['reading_progress_lower_ci', 'reading_progress_upper_ci'],
- writing_progress: ['writing_progress_lower_ci', 'writing_progress_upper_ci'],
- maths_progress: ['maths_progress_lower_ci', 'maths_progress_upper_ci'],
-};
-
-const BAND_LABEL = { above: 'Above average', average: 'Average', below: 'Below average' } as const;
-
export function TrendsExplorer({
schools,
data,
@@ -78,21 +68,11 @@ export function TrendsExplorer({
nationalByYear[entry.year] = block?.[metric] ?? null;
}
- const years = [
- ...new Set(
- schools.flatMap(
- (school) => data[String(school.urn)]?.yearly_data.map((d) => Math.trunc(d.year)) ?? [],
- ),
- ),
- ].sort((a, b) => a - b);
-
const handleMetricChange = (next: string) => {
track('compare_metric_changed', { metric: next, phase: isPrimaryPhase ? 'primary' : 'secondary' });
onMetricChange(next);
};
- const ciKeys = PROGRESS_CI[metric];
-
return (
Progress scores measure pupils' progress from KS1 to KS2. A score of 0 equals the
- national average. DfE stopped publishing KS2 progress after 2022/23 (no KS1 baseline);
- bands use DfE's confidence intervals, not the raw score alone.
+ national average. DfE stopped publishing KS2 progress after 2022/23 (no KS1 baseline).
)}
@@ -142,52 +121,6 @@ export function TrendsExplorer({
nationalByYear={nationalByYear}
/>
-
- {years.length > 0 && (
-
-
-
-
- | Year |
- {schools.map((school) => (
- {school.school_name} |
- ))}
-
-
-
- {years.map((year) => (
-
- | {formatAcademicYear(year)} |
- {schools.map((school) => {
- const row = data[String(school.urn)]?.yearly_data.find(
- (d) => Math.trunc(d.year) === year,
- ) as (Record & { year: number }) | undefined;
- const value = row?.[metric];
- if (typeof value !== 'number') return – | ;
- const band = ciKeys
- ? progressBand(
- value,
- (row?.[ciKeys[0]] as number | null) ?? null,
- (row?.[ciKeys[1]] as number | null) ?? null,
- )
- : null;
- return (
-
- {formatMetricValue(value, metricKind(metric))}{' '}
- {band && (
-
- {BAND_LABEL[band]}
-
- )}
- |
- );
- })}
-
- ))}
-
-
-
- )}