[feat] rounding price over $100

This commit is contained in:
2026-02-16 20:15:00 -05:00
parent c8caccf9d5
commit 1a95eb93b0

View File

@@ -16,6 +16,17 @@ const pokemon = await db.query.cards.findMany({
}
});
const formatPrice = (price:any) => {
if (price === null) {
return "N/A";
}
price = Number(price);
if (price >= 100) {
return `${Math.round(price)}`;
}
return `${price.toFixed(2)}`;
};
const order = ["Near Mint", "Lightly Played", "Moderately Played", "Heavily Played", "Damaged"];
---
@@ -46,7 +57,7 @@ const order = ["Near Mint", "Lightly Played", "Moderately Played", "Heavily Play
.map((price) => (
<div class="col p price-label">
{price.condition.split(' ').map((w) => w[0]).join('')}
<br />${price.marketPrice}
<br />${formatPrice(price.marketPrice)}
</div>
))}
</div>