/** * SecondarySchoolRow Component * Four-line row for secondary school search results * * Line 1: School name · Ofsted badge * Line 2: School type · Age range · Gender · Sixth form · Admissions tag * Line 3: Attainment 8 (large) · ±LA avg delta · Pupils * Line 4: LA name · distance */ 'use client'; import type { School } from '@/lib/types'; import { buildOfstedListBadge, getPhaseStyle, schoolUrl } from '@/lib/utils'; import styles from './SecondarySchoolRow.module.css'; function detectAdmissionsTag(school: School): string | null { const policy = school.admissions_policy?.toLowerCase() ?? ''; if (policy.includes('selective')) return 'Selective'; const denom = school.religious_denomination ?? ''; if (denom && denom !== 'Does not apply') return 'Faith priority'; return null; } function hasSixthForm(school: School): boolean { return school.age_range?.includes('18') ?? false; } interface SecondarySchoolRowProps { school: School; isLocationSearch?: boolean; isInCompare?: boolean; onAddToCompare?: (school: School) => void; onRemoveFromCompare?: (urn: number) => void; laAvgAttainment8?: number | null; } export function SecondarySchoolRow({ school, isLocationSearch, isInCompare = false, onAddToCompare, onRemoveFromCompare, laAvgAttainment8, }: SecondarySchoolRowProps) { const handleCompareClick = () => { if (isInCompare) { onRemoveFromCompare?.(school.urn); } else { onAddToCompare?.(school); } }; const ofstedBadge = buildOfstedListBadge(school); const phase = getPhaseStyle(school.phase); const att8 = school.attainment_8_score; const laDelta = att8 != null && laAvgAttainment8 != null ? att8 - laAvgAttainment8 : null; const admissionsTag = detectAdmissionsTag(school); const sixthForm = hasSixthForm(school); const showGender = school.gender && school.gender.toLowerCase() !== 'mixed'; return (