feat(list): remove eng&maths stat, use buildOfstedListBadge in SecondarySchoolRow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tudor Sitaru
2026-04-13 14:08:16 +01:00
parent 44fdcfa18b
commit 58f8eae997
+5 -27
View File
@@ -11,16 +11,9 @@
'use client'; 'use client';
import type { School } from '@/lib/types'; import type { School } from '@/lib/types';
import { getPhaseStyle, schoolUrl } from '@/lib/utils'; import { buildOfstedListBadge, getPhaseStyle, schoolUrl } from '@/lib/utils';
import styles from './SecondarySchoolRow.module.css'; import styles from './SecondarySchoolRow.module.css';
const OFSTED_LABELS: Record<number, string> = {
1: 'Outstanding',
2: 'Good',
3: 'Req. Improvement',
4: 'Inadequate',
};
function detectAdmissionsTag(school: School): string | null { function detectAdmissionsTag(school: School): string | null {
const policy = school.admissions_policy?.toLowerCase() ?? ''; const policy = school.admissions_policy?.toLowerCase() ?? '';
if (policy.includes('selective')) return 'Selective'; if (policy.includes('selective')) return 'Selective';
@@ -58,6 +51,7 @@ export function SecondarySchoolRow({
} }
}; };
const ofstedBadge = buildOfstedListBadge(school);
const phase = getPhaseStyle(school.phase); const phase = getPhaseStyle(school.phase);
const att8 = school.attainment_8_score ?? null; const att8 = school.attainment_8_score ?? null;
const laDelta = const laDelta =
@@ -77,16 +71,9 @@ export function SecondarySchoolRow({
<a href={schoolUrl(school.urn, school.school_name)} className={styles.schoolName}> <a href={schoolUrl(school.urn, school.school_name)} className={styles.schoolName}>
{school.school_name} {school.school_name}
</a> </a>
{school.ofsted_grade && ( <span className={`${styles.ofstedBadge} ${styles[ofstedBadge.cssClass]}`}>
<span className={`${styles.ofstedBadge} ${styles[`ofsted${school.ofsted_grade}`]}`}> {ofstedBadge.label}
{OFSTED_LABELS[school.ofsted_grade]} </span>
{school.ofsted_date && (
<span className={styles.ofstedDate}>
{' '}({new Date(school.ofsted_date).getFullYear()})
</span>
)}
</span>
)}
</div> </div>
{/* Line 2: Context tags */} {/* Line 2: Context tags */}
@@ -126,15 +113,6 @@ export function SecondarySchoolRow({
</span> </span>
)} )}
{school.english_maths_standard_pass_pct != null && (
<span className={styles.stat}>
<strong className={styles.statValue}>
{school.english_maths_standard_pass_pct.toFixed(0)}%
</strong>
<span className={styles.statLabel}>Eng &amp; Maths 4+</span>
</span>
)}
{school.total_pupils != null && ( {school.total_pupils != null && (
<span className={styles.stat}> <span className={styles.stat}>
<strong className={styles.statValue}> <strong className={styles.statValue}>