'use client'; import Image from 'next/image'; import * as React from 'react'; import { KpiCard } from '@/components/design-system'; import { formatPrice, formatPricePerM2 } from '@/lib/currency'; import type { ListingDetail } from '@/lib/listings-api'; interface ListingPreviewPanelProps { listing: ListingDetail | null; } /** * Right-side preview panel shown on row hover in the listings table. * Displays the first image + key KPIs for the hovered listing. */ export function ListingPreviewPanel({ listing }: ListingPreviewPanelProps) { if (!listing) { return (
Di chuột qua dòng để xem trước
); } const thumbnail = listing.property.thumbnail ?? listing.property.media?.[0]?.url ?? null; return (
{/* Image */} {thumbnail ? (
{listing.property.title}
) : (
Không có ảnh
)} {/* Title */}

{listing.property.title}

{/* Location */}

{listing.property.ward}, {listing.property.district}

{/* KPI grid */}
{/* Agent */} {listing.agent && (

Môi giới

{listing.agent.agency ?? 'Cá nhân'}

)}
); }