import type { Metadata } from "next"; import Link from "next/link"; import { cityMetrics, marketIndex, marketMetrics, regionMetrics } from "@/lib/queries"; import { dbAvailable, meta } from "@/lib/db"; import { fmtPrice, fmtInt, fmtPct, fmtDate } from "@/lib/format"; import { CATEGORY_LABEL } from "@/lib/normalize"; import { Empty, Notice, Stat } from "@/components/ui"; import { IndexChart } from "@/components/price-chart"; export const dynamic = "force-dynamic"; export const metadata: Metadata = { title: "Marché et données", description: "Prix médians, nouvelles inscriptions, jours sur le marché et écart estimation/prix par région et municipalité du Québec." }; export default async function Marche({ searchParams }: { searchParams: Promise<{ marche?: string; region?: string; ville?: string; type?: string }> }) { const sp = await searchParams; if (!dbAvailable()) return
{value}{scope !== "province" ? "" : " (ensemble des annonces Toveli)"} · {market === "rent" ? "location" : "achat"} · mis à jour le {fmtDate(meta("built_at"))}
| Catégorie | Annonces | Médiane | P25–P75 | Jours | {market === "sale" &&Estim./prix | }
|---|---|---|---|---|---|
| {CATEGORY_LABEL[m.category] ?? m.category} | {fmtInt(m.n)} | {fmtPrice(m.median_price)} | {fmtPrice(m.p25_price, { compact: true })} – {fmtPrice(m.p75_price, { compact: true })} | {m.median_days ?? "—"} | {market === "sale" &&{m.median_ratio ? fmtPct(m.median_ratio - 1) : "—"} | }
Base 100 = {idx[idx.length - 1].month}. Variation sur 12 mois : {idx.length > 12 ? fmtPct(idx[idx.length - 1].idx / idx[idx.length - 13].idx - 1) : "—"} · sur 5 ans : {idx.length > 60 ? fmtPct(idx[idx.length - 1].idx / idx[idx.length - 61].idx - 1) : "—"}. Source : base de transactions Toveli (prix au m² médian mensuel).
| Méthode | n | MdAPE | Ratio médian |
|---|---|---|---|
| {m.method} | {fmtInt(m.n)} | {fmtPct(m.mdape, 1, false)} | {m.medianRatio?.toFixed(3)} |
Le prix demandé n'est pas le prix de vente : ces écarts mesurent la cohérence estimation/annonce, pas l'erreur finale. Rétro-test généré le {fmtDate(vp.generated)}.
Voir les annonces de ce périmètre →