show extraction tooltip only if we have extractors

This commit is contained in:
calli
2025-04-23 15:23:32 +03:00
parent 0f33a7ff0c
commit f0d4708b43
2 changed files with 19 additions and 18 deletions

View File

@@ -102,9 +102,11 @@ export const PlanetCard = ({
return ( return (
<Tooltip <Tooltip
title={ title={
<ExtractionSimulationTooltip extractors.length > 0 ? (
extractors={extractors} <ExtractionSimulationTooltip
/> extractors={extractors}
/>
) : null
} }
componentsProps={{ componentsProps={{
tooltip: { tooltip: {

View File

@@ -165,11 +165,8 @@ export const PlanetTableRow = ({
} }
}} }}
onClick={(e) => { onClick={(e) => {
// Only trigger if clicking a cell with the clickable-cell class
if (!(e.target as HTMLElement).closest('.clickable-cell')) return; if (!(e.target as HTMLElement).closest('.clickable-cell')) return;
if (extractors.length > 0) { setSimulationOpen(!simulationOpen);
setSimulationOpen(!simulationOpen);
}
}} }}
> >
<TableCell component="th" scope="row" className="clickable-cell"> <TableCell component="th" scope="row" className="clickable-cell">
@@ -190,17 +187,19 @@ export const PlanetTableRow = ({
<Tooltip <Tooltip
placement="right" placement="right"
title={ title={
<ExtractionSimulationTooltip extractors.length > 0 ? (
extractors={extractors <ExtractionSimulationTooltip
.filter(e => e.extractor_details?.product_type_id && e.extractor_details?.qty_per_cycle) extractors={extractors
.map(e => ({ .filter(e => e.extractor_details?.product_type_id && e.extractor_details?.qty_per_cycle)
typeId: e.extractor_details!.product_type_id!, .map(e => ({
baseValue: e.extractor_details!.qty_per_cycle!, typeId: e.extractor_details!.product_type_id!,
cycleTime: e.extractor_details!.cycle_time || 3600, baseValue: e.extractor_details!.qty_per_cycle!,
installTime: e.install_time ?? "", cycleTime: e.extractor_details!.cycle_time || 3600,
expiryTime: e.expiry_time ?? "" installTime: e.install_time ?? "",
}))} expiryTime: e.expiry_time ?? ""
/> }))}
/>
) : null
} }
componentsProps={{ componentsProps={{
tooltip: { tooltip: {