SPB Git

spb/vrai-prix Public

Vrai-Prix — l'évaluation du vrai prix des propriétés résidentielles au Québec.

TypeScript 96.7% CSS 3.2%
1022 B · 36 lines tsx
Raw Blame History
1// Auteur : Simon-Pierre Boucher — contact@spboucher.ai2import { notFound } from "next/navigation";3import { estimateManual } from "@/lib/estimator";4import ResultView from "@/components/ResultView";56export const dynamic = "force-dynamic";78export default async function ManualEstimationPage({9  searchParams,10}: {11  searchParams: Promise<Record<string, string | string[] | undefined>>;12}) {13  const sp = await searchParams;14  const one = (k: string) => {15    const v = sp[k];16    return Array.isArray(v) ? v[0] : v;17  };18  const municipality = one("municipality");19  const typeProp = one("typeProp");20  if (!municipality || !typeProp) notFound();21  const num = (k: string) => {22    const v = one(k);23    const n = v ? Number(v) : NaN;24    return Number.isFinite(n) ? n : undefined;25  };26  const data = estimateManual({27    municipality,28    typeProp,29    floorArea: num("floorArea"),30    yearBuilt: num("yearBuilt"),31    landArea: num("landArea"),32  });33  if (!data) notFound();34  return <ResultView data={data} />;35}36