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) => (