From 1a95eb93b0cb6448e484b2b58d8dc6a2a165d153 Mon Sep 17 00:00:00 2001 From: Thad Miller Date: Mon, 16 Feb 2026 20:15:00 -0500 Subject: [PATCH] [feat] rounding price over $100 --- src/pages/pokemon.astro | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pages/pokemon.astro b/src/pages/pokemon.astro index 6a2e8ec..024cbb1 100644 --- a/src/pages/pokemon.astro +++ b/src/pages/pokemon.astro @@ -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) => (
{price.condition.split(' ').map((w) => w[0]).join('')} -
${price.marketPrice} +
${formatPrice(price.marketPrice)}
))}