import { RotateCw, AlertTriangle } from 'lucide-react' import { useTranslation } from '../../i18n' import { Tooltip } from '../shared/Tooltip' import { POI_CATEGORIES } from './poiCategories' interface Props { active: Set onToggle: (key: string) => void loadingKeys?: Set /** categories whose last fetch failed → show a retry affordance */ errorKeys?: Set /** true when the map moved since the last search → offer "search this area" */ moved?: boolean onSearchArea?: () => void } // Frosted, icon-only segmented control that floats over the map. Active segments // fill with the category colour (matching their markers); the label shows in a // custom tooltip on hover so the pill stays compact and never needs to scroll. export default function PoiCategoryPill({ active, onToggle, loadingKeys, errorKeys, moved, onSearchArea }: Props) { const { t } = useTranslation() const anyError = !!errorKeys && Array.from(active).some(k => errorKeys.has(k)) const frosted: React.CSSProperties = { background: 'var(--sidebar-bg)', backdropFilter: 'blur(20px) saturate(180%)', WebkitBackdropFilter: 'blur(20px) saturate(180%)', boxShadow: 'var(--sidebar-shadow, 0 4px 16px rgba(0,0,0,0.14))', } return (
{POI_CATEGORIES.map(cat => { const on = active.has(cat.key) const loading = loadingKeys?.has(cat.key) return ( ) })}
{(moved || anyError) && active.size > 0 && ( )}
) }