From 49ac96b4876a0330d3c1b7c12e3530a7fa7faa12 Mon Sep 17 00:00:00 2001 From: Tudor Date: Fri, 2 Oct 2026 14:27:53 +0100 Subject: [PATCH] refactor(search): drop the applied-filter row above the results The row repeated the search, local authority and school type above the results list, and nothing else: no phase, distance, gender, sixth form, admissions or faith. The filter bar already shows every one of them, in its selects and More filters count on desktop and as removable chips on phones, so the row was a partial second copy. Co-Authored-By: Claude Opus 5.5 --- .../components/ResultsToolbar.test.tsx | 11 +++---- nextjs-app/components/HomeView.module.css | 31 ------------------- nextjs-app/components/HomeView.tsx | 13 -------- 3 files changed, 5 insertions(+), 50 deletions(-) diff --git a/nextjs-app/__tests__/components/ResultsToolbar.test.tsx b/nextjs-app/__tests__/components/ResultsToolbar.test.tsx index a4d62b6..105b9d7 100644 --- a/nextjs-app/__tests__/components/ResultsToolbar.test.tsx +++ b/nextjs-app/__tests__/components/ResultsToolbar.test.tsx @@ -167,12 +167,11 @@ describe('the folded search', () => { }); }); -describe('the results list filter chips', () => { - it('name a school type group by its label, not its key', () => { - params = new URLSearchParams('search=southmead&school_type=council'); +describe('the results list', () => { + it('repeats no applied filters above the results; the filter bar shows them', () => { + params = new URLSearchParams('search=southmead&school_type=council&local_authority=Wandsworth'); const { container } = render(); - const chips = container.querySelector('[class*="activeFilters"]')!; - expect(chips).toHaveTextContent('State school: council-run'); - expect(chips).not.toHaveTextContent(/\bcouncil\b(?!-run)/); + expect(container.querySelector('[class*="activeFilters"]')).toBeNull(); + expect(screen.queryByText('Search: southmead')).not.toBeInTheDocument(); }); }); diff --git a/nextjs-app/components/HomeView.module.css b/nextjs-app/components/HomeView.module.css index 75ce66d..06a7bb0 100644 --- a/nextjs-app/components/HomeView.module.css +++ b/nextjs-app/components/HomeView.module.css @@ -1533,37 +1533,6 @@ cursor: pointer; } -.activeFilters { - display: flex; - flex-wrap: wrap; - gap: 0.5rem; - margin-bottom: 1rem; -} - -.filterChip { - display: inline-flex; - align-items: center; - gap: 0.375rem; - padding: 0.25rem 0.625rem; - background: var(--bg-secondary); - border: 1px solid var(--border); - border-radius: 999px; - font-size: 0.8rem; - color: var(--text-secondary); -} - -.chipRemove { - color: var(--text-muted); - text-decoration: none; - font-size: 0.9rem; - line-height: 1; - transition: color var(--transition, 0.2s ease); -} - -.chipRemove:hover { - color: var(--text-primary); -} - .loadMoreSection { display: flex; flex-direction: column; diff --git a/nextjs-app/components/HomeView.tsx b/nextjs-app/components/HomeView.tsx index dbe45e3..2f46f8a 100644 --- a/nextjs-app/components/HomeView.tsx +++ b/nextjs-app/components/HomeView.tsx @@ -292,11 +292,6 @@ export function HomeView({ initialSchools, filters, totalSchools, howItWorks, ed const hasSearch = searchParams.get('search') || searchParams.get('postcode'); const isLocationSearch = !!searchParams.get('postcode'); const isSearchActive = !!(hasSearch || searchParams.get('local_authority') || searchParams.get('school_type')); - // The URL carries a type group's key; the chip reads its label. An old link's - // raw GIAS type reads as itself. - const schoolTypeParam = searchParams.get('school_type'); - const schoolTypeChip = (schoolTypeParam && filters.school_type_groups?.find( - (o) => o.value.toLowerCase() === schoolTypeParam.toLowerCase())?.label) || schoolTypeParam; const currentPhase = searchParams.get('phase') || ''; const secondaryCount = allSchools.filter(s => s.attainment_8_score != null).length; const primaryCount = allSchools.filter(s => s.rwm_expected_pct != null).length; @@ -812,14 +807,6 @@ export function HomeView({ initialSchools, filters, totalSchools, howItWorks, ed {hasSearch && !isMapView && resultsHeader} - {isSearchActive && !isMapView && ( -
- {searchParams.get('search') && Search: {searchParams.get('search')} { e.preventDefault(); }}>×} - {searchParams.get('local_authority') && {searchParams.get('local_authority')}} - {schoolTypeParam && {schoolTypeChip}} -
- )} - {initialSchools.schools.length === 0 && isSearchActive ? (