interface Offer { id: string; buyerId: string; buyerName?: string; amount: number; message?: string; status: string; createdAt: string; } interface OfferListProps { offers: Offer[]; isSellerView?: boolean; onAccept?: (offerId: string) => void; onReject?: (offerId: string) => void; onWithdraw?: (offerId: string) => void; } const statusColors: Record = { pending: 'bg-yellow-100 text-yellow-800', accepted: 'bg-green-100 text-green-800', rejected: 'bg-red-100 text-red-800', withdrawn: 'bg-gray-100 text-gray-800', expired: 'bg-gray-100 text-gray-800', }; const statusLabels: Record = { pending: 'Pending', accepted: 'Accepted', rejected: 'Rejected', withdrawn: 'Withdrawn', expired: 'Expired', }; export function OfferList({ offers, isSellerView = false, onAccept, onReject, onWithdraw, }: OfferListProps) { if (offers.length === 0) { return (
📭

No offers yet

); } return (
{offers.map((offer) => ( ))}
); } interface OfferItemProps { offer: Offer; isSellerView: boolean; onAccept?: (offerId: string) => void; onReject?: (offerId: string) => void; onWithdraw?: (offerId: string) => void; } function OfferItem({ offer, isSellerView, onAccept, onReject, onWithdraw, }: OfferItemProps) { const isPending = offer.status === 'pending'; return (
{isSellerView && (
👤
{offer.buyerName || 'Anonymous'}
)}
${offer.amount.toFixed(2)}
{new Date(offer.createdAt).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: '2-digit', })}
{statusLabels[offer.status]}
{offer.message && (
"{offer.message}"
)} {isPending && (
{isSellerView ? ( <> {onAccept && ( )} {onReject && ( )} ) : ( onWithdraw && ( ) )}
)}
); } export default OfferList;