SPB Git

Repository Public

page.tsx 3.6 KB 78 lines tsx

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : Vrai-Prix8 * File             : src/app/cout/page.tsx9 * Module           : app10 * Repository       : https://git.spboucher.ai/vrai-prix11 * Created          : 2026-09-0812 * 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 * /cout — Méthode du coût : landing « Coût aujourd'hui » ou atelier44 * (?property=<id_provinc> | ?mode=construction | ?estimate=<uuid>).45 * Les données de la landing sont lues côté serveur dans la base de coûts locale46 * (jamais de crawl dans le chemin utilisateur).47 */48import type { Metadata } from "next";49import Landing from "@/components/cout/Landing";50import Workbench from "@/components/cout/Workbench";51import { buildOverview, loadLocations } from "@/lib/cost/catalog";52import { cached } from "@/lib/cost/cache";53import type { CostOverview } from "@/lib/cost/types";5455export const dynamic = "force-dynamic";5657export const metadata: Metadata = {58  title: "Méthode du coût — combien coûterait ce bâtiment à reconstruire aujourd'hui ?",59  description:60    "Méthode du coût : coût de remplacement à neuf décomposé par assemblages (matériaux, main-d'œuvre APCHQ/CCQ, équipement), facteurs régionaux, frais indirects, dépréciation physique, fonctionnelle et externe, valeur du terrain, fourchette et indice de confiance. Chaque hypothèse et chaque source sont visibles.",61  alternates: { canonical: "/cout" },62};6364export default async function CoutPage({ searchParams }: { searchParams: Promise<Record<string, string | string[] | undefined>> }) {65  const sp = await searchParams;66  const property = typeof sp.property === "string" ? sp.property.replace(/\D/g, "") || null : null;67  const estimate = typeof sp.estimate === "string" && /^[0-9a-f-]{36}$/.test(sp.estimate) ? sp.estimate : null;68  const construction = sp.mode === "construction";69  if (property || estimate || construction) {70    let locations: CostOverview["locations"] = [];71    try { locations = loadLocations(); } catch { /* base indisponible */ }72    return <Workbench key={`${property ?? ""}|${estimate ?? ""}|${construction}`} propertyId={property} estimateId={estimate} locations={locations} />;73  }74  let overview: CostOverview | null = null;75  try { overview = cached("overview", 10 * 60_000, () => buildOverview()); } catch { overview = null; }76  return <Landing overview={overview} />;77}78
Files main
Menu

Theme