"use client"; import type { GeometrySuitability, GeometrySuitabilityBaseLabel, } from "@/types/site-finder"; interface Props { data: GeometrySuitability; } const LABEL_COLOR: Record< GeometrySuitabilityBaseLabel, { bg: string; fg: string; border: string } > = { подходящий: { bg: "#dcfce7", fg: "#15803d", border: "#86efac" }, "сложная форма": { bg: "#fef9c3", fg: "#a16207", border: "#fde68a" }, "слабо подходит": { bg: "#fee2e2", fg: "#b91c1c", border: "#fca5a5" }, микро: { bg: "#fee2e2", fg: "#b91c1c", border: "#fca5a5" }, }; // label может быть combo "микро, узкий" — берём первую часть как ключ для цвета. function colorForLabel(label: string | undefined) { if (!label) return LABEL_COLOR["сложная форма"]; const base = label.split(",")[0].trim() as GeometrySuitabilityBaseLabel; return LABEL_COLOR[base] ?? LABEL_COLOR["сложная форма"]; } function fmtArea(ha: number | undefined, m2: number | undefined): string { if (ha !== undefined && ha >= 0.1) { return `${ha.toFixed(2)} га`; } if (m2 !== undefined) { return `${m2.toLocaleString("ru-RU")} м²`; } return "—"; } export function GeometrySuitabilityBlock({ data }: Props) { if (!data.data_available) { return (