Add singleplanet P2 blance alert
This commit is contained in:
@@ -166,6 +166,39 @@ export const ExtractionSimulationTooltip: React.FC<ExtractionSimulationTooltipPr
|
|||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
{extractors.length === 2 && (
|
||||||
|
<Paper sx={{ p: 1, bgcolor: 'background.default' }}>
|
||||||
|
<Typography variant="subtitle2" color="error">
|
||||||
|
Balance
|
||||||
|
</Typography>
|
||||||
|
<Stack spacing={0.5}>
|
||||||
|
{extractors.map((extractor, index) => {
|
||||||
|
const averagePerHour = (extractor.baseValue * 3600) / extractor.cycleTime;
|
||||||
|
return (
|
||||||
|
<Typography key={index} variant="body2">
|
||||||
|
• {PI_TYPES_MAP[extractor.typeId]?.name}: {averagePerHour.toFixed(1)} u/h
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
<Typography
|
||||||
|
variant="body2"
|
||||||
|
color="error"
|
||||||
|
sx={{
|
||||||
|
mt: 1,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
borderTop: '1px solid',
|
||||||
|
borderColor: 'divider',
|
||||||
|
pt: 1
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Difference: {Math.abs(
|
||||||
|
(extractors[0].baseValue * 3600 / extractors[0].cycleTime) -
|
||||||
|
(extractors[1].baseValue * 3600 / extractors[1].cycleTime)
|
||||||
|
).toFixed(1)} u/h
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
@@ -100,6 +100,21 @@ export const PlanetTableRow = ({
|
|||||||
factoryCount: schematic.count || 1
|
factoryCount: schematic.count || 1
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// Calculate extractor averages and check for large differences
|
||||||
|
const extractorAverages = extractors
|
||||||
|
.filter(e => e.extractor_details?.product_type_id && e.extractor_details?.qty_per_cycle)
|
||||||
|
.map(e => {
|
||||||
|
const cycleTime = e.extractor_details?.cycle_time || 3600;
|
||||||
|
const qtyPerCycle = e.extractor_details?.qty_per_cycle || 0;
|
||||||
|
return {
|
||||||
|
typeId: e.extractor_details!.product_type_id!,
|
||||||
|
averagePerHour: (qtyPerCycle * 3600) / cycleTime
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const hasLargeExtractorDifference = extractorAverages.length === 2 &&
|
||||||
|
Math.abs(extractorAverages[0].averagePerHour - extractorAverages[1].averagePerHour) > 1000;
|
||||||
|
|
||||||
const storageFacilities = planetInfo.pins.filter(pin =>
|
const storageFacilities = planetInfo.pins.filter(pin =>
|
||||||
STORAGE_IDS().some(storage => storage.type_id === pin.type_id)
|
STORAGE_IDS().some(storage => storage.type_id === pin.type_id)
|
||||||
);
|
);
|
||||||
@@ -189,9 +204,23 @@ export const PlanetTableRow = ({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography fontSize={theme.custom.smallText}>
|
<Stack spacing={0}>
|
||||||
|
<Typography
|
||||||
|
fontSize={theme.custom.smallText}
|
||||||
|
color={hasLargeExtractorDifference ? 'error' : 'inherit'}
|
||||||
|
>
|
||||||
{planetInfoUniverse?.name}
|
{planetInfoUniverse?.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
{hasLargeExtractorDifference && (
|
||||||
|
<Typography
|
||||||
|
fontSize={theme.custom.smallText}
|
||||||
|
color="error"
|
||||||
|
sx={{ opacity: 0.7 }}
|
||||||
|
>
|
||||||
|
off-balance
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@@ -415,10 +444,7 @@ export const PlanetTableRow = ({
|
|||||||
<TableCell colSpan={6} style={{ paddingBottom: 0, paddingTop: 0 }}>
|
<TableCell colSpan={6} style={{ paddingBottom: 0, paddingTop: 0 }}>
|
||||||
<Collapse in={simulationOpen} timeout="auto" unmountOnExit>
|
<Collapse in={simulationOpen} timeout="auto" unmountOnExit>
|
||||||
<Box sx={{ my: 2 }}>
|
<Box sx={{ my: 2 }}>
|
||||||
<Tooltip
|
<ExtractionSimulationDisplay
|
||||||
placement="right"
|
|
||||||
title={
|
|
||||||
<ExtractionSimulationTooltip
|
|
||||||
extractors={extractors
|
extractors={extractors
|
||||||
.filter(e => e.extractor_details?.product_type_id && e.extractor_details?.qty_per_cycle)
|
.filter(e => e.extractor_details?.product_type_id && e.extractor_details?.qty_per_cycle)
|
||||||
.map(e => ({
|
.map(e => ({
|
||||||
@@ -428,25 +454,8 @@ export const PlanetTableRow = ({
|
|||||||
installTime: e.install_time ?? "",
|
installTime: e.install_time ?? "",
|
||||||
expiryTime: e.expiry_time ?? ""
|
expiryTime: e.expiry_time ?? ""
|
||||||
}))}
|
}))}
|
||||||
|
productionNodes={productionNodes}
|
||||||
/>
|
/>
|
||||||
}
|
|
||||||
componentsProps={{
|
|
||||||
tooltip: {
|
|
||||||
sx: {
|
|
||||||
bgcolor: 'background.paper',
|
|
||||||
'& .MuiTooltip-arrow': {
|
|
||||||
color: 'background.paper',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<Typography fontSize={theme.custom.smallText}>
|
|
||||||
{planetInfoUniverse?.name}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</Tooltip>
|
|
||||||
</Box>
|
</Box>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
Reference in New Issue
Block a user