TypeScript 50.6%
JavaScript 46.1%
SQL 2.1%
Shell 0.6%
CSS 0.5%
1import { fmtPct } from "@/lib/format";2/** Écart estimation vs prix demandé — jamais « bonne affaire » : on dit ce que le modèle mesure, avec sa confiance. */3export function VerdictPill({ verdict, ratio, confidence, small = false }: { verdict: string | null; ratio: number | null; confidence: string | null; small?: boolean }) {4 if (!verdict || verdict === "na" || ratio == null) return null;5 const weak = confidence === "C" || confidence === "D";6 const pct = ratio - 1; // estimation vs prix : +10 % = estimation 10 % au-dessus du prix demandé7 const cls = verdict === "aligne" ? "bg-info-soft text-info" : verdict === "sous" ? "bg-good-soft text-good" : "bg-warn-soft text-warn";8 const full = verdict === "aligne" ? "Prix aligné sur l'estimation" : `Estimation ${fmtPct(pct)} vs prix`;9 const short = verdict === "aligne" ? "≈ estimation" : `${fmtPct(pct)} vs prix`;10 const title = `${full}${weak ? " · confiance du modèle faible : à interpréter avec prudence" : " · écart entre l'estimation Toveli et le prix demandé"}`;11 if (small) return <span className={`tv-badge ${cls} text-[11px] whitespace-nowrap`} title={title} aria-label={title}>{short}{weak ? " ·!" : ""}</span>;12 return <span className={`tv-badge ${cls}`} title={title}>{full}{weak ? " · faible confiance" : ""}</span>;13}14