// ----------------------------------------------------------------------------- // Rent-Ka — Rental listings aggregator (Canada, outside Québec) // Author: Simon-Pierre Boucher — contact@spboucher.ai // components/ListingCard.tsx: listing card (results grid) // ----------------------------------------------------------------------------- import { Link } from "react-router-dom"; import { Listing, fmtPrice, sourceName } from "../api"; import { useAccount } from "../account"; import { IcoCamera, IcoHeart } from "./Icons"; import SmartImg from "./SmartImg"; import FairValueBadge from "./FairValueBadge"; import KaScoreBadge from "./KaScoreBadge"; export default function ListingCard({ l }: { l: Listing }) { const img = l.images && l.images.length > 0 ? l.images[0] : null; const { me, favs, toggleFav } = useAccount(); const fav = favs.has(l.uid); return (
{l.unit_type && {l.unit_type}} {l.ka_reco && ( Recommended for you )} {l.images.length > 1 && ( {l.images.length} )} {me && ( )}
{fmtPrice(l.price, l.price_label)} {l.price != null && / month}
{l.title || l.address}
{l.sector && {l.sector}} {l.sector && l.city && } {l.city && {l.city}} {l.ks_global != null && }
{sourceName(l.source)} {l.availability && {l.availability}}
); }