feat(secondary): apply primary visual design to secondary school detail
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 2m17s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 55s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 13s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s

- GCSE top metrics (Att8, P8, Eng+Maths 4+/5+) promoted to heroStatCard
  teal-tinted cards with Playfair serif values and DeltaChip vs national
- Attainment 8 visual bar: 0–80 scale with coral national-average marker
  and pill label, mirrors the SatsChart concept for a score metric
- Progress 8 number line: −3 to +3 axis showing CI band, zero baseline,
  and a teal/coral dot for the school's score (hidden when P8 suspended)
- SEN section upgraded from plain metricCard to heroStatCard grid
- History table moved into a details/summary accordion (collapsed by
  default); PerformanceChart now lives at the top of the History section
  always visible above the disclosure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Tudor Sitaru
2026-04-15 09:21:21 +01:00
parent ac2d64caaf
commit 3327728df0
2 changed files with 385 additions and 82 deletions
@@ -802,6 +802,207 @@
color: var(--text-muted, #8a847a); color: var(--text-muted, #8a847a);
} }
/* ── GCSE hero stat cards (mirrors primary heroStatCard) ─ */
.heroStatGrid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 0.85rem;
margin-bottom: 0.25rem;
}
.heroStatCard {
background: rgba(45, 125, 125, 0.1);
border: 1px solid rgba(45, 125, 125, 0.2);
border-radius: 12px;
padding: 1rem 1.1rem;
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.heroStatCard .heroStatLabel {
font-size: 0.6rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-muted, #6d685f);
}
.heroStatCard .heroStatValue {
font-family: var(--font-playfair), 'Playfair Display', serif;
font-size: 2.1rem;
font-weight: 700;
line-height: 1;
color: var(--accent-teal, #2d7d7d);
display: flex;
align-items: baseline;
gap: 0.4rem;
flex-wrap: wrap;
}
.heroStatCard .heroStatHint {
font-size: 0.7rem;
color: var(--text-muted, #6d685f);
font-style: normal;
margin-top: 0;
}
/* ── Attainment 8 visual bar ─────────────────────────── */
.att8Viz {
margin: 1.25rem 0 0.5rem;
}
.att8VizLabel {
font-size: 0.6875rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.07em;
color: var(--text-muted, #6d685f);
margin-bottom: 0.5rem;
}
.att8VizTrack {
position: relative;
height: 14px;
background: rgba(45, 125, 125, 0.08);
border: 1px solid var(--border-color, #e5dfd5);
border-radius: 4px;
overflow: visible;
}
.att8VizFill {
height: 100%;
background: var(--accent-teal, #2d7d7d);
border-radius: 4px 0 0 4px;
transition: width 0.6s ease;
}
.att8VizNatLine {
position: absolute;
top: -4px;
bottom: -4px;
width: 2px;
background: var(--accent-coral, #e07256);
border-radius: 2px;
z-index: 2;
}
.att8VizNatPill {
position: absolute;
top: -20px;
transform: translateX(-50%);
background: var(--accent-coral, #e07256);
color: #fff;
font-size: 0.6rem;
font-weight: 700;
padding: 0.1rem 0.3rem;
border-radius: 3px;
white-space: nowrap;
}
.att8VizTicks {
display: flex;
justify-content: space-between;
margin-top: 0.25rem;
font-size: 0.6rem;
color: var(--text-muted, #6d685f);
}
/* ── Progress 8 number line ──────────────────────────── */
.p8Viz {
margin: 1.25rem 0 0.5rem;
}
.p8VizLabel {
font-size: 0.6875rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.07em;
color: var(--text-muted, #6d685f);
margin-bottom: 0.5rem;
}
.p8VizTrack {
position: relative;
height: 14px;
background: rgba(45, 125, 125, 0.06);
border: 1px solid var(--border-color, #e5dfd5);
border-radius: 4px;
overflow: visible;
}
.p8VizCi {
position: absolute;
top: 0;
bottom: 0;
background: rgba(45, 125, 125, 0.18);
border-radius: 3px;
}
.p8VizZero {
position: absolute;
top: -4px;
bottom: -4px;
width: 2px;
background: var(--border-color, #e5dfd5);
z-index: 1;
}
.p8VizDot {
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
width: 12px;
height: 12px;
border-radius: 50%;
background: var(--accent-teal, #2d7d7d);
border: 2px solid white;
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
z-index: 3;
}
.p8VizDotNeg {
background: var(--accent-coral, #e07256);
}
.p8VizTicks {
display: flex;
justify-content: space-between;
margin-top: 0.25rem;
font-size: 0.6rem;
color: var(--text-muted, #6d685f);
}
/* ── History accordion ───────────────────────────────── */
.historyDisclosure {
margin-top: 1rem;
}
.historyToggle {
list-style: none;
cursor: pointer;
font-size: 0.8125rem;
font-weight: 600;
color: var(--text-muted, #6d685f);
padding: 0.5rem 0;
display: flex;
align-items: center;
gap: 0.375rem;
user-select: none;
}
.historyToggle::-webkit-details-marker { display: none; }
.historyToggle::before {
content: '▶';
font-size: 0.6rem;
transition: transform 0.2s ease;
}
.historyDisclosure[open] .historyToggle::before {
transform: rotate(90deg);
}
/* ── Responsive ──────────────────────────────────────── */ /* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) { @media (max-width: 768px) {
.header { .header {
@@ -848,6 +1049,14 @@
font-size: 1rem; font-size: 1rem;
} }
.heroStatGrid {
grid-template-columns: 1fr;
}
.heroStatCard .heroStatValue {
font-size: 1.85rem;
}
.chartContainer { .chartContainer {
height: 220px; height: 220px;
} }
@@ -494,61 +494,153 @@ export function SecondarySchoolDetailView({
</div> </div>
)} )}
<div className={styles.metricsGrid}> {/* Hero stat cards — top GCSE metrics */}
<div className={styles.heroStatGrid}>
{latestResults.attainment_8_score != null && ( {latestResults.attainment_8_score != null && (
<div className={styles.metricCard}> <div className={styles.heroStatCard}>
<div className={styles.metricLabel}> <div className={styles.heroStatLabel}>
Attainment 8 Attainment 8 score
<MetricTooltip metricKey="attainment_8_score" /> <MetricTooltip metricKey="attainment_8_score" />
</div> </div>
<div className={styles.metricValue}>{latestResults.attainment_8_score.toFixed(1)}</div> <div className={styles.heroStatValue}>
{latestResults.attainment_8_score.toFixed(1)}
{secondaryAvg.attainment_8_score != null && (
<DeltaChip
value={latestResults.attainment_8_score}
baseline={secondaryAvg.attainment_8_score}
unit="pts"
size="sm"
/>
)}
</div>
{secondaryAvg.attainment_8_score != null && ( {secondaryAvg.attainment_8_score != null && (
<div className={styles.metricHint}>National avg: {secondaryAvg.attainment_8_score.toFixed(1)}</div> <div className={styles.heroStatHint}>National avg: {secondaryAvg.attainment_8_score.toFixed(1)}</div>
)} )}
</div> </div>
)} )}
{latestResults.progress_8_score != null && ( {latestResults.progress_8_score != null && (
<div className={styles.metricCard}> <div className={styles.heroStatCard}>
<div className={styles.metricLabel}> <div className={styles.heroStatLabel}>
Progress 8 Progress 8 score
<MetricTooltip metricKey="progress_8_score" /> <MetricTooltip metricKey="progress_8_score" />
</div> </div>
<div className={`${styles.metricValue} ${progressClass(latestResults.progress_8_score, styles)}`}> <div className={`${styles.heroStatValue} ${progressClass(latestResults.progress_8_score, styles)}`}>
{formatProgress(latestResults.progress_8_score)} {formatProgress(latestResults.progress_8_score)}
</div> </div>
{(latestResults.progress_8_lower_ci != null || latestResults.progress_8_upper_ci != null) && ( {(latestResults.progress_8_lower_ci != null && latestResults.progress_8_upper_ci != null) ? (
<div className={styles.metricHint}> <div className={styles.heroStatHint}>
CI: {latestResults.progress_8_lower_ci?.toFixed(2) ?? '?'} to {latestResults.progress_8_upper_ci?.toFixed(2) ?? '?'} CI: {latestResults.progress_8_lower_ci.toFixed(2)} to {latestResults.progress_8_upper_ci.toFixed(2)}
</div> </div>
)} ) : (
</div> <div className={styles.heroStatHint}>National baseline: 0.0</div>
)}
{latestResults.english_maths_standard_pass_pct != null && (
<div className={styles.metricCard}>
<div className={styles.metricLabel}>
English &amp; Maths Grade 4+
<MetricTooltip metricKey="english_maths_standard_pass_pct" />
</div>
<div className={styles.metricValue}>{formatPercentage(latestResults.english_maths_standard_pass_pct)}</div>
{secondaryAvg.english_maths_standard_pass_pct != null && (
<div className={styles.metricHint}>National avg: {secondaryAvg.english_maths_standard_pass_pct.toFixed(0)}%</div>
)} )}
</div> </div>
)} )}
{latestResults.english_maths_strong_pass_pct != null && ( {latestResults.english_maths_strong_pass_pct != null && (
<div className={styles.metricCard}> <div className={styles.heroStatCard}>
<div className={styles.metricLabel}> <div className={styles.heroStatLabel}>
English &amp; Maths Grade 5+ English &amp; Maths Grade 5+
<MetricTooltip metricKey="english_maths_strong_pass_pct" /> <MetricTooltip metricKey="english_maths_strong_pass_pct" />
</div> </div>
<div className={styles.metricValue}>{formatPercentage(latestResults.english_maths_strong_pass_pct)}</div> <div className={styles.heroStatValue}>
{formatPercentage(latestResults.english_maths_strong_pass_pct)}
{secondaryAvg.english_maths_strong_pass_pct != null && (
<DeltaChip
value={latestResults.english_maths_strong_pass_pct}
baseline={secondaryAvg.english_maths_strong_pass_pct}
unit="pts"
size="sm"
/>
)}
</div>
{secondaryAvg.english_maths_strong_pass_pct != null && ( {secondaryAvg.english_maths_strong_pass_pct != null && (
<div className={styles.metricHint}>National avg: {secondaryAvg.english_maths_strong_pass_pct.toFixed(0)}%</div> <div className={styles.heroStatHint}>National avg: {secondaryAvg.english_maths_strong_pass_pct.toFixed(0)}%</div>
)}
</div>
)}
{latestResults.english_maths_standard_pass_pct != null && (
<div className={styles.heroStatCard}>
<div className={styles.heroStatLabel}>
English &amp; Maths Grade 4+
<MetricTooltip metricKey="english_maths_standard_pass_pct" />
</div>
<div className={styles.heroStatValue}>
{formatPercentage(latestResults.english_maths_standard_pass_pct)}
{secondaryAvg.english_maths_standard_pass_pct != null && (
<DeltaChip
value={latestResults.english_maths_standard_pass_pct}
baseline={secondaryAvg.english_maths_standard_pass_pct}
unit="pts"
size="sm"
/>
)}
</div>
{secondaryAvg.english_maths_standard_pass_pct != null && (
<div className={styles.heroStatHint}>National avg: {secondaryAvg.english_maths_standard_pass_pct.toFixed(0)}%</div>
)} )}
</div> </div>
)} )}
</div> </div>
{/* Attainment 8 visual bar (080 scale) */}
{latestResults.attainment_8_score != null && (
<div className={styles.att8Viz}>
<div className={styles.att8VizLabel}>Attainment 8 school vs national</div>
<div className={styles.att8VizTrack}>
<div
className={styles.att8VizFill}
style={{ width: `${Math.min((latestResults.attainment_8_score / 80) * 100, 100)}%` }}
/>
{secondaryAvg.attainment_8_score != null && (
<div
className={styles.att8VizNatLine}
style={{ left: `${(secondaryAvg.attainment_8_score / 80) * 100}%` }}
>
<div className={styles.att8VizNatPill}>
Nat avg {secondaryAvg.attainment_8_score.toFixed(1)}
</div>
</div>
)}
</div>
<div className={styles.att8VizTicks}>
<span>0</span><span>20</span><span>40</span><span>60</span><span>80</span>
</div>
</div>
)}
{/* Progress 8 number line with CI */}
{latestResults.progress_8_score != null && !p8Suspended && (
<div className={styles.p8Viz}>
<div className={styles.p8VizLabel}>Progress 8 relative to national baseline (0)</div>
{(() => {
const p8 = latestResults.progress_8_score!;
const lo = latestResults.progress_8_lower_ci ?? p8;
const hi = latestResults.progress_8_upper_ci ?? p8;
const range = 6; // 3 to +3
const toX = (v: number) => `${Math.min(Math.max(((v + 3) / range) * 100, 0), 100)}%`;
return (
<div className={styles.p8VizTrack}>
{/* CI band */}
<div
className={styles.p8VizCi}
style={{ left: toX(lo), width: `calc(${toX(hi)} - ${toX(lo)})` }}
/>
{/* Zero line */}
<div className={styles.p8VizZero} style={{ left: toX(0) }} />
{/* Score dot */}
<div
className={`${styles.p8VizDot} ${p8 < 0 ? styles.p8VizDotNeg : ''}`}
style={{ left: toX(p8) }}
/>
</div>
);
})()}
<div className={styles.p8VizTicks}>
<span>3</span><span>2</span><span>1</span><span>0</span><span>+1</span><span>+2</span><span>+3</span>
</div>
</div>
)}
{/* Progress 8 component breakdown */} {/* Progress 8 component breakdown */}
{(latestResults.progress_8_english != null || latestResults.progress_8_maths != null || {(latestResults.progress_8_english != null || latestResults.progress_8_maths != null ||
latestResults.progress_8_ebacc != null || latestResults.progress_8_open != null) && ( latestResults.progress_8_ebacc != null || latestResults.progress_8_open != null) && (
@@ -608,21 +700,6 @@ export function SecondarySchoolDetailView({
</> </>
)} )}
{/* Performance chart */}
{yearlyData.length > 0 && (
<>
<h3 className={styles.subSectionTitle} style={{ marginTop: '1.25rem' }}>Results Over Time</h3>
<div className={styles.chartContainer}>
<PerformanceChart
data={yearlyData}
schoolName={schoolInfo.school_name}
isSecondary={true}
nationalAtt8Avg={heroAtt8Nat}
nationalByYear={nationalAvg?.by_year}
/>
</div>
</>
)}
</section> </section>
)} )}
@@ -695,33 +772,33 @@ export function SecondarySchoolDetailView({
{(latestResults?.sen_support_pct != null || latestResults?.sen_ehcp_pct != null) && ( {(latestResults?.sen_support_pct != null || latestResults?.sen_ehcp_pct != null) && (
<> <>
<h3 className={styles.subSectionTitle}>Special Educational Needs (SEN)</h3> <h3 className={styles.subSectionTitle}>Special Educational Needs (SEN)</h3>
<div className={styles.metricsGrid}> <div className={styles.heroStatGrid}>
{latestResults?.sen_support_pct != null && ( {latestResults?.sen_support_pct != null && (
<div className={styles.metricCard}> <div className={styles.heroStatCard}>
<div className={styles.metricLabel}> <div className={styles.heroStatLabel}>
Pupils receiving SEN support SEN support
<MetricTooltip metricKey="sen_support_pct" /> <MetricTooltip metricKey="sen_support_pct" />
</div> </div>
<div className={styles.metricValue}>{formatPercentage(latestResults.sen_support_pct)}</div> <div className={styles.heroStatValue}>{formatPercentage(latestResults.sen_support_pct)}</div>
<div className={styles.metricHint}>SEN support without an EHCP</div> <div className={styles.heroStatHint}>Without an EHCP</div>
</div> </div>
)} )}
{latestResults?.sen_ehcp_pct != null && ( {latestResults?.sen_ehcp_pct != null && (
<div className={styles.metricCard}> <div className={styles.heroStatCard}>
<div className={styles.metricLabel}> <div className={styles.heroStatLabel}>
Pupils with an EHCP Pupils with EHCP
<MetricTooltip metricKey="sen_ehcp_pct" /> <MetricTooltip metricKey="sen_ehcp_pct" />
</div> </div>
<div className={styles.metricValue}>{formatPercentage(latestResults.sen_ehcp_pct)}</div> <div className={styles.heroStatValue}>{formatPercentage(latestResults.sen_ehcp_pct)}</div>
<div className={styles.metricHint}>Education, Health and Care Plan</div> <div className={styles.heroStatHint}>Education, Health and Care Plan</div>
</div> </div>
)} )}
{(schoolInfo.total_pupils != null || latestResults?.total_pupils != null) && ( {(schoolInfo.total_pupils != null || latestResults?.total_pupils != null) && (
<div className={styles.metricCard}> <div className={styles.heroStatCard}>
<div className={styles.metricLabel}>Total pupils</div> <div className={styles.heroStatLabel}>Total pupils</div>
<div className={styles.metricValue}>{(schoolInfo.total_pupils ?? latestResults!.total_pupils!).toLocaleString()}</div> <div className={styles.heroStatValue}>{(schoolInfo.total_pupils ?? latestResults!.total_pupils!).toLocaleString()}</div>
{schoolInfo.capacity != null && ( {schoolInfo.capacity != null && (
<div className={styles.metricHint}>Capacity: {schoolInfo.capacity}</div> <div className={styles.heroStatHint}>Capacity: {schoolInfo.capacity}</div>
)} )}
</div> </div>
)} )}
@@ -808,30 +885,47 @@ export function SecondarySchoolDetailView({
{yearlyData.length > 1 && ( {yearlyData.length > 1 && (
<section id="history" className={styles.card}> <section id="history" className={styles.card}>
<h2 className={styles.sectionTitle}>Historical Results</h2> <h2 className={styles.sectionTitle}>Historical Results</h2>
<div className={styles.tableWrapper}> {yearlyData.length > 0 && (
<table className={styles.dataTable}> <>
<thead> <h3 className={styles.subSectionTitle} style={{ marginTop: '1.25rem' }}>Results Over Time</h3>
<tr> <div className={styles.chartContainer}>
<th>Year</th> <PerformanceChart
<th>Attainment 8</th> data={yearlyData}
<th>Progress 8</th> schoolName={schoolInfo.school_name}
<th>Eng &amp; Maths 4+</th> isSecondary={true}
<th>EBacc entry %</th> nationalAtt8Avg={heroAtt8Nat}
</tr> nationalByYear={nationalAvg?.by_year}
</thead> />
<tbody> </div>
{yearlyData.map((result) => ( </>
<tr key={result.year}> )}
<td className={styles.yearCell}>{formatAcademicYear(result.year)}</td> <details className={styles.historyDisclosure}>
<td>{result.attainment_8_score != null ? result.attainment_8_score.toFixed(1) : '-'}</td> <summary className={styles.historyToggle}>View raw year-by-year data</summary>
<td>{result.progress_8_score != null ? formatProgress(result.progress_8_score) : '-'}</td> <div className={styles.tableWrapper}>
<td>{result.english_maths_standard_pass_pct != null ? formatPercentage(result.english_maths_standard_pass_pct) : '-'}</td> <table className={styles.dataTable}>
<td>{result.ebacc_entry_pct != null ? formatPercentage(result.ebacc_entry_pct) : '-'}</td> <thead>
<tr>
<th>Year</th>
<th>Attainment 8</th>
<th>Progress 8</th>
<th>Eng &amp; Maths 4+</th>
<th>EBacc entry %</th>
</tr> </tr>
))} </thead>
</tbody> <tbody>
</table> {yearlyData.map((result) => (
</div> <tr key={result.year}>
<td className={styles.yearCell}>{formatAcademicYear(result.year)}</td>
<td>{result.attainment_8_score != null ? result.attainment_8_score.toFixed(1) : '-'}</td>
<td>{result.progress_8_score != null ? formatProgress(result.progress_8_score) : '-'}</td>
<td>{result.english_maths_standard_pass_pct != null ? formatPercentage(result.english_maths_standard_pass_pct) : '-'}</td>
<td>{result.ebacc_entry_pct != null ? formatPercentage(result.ebacc_entry_pct) : '-'}</td>
</tr>
))}
</tbody>
</table>
</div>
</details>
</section> </section>
)} )}
</div> </div>