import type { SaleRow, ListingRow } from '@/lib/queries/assets';
import { fmtDate, fmtMoney, fmtRelative, cn } from '@/lib/format';
import { humanize } from '@/lib/taxonomy';
import { Badge, Delta, EmptyState } from '@/components/ui/primitives';
import { GradeBadge, SourceLink, Thumb } from '@/components/market/bits';
/** Phone-first card lists for sales and listings (tables stay for md+). */
export function SalesCards({ items, className, emptyDescription = 'Sales appear once connectors ingest verified transactions.' }: { items: SaleRow[]; className?: string; emptyDescription?: string }) {
if (!items.length) return ;
return (
{items.map((s) => (
-
{fmtMoney(s.priceUsd)}
{fmtDate(s.saleDate)}
{s.price !== null && s.currency && s.currency !== 'USD' ?
{fmtMoney(s.price, s.currency)} native
: null}
{s.rawTitle}
{s.condition ? {humanize(s.condition)} : null}
{humanize(s.saleType)}
{s.status !== 'valid' ? {s.status} : null}
))}
);
}
export function ListingsCards({ items, className, emptyDescription = 'Live listings appear once marketplace connectors run.' }: { items: ListingRow[]; className?: string; emptyDescription?: string }) {
if (!items.length) return ;
return (
{items.map((l) => (
-
{fmtMoney(l.priceUsd)}
{l.discountToRiv !== null ? (
vs RIV
) : (
{fmtRelative(l.lastSeenAt)}
)}
{l.price !== null && l.currency && l.currency !== 'USD' ?
{fmtMoney(l.price, l.currency)} native
: null}
{l.rawTitle}
{humanize(l.listingType)}
{l.seller ? {l.seller} : null}
{l.location ? {l.location} : null}
))}
);
}