Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : Vrai-Prix8 * File : src/components/ResultView.tsx9 * Module : components10 * Repository : https://git.spboucher.ai/vrai-prix11 * Created : 2026-08-0912 * Last Modified : 2026-09-0813 *14 * Author : Simon-Pierre Boucher15 * Position : Professor of Finance16 * Institution : Université du Québec en Outaouais (UQO)17 * Organization : SP Boucher18 * Website : https://spboucher.ai19 * Git : https://git.spboucher.ai20 *21 * Preferred Contact: contact@spboucher.ai22 * Development : dev@spboucher.ai23 * Support : support@spboucher.ai24 * Security/Admin : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142/**43 * ResultView — le « rapport de valeur » : l'écran central du produit.44 * Composition éditoriale v2 : masthead de rapport, estimation en très grands45 * chiffres, sections numérotées à filets (registre, calcul, marché, historique,46 * comparables), zéro carte — la hiérarchie vient de la typographie et des filets.47 */48"use client";49import { useState } from "react";50import Link from "next/link";51import { useLang } from "./LangContext";52import LeadForm from "./LeadForm";53import RadarMap from "./RadarMap";54import FavButton from "./FavButton";55import {56 BuildingGlyph,57 ConfidenceDial,58 CountUp,59 EraLine,60 locNum,61 LotDiagram,62 MarketIndexChart,63 PercentileBar,64 RangeBar,65 ValueSplit,66} from "./MetricViz";67import type { EstimateResult } from "@/lib/engine";68import type { UnitEstimate } from "@/lib/estimator";69import type { TKey } from "@/lib/i18n";7071const fmt = (v: number | null | undefined, lang: string) =>72 v == null73 ? "—"74 : new Intl.NumberFormat(lang === "fr" ? "fr-CA" : "en-CA", {75 style: "currency",76 currency: "CAD",77 maximumFractionDigits: 0,78 }).format(v);7980const signed = (v: number, lang: string) =>81 `${v >= 0 ? "+" : "−"}${fmt(Math.abs(Math.round(v)), lang)}`;8283function Chip({ k, v }: { k: string; v: string | number }) {84 return (85 <div className="kv-cell">86 <p className="k">{k}</p>87 <p className="v break-words">{v}</p>88 </div>89 );90}9192/** En-tête de section du rapport : filet fort + numéro mono rouge. */93function Sect({ num, kicker, title }: { num: string; kicker: string; title: string }) {94 return (95 <header className="sec">96 <span className="sec-num">97 {num} — {kicker}98 </span>99 <h2 className="vp-display mt-2 text-[clamp(20px,3vw,28px)] font-bold uppercase leading-[1.05] tracking-[-0.025em]">100 {title}101 </h2>102 </header>103 );104}105106export default function ResultView({ data }: { data: UnitEstimate }) {107 const { lang, t } = useLang();108 const [activeComp, setActiveComp] = useState<string | null>(null);109 const r: EstimateResult = data.result;110 const u = data.unit;111 const ctx = data.context;112 const s = u?.specs;113 const fr = lang === "fr";114 const histMax = Math.max(...(u?.history.map((h) => h.value ?? 0) ?? [0]), 1);115 const moneyFmt = (v: number) =>116 new Intl.NumberFormat(fr ? "fr-CA" : "en-CA", {117 style: "currency",118 currency: "CAD",119 maximumFractionDigits: 0,120 }).format(Math.round(v / 100) * 100);121122 return (123 <div className="space-y-12 py-8">124 {/* ================= masthead du rapport ================= */}125 <section className="rise">126 <div className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 border-b-2 border-ink pb-2.5">127 <nav className="vp-mono flex min-w-0 flex-wrap items-center gap-2 text-[10.5px] uppercase tracking-[0.08em] text-ink-3">128 <Link href="/" className="text-ink-2 hover:text-accent-deep">129 Vrai-Prix130 </Link>131 <span aria-hidden="true">/</span>132 <span>{fr ? "Rapport de valeur" : "Value report"}</span>133 {u && (134 <>135 <span aria-hidden="true">/</span>136 <span className="truncate">{u.id}</span>137 </>138 )}139 </nav>140 {u && (141 <FavButton142 size="lg"143 item={{144 item_id: u.id,145 title: `${u.adresse ?? u.id}${s?.apt ? ` app. ${s.apt}` : ""}`,146 subtitle: u.municipalite ?? "",147 price_label: r.estimate > 0 ? moneyFmt(r.estimate) : "",148 url: `https://www.vrai-prix.com/estimation/${encodeURIComponent(u.id)}`,149 }}150 />151 )}152 </div>153154 <div className="mt-6 grid gap-x-12 gap-y-8 lg:grid-cols-[1.5fr_1fr]">155 {/* colonne principale : adresse + estimation en très grands chiffres */}156 <div className="min-w-0">157 {u && (158 <h1 className="vp-display text-[clamp(19px,2.6vw,26px)] font-bold uppercase leading-tight tracking-[-0.02em]">159 {u.adresse}160 {s?.apt ? ` app. ${s.apt}` : ""}161 {u.municipalite ? <span className="text-ink-3"> · {u.municipalite}</span> : null}162 </h1>163 )}164 <p className="klabel mt-5">{t("estimatedValue")}</p>165 <p className="vp-display mt-1 text-[clamp(52px,9vw,96px)] font-bold leading-none tracking-[-0.045em]">166 <CountUp value={r.estimate} format={moneyFmt} />167 </p>168 {/* faits rapides — ligne mono, pas de pastilles */}169 <p className="vp-mono mt-4 text-[11px] uppercase tracking-[0.06em] text-ink-2">170 {[171 u ? t(u.typeProp as TKey) : null,172 u?.aireEtagesM2 && r.estimate > 0173 ? `${locNum(Math.round(r.estimate / u.aireEtagesM2), lang, { maxFrac: 0 })} $/m²`174 : null,175 u?.aireEtagesM2 ? locNum(u.aireEtagesM2, lang, { unit: "m²" }) : null,176 u?.anneeConstruction ? `${fr ? "constr." : "built"} ${u.anneeConstruction}` : null,177 u?.superficieTerrainM2178 ? `${fr ? "terrain" : "lot"} ${locNum(u.superficieTerrainM2, lang, { unit: "m²" })}`179 : null,180 ]181 .filter((x): x is string => x != null)182 .join(" · ")}183 </p>184 {/* fourchette visuelle P10-P90 avec position du rôle */}185 <div className="mt-7 max-w-2xl">186 <p className="klabel mb-1">{t("range")}</p>187 <RangeBar188 low={r.low}189 estimate={r.estimate}190 high={r.high}191 role={u?.valeurRole ?? null}192 lang={lang}193 />194 </div>195 {u && (196 <div className="mt-7 flex flex-wrap gap-2.5">197 <a198 href={`/api/report?id=${encodeURIComponent(u.id)}`}199 className="btn btn-primary"200 download201 >202 {fr ? "Rapport PDF" : "PDF report"} ↓203 </a>204 <a205 href={`/api/report/pro?id=${encodeURIComponent(u.id)}`}206 className="btn btn-ghost"207 download208 title={fr ? "Structure de rapport d'évaluation — présentation bancaire" : "Appraisal-style structure — bank presentation"}209 >210 {fr ? "Format professionnel (banque)" : "Professional format (bank)"} ↓211 </a>212 </div>213 )}214 </div>215216 {/* colonne de lecture : confiance + rôle + écart, en cellules de données */}217 <aside className="lg:border-l lg:border-[var(--line)] lg:pl-10">218 <div className="flex items-start justify-between gap-6 lg:block">219 <ConfidenceDial220 pct={r.confidencePct}221 level={r.confidenceLevel}222 label={`${t("confidence")} — ${t(`conf${r.confidenceLevel}` as TKey)}`}223 />224 <dl className="grid flex-1 grid-cols-1 gap-x-6 sm:grid-cols-2 lg:mt-6 lg:grid-cols-1">225 {u?.valeurRole != null && (226 <div className="border-t border-[var(--line)] py-3">227 <dt className="klabel">{t("assessed")}</dt>228 <dd className="vp-display mt-0.5 text-[22px] font-bold tracking-[-0.02em] text-ink-2">229 {fmt(u.valeurRole, lang)}230 </dd>231 </div>232 )}233 {u?.valeurRole != null && u.valeurRole > 0 && r.estimate > 0 && (234 <div className="border-t border-[var(--line)] py-3">235 <dt className="klabel">{fr ? "Écart vs rôle" : "vs assessment"}</dt>236 <dd237 className={`vp-display mt-0.5 text-[22px] font-bold tracking-[-0.02em] ${238 r.estimate >= u.valeurRole ? "text-ink" : "text-[var(--danger)]"239 }`}240 >241 {r.estimate >= u.valeurRole ? "+" : ""}242 {((r.estimate / u.valeurRole - 1) * 100).toFixed(0)} %243 </dd>244 </div>245 )}246 </dl>247 </div>248 </aside>249 </div>250 <p className="vp-mono mt-7 border-t border-[var(--line)] pt-3 text-[10px] uppercase tracking-[0.05em] text-ink-3">251 {t("disclaimer")}252 </p>253 </section>254255 {/* ================= 01 — portrait du registre ================= */}256 {u && s && (257 <section>258 <Sect259 num="01"260 kicker={fr ? "Registre officiel" : "Official record"}261 title={fr ? "Portrait de la propriété" : "Property portrait"}262 />263 <div className="mt-6 grid gap-x-10 gap-y-8 lg:grid-cols-3 lg:divide-x lg:divide-[var(--line)]">264 {/* Bâtiment */}265 <div className="rise" style={{ animationDelay: "60ms" }}>266 <p className="klabel">{fr ? "Bâtiment" : "Building"}</p>267 <div className="flex justify-center py-2">268 <BuildingGlyph269 floors={s.nbEtages}270 dwellings={u.nbLogements}271 genre={s.genreConstruction}272 yearBuilt={u.anneeConstruction}273 floorAreaM2={u.aireEtagesM2}274 lang={lang}275 />276 </div>277 <EraLine year={u.anneeConstruction} lang={lang} />278 <div className="mt-3 grid grid-cols-2 gap-x-4 gap-y-2">279 <Chip k={fr ? "Aire d'étages" : "Floor area"} v={u.aireEtagesM2 ? locNum(u.aireEtagesM2, lang, { unit: "m²" }) : "—"} />280 <Chip k={fr ? "Étages × logements" : "Storeys × dwellings"} v={`${s.nbEtages ?? "—"} × ${u.nbLogements ?? "—"}`} />281 <Chip k={fr ? "Genre" : "Style"} v={s.genreConstruction ?? "—"} />282 <Chip k={fr ? "Lien physique" : "Physical link"} v={s.lienPhysique ?? "—"} />283 </div>284 </div>285 {/* Terrain */}286 <div className="rise lg:pl-10" style={{ animationDelay: "140ms" }}>287 <p className="klabel">{fr ? "Terrain — à l'échelle" : "Lot — to scale"}</p>288 <div className="flex justify-center py-2">289 <LotDiagram290 areaM2={u.superficieTerrainM2}291 frontageM={s.frontTerrainM}292 footprintM2={293 u.aireEtagesM2 && s.nbEtages ? u.aireEtagesM2 / Math.max(1, s.nbEtages) : u.aireEtagesM2294 }295 lang={lang}296 isCondo={!!s.apt || (u.nbLogements != null && u.nbLogements >= 1 && !u.superficieTerrainM2)}297 />298 </div>299 <div className="mt-3 grid grid-cols-2 gap-x-4 gap-y-2">300 <Chip k={fr ? "Superficie" : "Area"} v={u.superficieTerrainM2 ? locNum(u.superficieTerrainM2, lang, { unit: "m²" }) : "—"} />301 <Chip k={fr ? "Frontage" : "Frontage"} v={s.frontTerrainM ? locNum(s.frontTerrainM, lang, { unit: "m" }) : "—"} />302 <Chip k="CUBF" v={s.cubf ?? "—"} />303 <Chip k={fr ? "Usage" : "Use"} v={s.cubfLibelle ?? "—"} />304 </div>305 </div>306 {/* Valeur au rôle */}307 <div className="rise lg:pl-10" style={{ animationDelay: "220ms" }}>308 <p className="klabel">{fr ? "Valeur au rôle 2026 — composition" : "2026 assessed value — split"}</p>309 <p className="vp-display py-2 text-[30px] font-bold tracking-[-0.025em]">310 {fmt(u.valeurRole, lang)}311 </p>312 <ValueSplit313 land={s.valeurTerrain}314 building={s.valeurBatiment}315 previous={s.valeurAnterieure}316 total={u.valeurRole}317 lang={lang}318 labels={{319 land: fr ? "Terrain" : "Land",320 building: fr ? "Bâtiment" : "Building",321 previous: fr ? "Rôle antérieur" : "Previous roll",322 }}323 />324 <div className="mt-3 grid grid-cols-2 gap-x-4 gap-y-2">325 <Chip k={fr ? "Cond. marché au" : "Market cond."} v={s.datCondMarche ?? "—"} />326 <Chip k={fr ? "Matricule" : "Roll no."} v={s.matricule ?? "—"} />327 </div>328 <Link href={`/cout?property=${encodeURIComponent(u.id)}`} className="vp-mono mt-4 inline-block border-b border-accent pb-0.5 text-[11px] font-bold uppercase tracking-[0.08em] text-accent hover:text-accent-deep">329 {fr ? "Voir la méthode du coût" : "See the cost approach"} →330 </Link>331 </div>332 </div>333 {/* registre brut complet */}334 <details className="mt-6 border-t border-[var(--line)] pt-4">335 <summary className="vp-mono cursor-pointer text-[11px] font-bold uppercase tracking-[0.08em] text-accent-deep hover:text-accent">336 ▸ {fr ? "Toutes les données du registre (brutes)" : "All registry data (raw)"}337 </summary>338 <div className="mt-4 grid grid-cols-2 gap-x-4 gap-y-2 sm:grid-cols-4">339 <Chip k={fr ? "Année construction" : "Year built"} v={u.anneeConstruction ? `${u.anneeConstruction}${s.anneeEstimee === "E" ? (fr ? " (estimée)" : " (est.)") : ""}` : "—"} />340 <Chip k={fr ? "Locaux non résid." : "Non-res. units"} v={s.nbLocauxNonResid ?? "—"} />341 <Chip k={fr ? "Chambres locatives" : "Rental rooms"} v={s.nbChambresLocatives ?? "—"} />342 <Chip k={fr ? "Unité de voisinage" : "Neighbourhood"} v={s.uniteVoisinage || "—"} />343 <Chip k={fr ? "Arrondissement" : "Borough"} v={s.arrond || "—"} />344 <Chip k={fr ? "Adresses sur l'unité" : "Addresses"} v={s.nAdresses ?? "—"} />345 <Chip k={fr ? "Valeur terrain" : "Land value"} v={fmt(s.valeurTerrain, lang)} />346 <Chip k={fr ? "Valeur bâtiment" : "Building value"} v={fmt(s.valeurBatiment, lang)} />347 <Chip k={fr ? "Rôle antérieur" : "Previous roll"} v={fmt(s.valeurAnterieure, lang)} />348 <Chip k="ID provincial" v={u.id} />349 </div>350 </details>351 </section>352 )}353354 {/* ================= 02 — transparence du calcul ================= */}355 <section>356 <Sect num="02" kicker={fr ? "Transparence" : "Transparency"} title={t("whyTitle")} />357 <div className="mt-6 grid gap-x-10 gap-y-6 sm:grid-cols-2 sm:divide-x sm:divide-[var(--line)]">358 <div className="rise">359 <p className="klabel">{t("modelPart")}</p>360 <p className="vp-display mt-2 text-[clamp(30px,4vw,40px)] font-bold leading-none tracking-[-0.03em]">361 {r.modelEstimate != null ? (362 <CountUp value={r.modelEstimate} format={moneyFmt} />363 ) : (364 "—"365 )}366 </p>367 <p className="vp-mono mt-2 text-[11px] uppercase tracking-[0.06em] text-ink-2">368 {t("weightModel")} : <b className="text-ink">{(r.modelWeight * 100).toFixed(0)} %</b>369 </p>370 </div>371 <div className="rise sm:pl-10" style={{ animationDelay: "100ms" }}>372 <p className="klabel">{t("compsPart")}</p>373 <p className="vp-display mt-2 text-[clamp(30px,4vw,40px)] font-bold leading-none tracking-[-0.03em]">374 {r.compsEstimate != null ? (375 <CountUp value={r.compsEstimate} format={moneyFmt} />376 ) : (377 "—"378 )}379 </p>380 <p className="vp-mono mt-2 text-[11px] uppercase tracking-[0.06em] text-ink-2">381 {t("weightComps")} : <b className="text-ink">{((1 - r.modelWeight) * 100).toFixed(0)} %</b> · {r.nCompsUsed} comps382 {r.compsDispersionPct != null ? ` · ±${r.compsDispersionPct} %` : ""}383 </p>384 </div>385 </div>386 </section>387388 {/* ================= 03 — marché local ================= */}389 {ctx && (ctx.index.length >= 6 || ctx.sector || ctx.muniPercentile != null) && (390 <section>391 <Sect392 num="03"393 kicker={fr ? "Contexte de marché" : "Market context"}394 title={fr ? "Le marché autour de cette propriété" : "The market around this property"}395 />396 <div className="mt-6 grid items-start gap-x-10 gap-y-8 lg:grid-cols-[1.4fr_1fr]">397 {/* trajectoire du marché */}398 {ctx.index.length >= 6 && (399 <div className="rise">400 <div className="flex flex-wrap items-center justify-between gap-2">401 <p className="klabel">402 {fr403 ? `Indice de marché — ${t(ctx.typeProp as TKey)} (base 100 en ${ctx.index[0].month.slice(0, 4)})`404 : `Market index — ${t(ctx.typeProp as TKey)} (base 100 in ${ctx.index[0].month.slice(0, 4)})`}405 </p>406 <p className="vp-mono flex gap-4 text-[11px] text-ink-2">407 {ctx.index12mPct != null && (408 <span>409 12 {fr ? "mois" : "mo"}{" "}410 <b className={ctx.index12mPct >= 0 ? "text-ink" : "text-[var(--danger)]"}>411 {ctx.index12mPct >= 0 ? "+" : ""}412 {ctx.index12mPct.toFixed(1)} %413 </b>414 </span>415 )}416 {ctx.indexSince2021Pct != null && (417 <span>418 {ctx.index[0].month.slice(0, 4)}→{" "}419 <b className={ctx.indexSince2021Pct >= 0 ? "text-ink" : "text-[var(--danger)]"}>420 {ctx.indexSince2021Pct >= 0 ? "+" : ""}421 {ctx.indexSince2021Pct.toFixed(0)} %422 </b>423 </span>424 )}425 </p>426 </div>427 <div className="mt-3">428 <MarketIndexChart series={ctx.index} lang={lang} />429 </div>430 <p className="vp-mono mt-2 text-[10px] uppercase tracking-[0.05em] text-ink-3">431 {fr432 ? "Indice utilisé pour l'ajustement « marché » des comparables — même donnée, même calcul."433 : "Index used for the comparables' market adjustment — same data, same math."}434 </p>435 </div>436 )}437 <div className="flex flex-col gap-7 lg:border-l lg:border-[var(--line)] lg:pl-10">438 {/* ventes du secteur */}439 {ctx.sector && (440 <div className="rise" style={{ animationDelay: "80ms" }}>441 <p className="klabel">442 {fr443 ? `Ventes réelles — rayon ${ctx.sector.radiusKm} km · 12 mois`444 : `Real sales — ${ctx.sector.radiusKm} km radius · 12 months`}445 </p>446 <div className="mt-2 grid grid-cols-3 gap-x-4">447 <div className="kv-cell">448 <p className="k">{fr ? "Ventes" : "Sales"}</p>449 <p className="v">{ctx.sector.nSales12m}</p>450 </div>451 <div className="kv-cell">452 <p className="k">{fr ? "Prix médian" : "Median price"}</p>453 <p className="v">{ctx.sector.medianPrice != null ? fmt(Math.round(ctx.sector.medianPrice), lang) : "—"}</p>454 </div>455 <div className="kv-cell">456 <p className="k">$/m² {fr ? "médian" : "median"}</p>457 <p className="v">458 {ctx.sector.medianPpm2 != null459 ? locNum(Math.round(ctx.sector.medianPpm2), lang, { maxFrac: 0 })460 : "—"}461 </p>462 </div>463 </div>464 {ctx.sector.medianPrice != null && r.estimate > 0 && (465 <p className="vp-mono mt-3 text-[10.5px] uppercase tracking-[0.05em] text-ink-2">466 {fr ? "Cette propriété" : "This property"} :{" "}467 <b className="text-ink">468 {r.estimate >= ctx.sector.medianPrice ? "+" : "−"}469 {Math.abs((r.estimate / ctx.sector.medianPrice - 1) * 100).toFixed(0)} %470 </b>{" "}471 {fr ? "vs médiane du secteur" : "vs sector median"}472 </p>473 )}474 </div>475 )}476 {/* position dans la municipalité */}477 {ctx.muniPercentile != null && u?.municipalite && (478 <div className="rise" style={{ animationDelay: "160ms" }}>479 <p className="klabel">480 {fr ? `Position dans ${u.municipalite}` : `Position in ${u.municipalite}`}481 </p>482 <div className="mt-3">483 <PercentileBar pct={ctx.muniPercentile} lang={lang} />484 </div>485 <p className="mt-3 text-[13px] text-ink-2">486 {fr ? (487 <>488 Vaut plus que{" "}489 <b className="text-ink">{Math.round(ctx.muniPercentile)} %</b> des{" "}490 {ctx.muniTotal != null ? locNum(ctx.muniTotal, lang, { maxFrac: 0 }) : ""}{" "}491 propriétés estimées de la municipalité.492 </>493 ) : (494 <>495 Worth more than{" "}496 <b className="text-ink">{Math.round(ctx.muniPercentile)} %</b> of the{" "}497 {ctx.muniTotal != null ? locNum(ctx.muniTotal, lang, { maxFrac: 0 }) : ""}{" "}498 estimated properties in the municipality.499 </>500 )}501 </p>502 </div>503 )}504 </div>505 </div>506 </section>507 )}508509 {/* ================= 04 — historique ================= */}510 {u && u.history.some((h) => h.value != null) && (511 <section>512 <Sect num="04" kicker="2021 → 2026" title={t("history")} />513 <div className="mt-6 max-w-3xl">514 <div className="flex flex-col gap-2">515 {u.history.map((h, i) => {516 const prev = i > 0 ? u.history[i - 1].value : null;517 const yoy =518 h.value != null && prev != null && prev > 0519 ? ((h.value / prev - 1) * 100)520 : null;521 return (522 <div key={h.year} className="hbar-row grid grid-cols-[44px_1fr_auto] items-center gap-2 sm:grid-cols-[52px_1fr_auto] sm:gap-3">523 <span className="vp-mono text-[12px] font-bold">{h.year}</span>524 <span className="hbar-track">525 <span526 className="hbar-fill grow-x"527 style={{528 width: `${((h.value ?? 0) / histMax) * 100}%`,529 animationDelay: `${i * 90}ms`,530 background: h.year === 2026 ? "var(--accent)" : undefined,531 }}532 />533 </span>534 <span className="vp-mono flex items-center justify-end gap-2 text-[12px] font-bold">535 {fmt(h.value, lang)}536 {yoy != null && (537 <span className={`text-[10px] font-medium ${yoy >= 0 ? "text-ink-2" : "text-[var(--danger)]"}`}>538 {yoy >= 0 ? "+" : ""}539 {yoy.toFixed(0)} %540 </span>541 )}542 </span>543 </div>544 );545 })}546 </div>547 </div>548 </section>549 )}550551 {/* ================= 05 — comparables ================= */}552 <section>553 <Sect554 num="05"555 kicker={`${r.nCompsUsed} ${fr ? "ventes réelles" : "real sales"}`}556 title={t("compsTitle")}557 />558 <div className="mt-6 grid items-start gap-x-8 gap-y-6 lg:grid-cols-[1.05fr_1fr]">559 <div className="overflow-hidden border border-[var(--line-strong)]">560 <RadarMap561 subject={{562 lat: u?.lat ?? r.comps[0]?.lat ?? 46.81,563 lng: u?.lng ?? r.comps[0]?.lng ?? -71.21,564 label: u?.adresse ?? (fr ? "Propriété estimée" : "Subject property"),565 }}566 comps={r.comps.map((c) => ({567 id: c.id,568 lat: c.lat,569 lng: c.lng,570 label: `${c.street ?? ""}, ${c.city ?? ""}`,571 price: fmt(c.amount, lang),572 adjusted: fmt(Math.round(c.adjustedPrice), lang),573 date: c.date,574 distanceM: c.distanceM,575 weight: c.weight,576 }))}577 highlight={activeComp}578 onHover={setActiveComp}579 />580 </div>581 <div className="src-wrap max-h-[560px] overflow-y-auto">582 <table className="src-table">583 <thead className="sticky top-0 z-10 bg-paper">584 <tr>585 <th>#</th>586 <th>{fr ? "Vente" : "Sale"}</th>587 <th className="text-right">{t("adjusted")}</th>588 </tr>589 </thead>590 <tbody>591 {r.comps.map((c, i) => (592 <tr593 key={c.id}594 onMouseEnter={() => setActiveComp(c.id)}595 onMouseLeave={() => setActiveComp(null)}596 className={activeComp === c.id ? "!bg-surface-2" : ""}597 >598 <td>599 <span600 className={`vp-mono inline-flex h-6 w-6 items-center justify-center text-[11px] font-bold ${601 activeComp === c.id ? "bg-accent text-white" : "bg-ink text-paper"602 }`}603 >604 {i + 1}605 </span>606 </td>607 <td>608 <p className="font-semibold leading-tight">609 {c.street}, {c.city}610 </p>611 <p className="vp-mono mt-0.5 text-[10.5px] uppercase tracking-[0.04em] text-ink-3">612 {c.date} · {c.distanceM < 1000 ? `${Math.round(c.distanceM)} m` : `${(c.distanceM / 1000).toFixed(1)} km`} ·{" "}613 {t("sold")} {fmt(c.amount, lang)}614 {c.floorArea && c.floorArea > 20615 ? ` (${locNum(Math.round(c.amount / c.floorArea), lang, { maxFrac: 0 })} $/m²)`616 : ""}617 </p>618 {(c.floorArea || c.yearBuilt) && (619 <p className="vp-mono mt-0.5 text-[10.5px] uppercase tracking-[0.04em] text-ink-3">620 {[621 c.floorArea ? locNum(c.floorArea, lang, { unit: "m²" }) : null,622 c.yearBuilt ? `${fr ? "constr." : "built"} ${c.yearBuilt}` : null,623 ]624 .filter(Boolean)625 .join(" · ")}626 </p>627 )}628 <p className="vp-mono mt-0.5 text-[10.5px] text-ink-2">629 {t("adjTime")} {signed(c.adjTime, lang)} · {t("adjArea")} {signed(c.adjArea, lang)} ·{" "}630 {t("adjAge")} {signed(c.adjAge, lang)}631 </p>632 </td>633 <td className="vp-display text-right font-bold">634 {fmt(Math.round(c.adjustedPrice), lang)}635 <p className="vp-mono text-[10px] font-normal text-ink-3">636 {t("weight")} {(c.weight * 100).toFixed(0)} %637 </p>638 </td>639 </tr>640 ))}641 </tbody>642 </table>643 </div>644 </div>645 </section>646647 {/* ================= alerte de valeur ================= */}648 <section className="bleed vp-dark">649 <div className="mx-auto max-w-6xl px-4 py-10 sm:px-6 sm:py-12">650 <span className="sec-num !text-[var(--accent-bright)]">651 06 — {fr ? "Suivi" : "Watch"}652 </span>653 <h2 className="vp-display mt-2 text-[clamp(20px,3vw,28px)] font-bold uppercase tracking-[-0.025em] text-[var(--paper-on-ink)]">654 {t("leadTitle")}655 </h2>656 <div className="mt-5 max-w-xl">657 <LeadForm unitId={u?.id ?? null} estimate={r.estimate} />658 </div>659 </div>660 </section>661 </div>662 );663}664