'use client'; /** * CutoffMapPanel — "Where the last place went". * * The rings and the postcode check live in one component because they are one * question asked twice: the map answers "how far is that?" and the form answers * "how far are we?". Entering a postcode drops a pin on the same rings rather * than producing a separate verdict somewhere else on the page. * * The postcode never leaves the browser except to postcodes.io for a lat/long, * and nothing is stored — this is a client-side measurement, not a lookup * against the family. */ import { useState, useMemo, type FormEvent } from 'react'; import dynamic from 'next/dynamic'; import type { School } from '@/lib/types'; import { geocodePostcode, calculateDistance } from '@/lib/api'; import { isValidPostcode } from '@/lib/utils'; import { compareToCutoffs, CUTOFF_CHECK_CAVEAT, CUTOFF_MAP_CAVEAT, type CutoffYearRow, type CutoffCheckResult, type CutoffVerdict, } from './lastDistanceOffered'; import type { CutoffRing } from '../LeafletCutoffMapInner'; import styles from './schoolSections.module.css'; const CutoffMap = dynamic(() => import('../LeafletCutoffMapInner'), { ssr: false, loading: () =>