import type { Metadata } from "next"; import { Suspense } from "react"; import { unifiedSearch, unifiedPoints } from "@/lib/search"; import { dbAvailable } from "@/lib/db"; import { fromUrl, describe, type SP } from "@/lib/search-params"; import { ResultsView } from "./results-view"; import { Empty } from "@/components/ui"; export const dynamic = "force-dynamic"; export async function generateMetadata({ searchParams }: { searchParams: Promise }): Promise { const p = fromUrl(await searchParams); const what = p.market === "rent" ? "Logements à louer" : "Propriétés à vendre"; const where = p.city ?? p.region ?? "au Québec"; return { title: `${what} ${p.city ? "à " : p.region ? "— " : ""}${where}`, description: `${what} ${where} : liste, carte, filtres et estimation de valeur sur Toveli.` }; } export default async function Recherche({ searchParams }: { searchParams: Promise }) { const sp = await searchParams; if (!dbAvailable()) return
; const p = fromUrl(sp); const res = await unifiedSearch(p); const points = await unifiedPoints({ ...p, limit: 1500, offset: 0 }); return ( ); }