// ----------------------------------------------------------------------------- // Lou-Ka — Agrégateur de logements à louer (province de Québec) // Auteur : Simon-Pierre Boucher — contact@spboucher.ai // fiche/PropertyHero.tsx : héro de la fiche — prix + capsule « vs marché », // adresse (H1) + ville, ligne résumé, puis galerie, puis actions // (favoris · partager · Voir l'annonce). Ordre DOM = ordre visuel. // ----------------------------------------------------------------------------- import { Listing, fmtAvailability, fmtPrice, sourceName } from "../api"; import { IcoDoc, IcoExternal, IcoHeart, IcoShare } from "../components/Icons"; import PropertyGallery from "./PropertyGallery"; import { ComparaisonPrix, ligneResume } from "./synthese"; import { NBSP } from "./ui"; export function PriceCapsule({ cmp, short = false }: { cmp: ComparaisonPrix | null; short?: boolean }) { if (!cmp) return null; return ( {short ? {cmp.court} : <>{cmp.label}{cmp.court}} ); } export default function PropertyHero({ l, cmp, fav, onFav, onShare, actionsRef }: { l: Listing; cmp: ComparaisonPrix | null; fav: boolean; onFav: () => void; onShare: () => void; actionsRef: React.RefObject; }) { const dispo = fmtAvailability(l.availability_date); const resume = ligneResume(l, dispo); const titre = l.title || l.address; const adresse = l.address && l.address !== l.title ? l.address : l.title; const where = [l.sector, l.city].filter(Boolean).join(", "); const hist = (l.price_history ?? []).filter((h) => h.price != null); const baisse = hist.length >= 2 && hist[0].price! < hist[1].price! ? hist[1].price! : null; return (
{fmtPrice(l.price, l.price_label)} {l.price != null && /{NBSP}mois} {baisse != null && {fmtPrice(baisse)}}
{l.details?.price_from && à partir de} {l.ka_reco && Recommandé pour vous}

{adresse || titre} {where && {where}}

{resume.length > 0 && (

{resume.map((r, i) => ( {i > 0 && }{r} ))}

)}
Voir l'annonce chez {sourceName(l.source)}
); }