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 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>
</div>
);
@@ -291,11 +294,17 @@ export const PlanetTableRow = ({
}}
>
{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`;
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