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:
@@ -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]}
|
|
||||||
{school.ofsted_date && (
|
|
||||||
<span className={styles.ofstedDate}>
|
|
||||||
{' '}({new Date(school.ofsted_date).getFullYear()})
|
|
||||||
</span>
|
</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 & 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}>
|
||||||
|
|||||||
Reference in New Issue
Block a user