'use client'; import { useRouter } from 'next/navigation'; import { t } from '@/i18n'; import { routes } from '@/lib/site'; import { TOPICS } from '@/lib/topics'; import { Segmented } from '@/components/controls/indicator-select'; const WINDOWS = ['1', '5', '10', '25', 'since1990'] as const; /** Window · topic · population toggle — every change navigates (server re-renders the facets). */ export function ExtremesControls({ window, topic, all }: { window: string; topic: string | null; all: boolean }) { const router = useRouter(); const go = (patch: { window?: string; topic?: string | null; all?: boolean }) => { const w = patch.window ?? window; const tp = patch.topic === undefined ? topic : patch.topic; const a = patch.all ?? all; const p = new URLSearchParams(); if (w !== '10') p.set('window', w); if (tp) p.set('topic', tp); if (a) p.set('all', '1'); const s = p.toString(); router.replace(`${routes.extremes()}${s ? `?${s}` : ''}`, { scroll: false }); }; return (