"use client"; import type { RiskZone } from "@/types/nspd"; interface Props { riskZones: RiskZone[] | null | undefined; parcelAreaSqm?: number | null; } // Severity mapping: layer key suffix → severity tier function getSeverity(layer: string): "high" | "medium" | "low" { const key = layer.replace(/^risk_/, ""); if (key === "flooding" || key === "landslide") return "high"; if (key === "flooding_underground" || key === "burns") return "medium"; return "low"; } const SEVERITY_STYLES: Record< "high" | "medium" | "low", { bg: string; badgeBg: string; color: string; label: string } > = { high: { bg: "#fff1f2", badgeBg: "#fee2e2", color: "#991b1b", label: "ВЫСОКИЙ", }, medium: { bg: "#fffbeb", badgeBg: "#fef3c7", color: "#92400e", label: "СРЕДНИЙ", }, low: { bg: "#fff7ed", badgeBg: "#ffedd5", color: "#9a3412", label: "НИЗКИЙ", }, }; function formatArea(sqm: number | null): string | null { if (sqm === null) return null; if (sqm >= 10000) return `${(sqm / 10000).toFixed(2)} га`; return `${Math.round(sqm).toLocaleString("ru-RU")} м²`; } export function NspdRiskZonesBlock({ riskZones, parcelAreaSqm }: Props) { const zones = riskZones ?? []; if (zones.length === 0) { return (