prevent crash if esi does not return extractor_details object

This commit is contained in:
Calli
2023-08-25 17:04:47 +03:00
parent f7e9344604
commit d4e3ed978e

View File

@@ -224,7 +224,10 @@ export const PlanetTableRow = ({
)} )}
</Typography> </Typography>
<Typography fontSize={theme.custom.smallText}> <Typography fontSize={theme.custom.smallText}>
{PI_TYPES_MAP[e.extractor_details?.product_type_id ?? 0].name} {
PI_TYPES_MAP[e.extractor_details?.product_type_id ?? 0]
?.name
}
</Typography> </Typography>
</div> </div>
); );
@@ -291,11 +294,17 @@ export const PlanetTableRow = ({
}} }}
> >
{exports.map((e) => { {exports.map((e) => {
const valueInMillions = (((piPrices?.appraisal.items.find((a) => a.typeID === e.typeId) const valueInMillions =
?.prices.sell.min ?? 0) * e.amount) / 1000000) * 24 * 30; (((piPrices?.appraisal.items.find((a) => a.typeID === e.typeId)
const displayValue = valueInMillions >= 1000 ?.prices.sell.min ?? 0) *
? `${(valueInMillions / 1000).toFixed(2)} B` e.amount) /
: `${valueInMillions.toFixed(2)} M`; 1000000) *
24 *
30;
const displayValue =
valueInMillions >= 1000
? `${(valueInMillions / 1000).toFixed(2)} B`
: `${valueInMillions.toFixed(2)} M`;
return ( return (
<Typography <Typography