handle billions in ISK/M

This commit is contained in:
Calli
2023-08-02 21:04:34 +03:00
parent b13ae22dca
commit f7e9344604

View File

@@ -290,21 +290,22 @@ export const PlanetTableRow = ({
textAlign: "end", textAlign: "end",
}} }}
> >
{exports.map((e) => ( {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 (
<Typography <Typography
key={`export-praisal-${character.character.characterId}-${planet.planet_id}-${e.typeId}`} key={`export-praisal-${character.character.characterId}-${planet.planet_id}-${e.typeId}`}
fontSize={theme.custom.smallText} fontSize={theme.custom.smallText}
> >
{`${( {displayValue}
(((piPrices?.appraisal.items.find((a) => a.typeID === e.typeId)
?.prices.sell.min ?? 0) *
e.amount) /
1000000) *
24 *
30
).toFixed(2)} M`}
</Typography> </Typography>
))} );
})}
</div> </div>
</TableCell> </TableCell>
<TableCell> <TableCell>