pricing tiers
This commit is contained in:
@@ -14,16 +14,28 @@ const ItemCard: React.FC<ItemCardProps> = ({
|
||||
const isCompact = variant === 'compact';
|
||||
|
||||
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`;
|
||||
// Collect all available pricing tiers
|
||||
const pricingTiers: string[] = [];
|
||||
|
||||
if (item.pricePerHour && Number(item.pricePerHour) > 0) {
|
||||
pricingTiers.push(`$${Math.floor(Number(item.pricePerHour))}/hr`);
|
||||
}
|
||||
return null;
|
||||
if (item.pricePerDay && Number(item.pricePerDay) > 0) {
|
||||
pricingTiers.push(`$${Math.floor(Number(item.pricePerDay))}/day`);
|
||||
}
|
||||
if (item.pricePerWeek && Number(item.pricePerWeek) > 0) {
|
||||
pricingTiers.push(`$${Math.floor(Number(item.pricePerWeek))}/wk`);
|
||||
}
|
||||
if (item.pricePerMonth && Number(item.pricePerMonth) > 0) {
|
||||
pricingTiers.push(`$${Math.floor(Number(item.pricePerMonth))}/mo`);
|
||||
}
|
||||
|
||||
if (pricingTiers.length === 0) {
|
||||
return "Free to Borrow";
|
||||
}
|
||||
|
||||
// Display up to 2 pricing tiers separated by bullet point
|
||||
return pricingTiers.slice(0, 2).join(" • ");
|
||||
};
|
||||
|
||||
const getLocationDisplay = () => {
|
||||
|
||||
Reference in New Issue
Block a user