/** * SecondaryAdmissionsSection — secondary pages. * * Not shared with the primary AdmissionsSection: the two were only 14% * similar. This one has no year/trend toggle, so it ships no client * JavaScript at all. Server component. */ import type { School, SchoolAdmissions, SchoolAdmissionDistance } from '@/lib/types'; import { formatPercentage, hasReligiousCharacter, isSelective } from '@/lib/utils'; import { Section, sectionStyles as styles } from './sectionShared'; import { describeCutoff, describeCutoffAbsence, CUTOFF_NOTE, CUTOFF_MEASUREMENT_NOTE, } from './lastDistanceOffered'; export function SecondaryAdmissionsSection({ admissions, admissionsHistory, admissionDistance, schoolInfo, }: { /* Nullable for the same reason as the primary section: a school can have a published cut-off and no EES admissions row. */ admissions: SchoolAdmissions | null; admissionsHistory: SchoolAdmissions[]; admissionDistance: SchoolAdmissionDistance | null | undefined; schoolInfo: School; }) { const cutoff = describeCutoff(admissionDistance); /* Absent means cut-offs are not being published at all; null means this school has no published cut-off. Only the second is a fact about the school, and only the second can be stated. Saying "X has not published a cut-off" while the feature is dark describes us, and is false wherever the authority does publish one. */ const featureOn = admissionDistance !== undefined; // Moved with this section from SecondarySchoolDetailView, its only consumer. const admissionsTag = (() => { if (isSelective(schoolInfo.admissions_policy)) return 'Selective'; if (hasReligiousCharacter(schoolInfo.religious_denomination)) return 'Faith priority'; return null; })(); return (

Admissions

{admissionsTag && (
{admissionsTag}:{' '} {admissionsTag === 'Selective' ? 'entry to this school is by selective examination (e.g. 11+).' : `this school has a faith-based admissions priority (${schoolInfo.religious_denomination}).`}
)}
{admissions?.places_offered != null && (
Year 7 places offered
{admissions.places_offered}
)} {admissions?.total_applications != null && (
Total applications
{admissions.total_applications.toLocaleString()}
)} {admissions?.first_preference_applications != null && (
1st preference applications
{admissions.first_preference_applications.toLocaleString()}
)} {admissions?.first_preference_offer_pct != null && (
Families who got their first choice
{formatPercentage(admissions.first_preference_offer_pct)}
)} {cutoff && (
Last distance offered · {cutoff.entryYear}
{cutoff.primary}{' '} {cutoff.secondary}
)}
{admissions?.oversubscribed != null && (
{admissions.oversubscribed ? '⚠ Applications exceeded places last year' : '✓ Places were available last year'}
)} {/* Replaces a blanket "distance cut-off data is not available for this school", which was hardcoded onto every secondary page and was untrue wherever the local authority does publish. The absence is now stated only when it is real, and names the authority that would hold it. */} {cutoff ? (

{CUTOFF_NOTE} {CUTOFF_MEASUREMENT_NOTE} {cutoff.routeNote && <> {cutoff.routeNote}}

) : featureOn ? (

{describeCutoffAbsence({ localAuthority: schoolInfo.local_authority, admissionsPolicy: schoolInfo.admissions_policy, admissionsHistory, })}

) : null}
); }