From f7e934460433d48159c19b6f638d990ca8e3ca31 Mon Sep 17 00:00:00 2001 From: Calli Date: Wed, 2 Aug 2023 21:04:34 +0300 Subject: [PATCH] handle billions in ISK/M --- .../PlanetaryInteraction/PlanetTableRow.tsx | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx b/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx index 6662b18..0e827e1 100644 --- a/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx +++ b/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx @@ -290,21 +290,22 @@ export const PlanetTableRow = ({ textAlign: "end", }} > - {exports.map((e) => ( - - {`${( - (((piPrices?.appraisal.items.find((a) => a.typeID === e.typeId) - ?.prices.sell.min ?? 0) * - e.amount) / - 1000000) * - 24 * - 30 - ).toFixed(2)} M`} - - ))} + {exports.map((e) => { + const valueInMillions = (((piPrices?.appraisal.items.find((a) => a.typeID === e.typeId) + ?.prices.sell.min ?? 0) * e.amount) / 1000000) * 24 * 30; + const displayValue = valueInMillions >= 1000 + ? `${(valueInMillions / 1000).toFixed(2)} B` + : `${valueInMillions.toFixed(2)} M`; + + return ( + + {displayValue} + + ); + })}