import React from 'react'; import { Item } from '../types'; import { getImageUrl } from '../services/uploadService'; interface ItemMarkerInfoProps { item: Item; onViewDetails?: () => void; } const ItemMarkerInfo: React.FC = ({ item, onViewDetails }) => { const getPriceDisplay = () => { if (item.pricePerDay !== undefined) { return Number(item.pricePerDay) === 0 ? "Free to Borrow" : `$${Math.floor(Number(item.pricePerDay))}/Day`; } else if (item.pricePerHour !== undefined) { return Number(item.pricePerHour) === 0 ? "Free to Borrow" : `$${Math.floor(Number(item.pricePerHour))}/Hour`; } return 'Contact for pricing'; }; return (
{item.imageFilenames && item.imageFilenames[0] ? ( {item.name} { const target = e.currentTarget; if (!target.dataset.fallback) { target.dataset.fallback = 'true'; target.src = getImageUrl(item.imageFilenames[0], 'original'); } }} style={{ height: '120px', objectFit: 'contain', backgroundColor: '#f8f9fa', borderRadius: '8px 8px 0 0' }} /> ) : (
)}
{item.name}
{getPriceDisplay()}
{item.description && (

{item.description}

)}
); }; export default ItemMarkerInfo;