// ----------------------------------------------------------------------------- // Lou-Ka — Agrégateur de logements à louer (province de Québec) // Auteur : Simon-Pierre Boucher — contact@spboucher.ai // pages/GestionPublic.tsx : page publique d'une gestion immobilière — /g/{source} // Bandeau personnalisé par le gestionnaire (accroche, description, contact, // logo) + inventaire relié automatiquement (12/page, pagination). // ----------------------------------------------------------------------------- import { useEffect, useState } from "react"; import { Link, useParams } from "react-router-dom"; import { Listing, OrgProfile, fetchListings, fetchOrg } from "../api"; import ListingCard from "../components/ListingCard"; import Pager from "../components/Pager"; import { IcoCompass, IcoPin } from "../components/Icons"; const PAGE_SIZE = 12; export default function GestionPublicPage() { const { sourceId = "" } = useParams(); const [org, setOrg] = useState(undefined); const [listings, setListings] = useState(null); const [total, setTotal] = useState(0); const [page, setPage] = useState(1); useEffect(() => { fetchOrg(sourceId).then(setOrg).catch(() => setOrg(null)); setPage(1); }, [sourceId]); useEffect(() => { setListings(null); fetchListings({ source: sourceId }, PAGE_SIZE, (page - 1) * PAGE_SIZE) .then((r) => { setListings(r.listings); setTotal(r.total); }) .catch(() => setListings([])); }, [sourceId, page]); if (org === undefined) { return
Chargement…
; } if (org === null) { return (

Page introuvable

Cette gestion n'existe pas sur Lou-Ka.

Explorer les logements
); } return (
{org.logo_url && ( )}
Gestion immobilière

{org.name}

{org.tagline &&

{org.tagline}

}
{org.active_listings} logements actifs {org.claimed && Page gérée par l'organisation} {org.phone && {org.phone}} {org.email && {org.email}} {org.website && ( Site web ↗ )}
{org.description &&

{org.description}

}

Logements offerts

{listings && {total} résultat{total > 1 ? "s" : ""}}
{listings === null && (
{Array.from({ length: 4 }).map((_, i) => (
))}
)} {listings !== null && ( <>
{listings.map((l) => )}
{ setPage(p); window.scrollTo({ top: 0, behavior: "smooth" }); }} /> )}
); }