import { Link } from 'react-router-dom'; import HeartButton from './HeartButton'; export interface FavoriteCardEntry { id: string; slug: string; title: string; price: string; type: 'venda' | 'aluguel'; photo: string | null; city: string | null; bedrooms: number; area_m2: number; } function formatPrice(price: string, type: 'venda' | 'aluguel') { const num = parseFloat(price); if (isNaN(num)) return price; const formatted = num.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL', maximumFractionDigits: 0 }); return type === 'aluguel' ? `${formatted}/mês` : formatted; } interface FavoritesCardsGridProps { entries: FavoriteCardEntry[]; } export default function FavoritesCardsGrid({ entries }: FavoritesCardsGridProps) { if (entries.length === 0) { return (

Nenhum favorito ainda

Explorar imóveis →
); } return (
{entries.map(entry => (
{entry.photo ? ( {entry.title} ) : (
)}
{entry.type === 'venda' ? 'Venda' : 'Aluguel'}

{entry.title}

{entry.city && (

{entry.city}

)} {entry.price && (

{formatPrice(entry.price, entry.type)}

)}
{entry.bedrooms > 0 && {entry.bedrooms} qto{entry.bedrooms !== 1 ? 's' : ''}} {entry.area_m2 > 0 && {entry.area_m2} m²}
))}
); }