import type { ObjectQuartirographyRow } from "@/types/analytics"; function fmtPrice(v: number | null): string { if (v === null) return "—"; return ( (v / 1_000_000).toLocaleString("ru-RU", { minimumFractionDigits: 1, maximumFractionDigits: 1, }) + " млн" ); } function fmtArea(v: number | null): string { if (v === null) return "—"; return v.toLocaleString("ru-RU", { maximumFractionDigits: 1 }) + " м²"; } export function ObjectQuartirographyTable({ rows, }: { rows: ObjectQuartirographyRow[]; }) { if (rows.length === 0) { return (

Данные квартирографии отсутствуют.

); } const headers = ["Тип", "Всего", "В продаже", "Площадь", "Цена (от–до)"]; return (
{headers.map((h) => ( ))} {rows.map((r) => ( ))}
{h}
{r.room_label} {r.total_count.toLocaleString("ru-RU")} {r.free_count > 0 ? ( {r.free_count.toLocaleString("ru-RU")} ) : ( 0 )} {r.area_min !== null || r.area_max !== null ? `${fmtArea(r.area_min)} – ${fmtArea(r.area_max)}` : "—"} {r.price_min !== null || r.price_max !== null ? `${fmtPrice(r.price_min)} – ${fmtPrice(r.price_max)}` : "—"}
); }