"use client"; import Link from "next/link"; import { useCompare } from "@/lib/favorites"; import { useCards } from "../favoris/favorites-view"; import { fmtPrice, fmtArea, fmtInt, fmtPct, fmtDate } from "@/lib/format"; import { CATEGORY_LABEL } from "@/lib/normalize"; import { Empty } from "@/components/ui"; import { IconClose } from "@/components/icons"; export function CompareView() { const cmp = useCompare(); const cards = useCards(cmp.items); if (cmp.items.length < 1) return

Comparateur

; const rows: [string, (c: (typeof cards)[number]) => string][] = [ ["Prix demandé", (c) => fmtPrice(c.price, { rent: c.market === "rent" })], ["Type", (c) => c.typeLabel ?? CATEGORY_LABEL[c.category]], ["Chambres", (c) => fmtInt(c.bedrooms)], ["Salles de bain", (c) => fmtInt(c.bathrooms)], ["Superficie", (c) => fmtArea(c.areaSqft)], ["Prix au pi²", (c) => c.price && c.areaSqft ? `${fmtInt(c.price / c.areaSqft)} $/pi²` : "—"], ["Estimation", (c) => c.estimate ? fmtPrice(c.estimate, { rent: c.market === "rent" }) : "—"], ["Estimation vs prix", (c) => c.ratio ? fmtPct(c.ratio - 1) : "—"], ["Confiance", (c) => c.confidence ?? "—"], ["En ligne depuis", (c) => fmtDate(c.firstSeen)], ["Source", (c) => c.connector.replace(/_/g, " ")], ]; return (

Comparateur

{cards.map((c) => )}{rows.map(([k, f]) => {cards.map((c) => )})}
Critère
{c.image && }
{c.address ?? "Annonce"}{c.city}
{k}{f(c)}

Les estimations sont statistiques et indicatives ; comparez aussi les annonces d'origine.

); }