// Listing detail modal with photo gallery
const ListingModal = ({ listing, onClose, setRoute }) => {
const [idx, setIdx] = React.useState(0);
useLucide();
React.useEffect(() => {
const onKey = (e) => {
if (e.key === 'Escape') onClose();
if (e.key === 'ArrowLeft') setIdx(i => (i - 1 + listing.images.length) % listing.images.length);
if (e.key === 'ArrowRight') setIdx(i => (i + 1) % listing.images.length);
};
window.addEventListener('keydown', onKey);
document.body.style.overflow = 'hidden';
return () => {
window.removeEventListener('keydown', onKey);
document.body.style.overflow = '';
};
}, [listing]);
if (!listing) return null;
return (
e.stopPropagation()}>

{listing.images.length > 1 && (
<>
>
)}
{listing.images.map((src, i) => (
setIdx(i)}>
))}
{listing.status === 'sold' ? 'Sold' : 'For Sale'}
{listing.type}
{listing.year && Built {listing.year}}
{formatFullPrice(listing.price)}
{listing.address}
{listing.neighbourhood} ยท {listing.city}
Beds{listing.beds}
Baths{listing.baths}
Sq ft{listing.sqft.toLocaleString()}
Type{listing.type}
{listing.description}
{listing.features.map(f => {f})}
Call Steffanie
);
};
window.ListingModal = ListingModal;