From cc76765278269f91c3e96d1f7d1b569ac7cf6c24 Mon Sep 17 00:00:00 2001 From: calli Date: Fri, 2 May 2025 21:54:09 +0300 Subject: [PATCH] add a storage tooltip --- .../PlanetaryInteraction/PlanetTableRow.tsx | 128 ++++++++++++++---- 1 file changed, 105 insertions(+), 23 deletions(-) diff --git a/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx b/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx index befa908..88d9a0d 100644 --- a/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx +++ b/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx @@ -23,6 +23,9 @@ import { timeColor } from "./alerts"; import { ExtractionSimulationDisplay } from './ExtractionSimulationDisplay'; import { ExtractionSimulationTooltip } from './ExtractionSimulationTooltip'; import { Collapse, Box, Stack } from "@mui/material"; +import Table from "@mui/material/Table"; +import TableHead from "@mui/material/TableHead"; +import TableBody from "@mui/material/TableBody"; const Transition = forwardRef(function Transition( props: TransitionProps & { @@ -399,30 +402,109 @@ export const PlanetTableRow = ({ -
- {planetDetails.storageInfo.length === 0 &&No storage} - {planetDetails.storageInfo.map((storage: StorageInfo) => { - const isLaunchpad = LAUNCHPAD_IDS.includes(storage.type_id); - const fillRate = storage.fillRate; - const color = fillRate > 90 ? '#ff0000' : fillRate > 80 ? '#ffa500' : fillRate > 60 ? '#ffd700' : 'inherit'; - - return ( -
- - {isLaunchpad ? 'L' : 'S'} - - - {fillRate.toFixed(1)}% - - {storage.value > 0 && ( - - ({Math.round(storage.value / 1000000)}M) + + + Storage Facilities + + + + + Type + Capacity + Used + Fill Rate + Value + + + + {planetDetails.storageInfo.map((storage: StorageInfo) => { + const isLaunchpad = LAUNCHPAD_IDS.includes(storage.type_id); + const fillRate = storage.fillRate; + const color = fillRate > 90 ? '#ff0000' : fillRate > 80 ? '#ffa500' : fillRate > 60 ? '#ffd700' : 'inherit'; + const contents = planet.info.pins.find(p => p.type_id === storage.type_id)?.contents || []; + + return ( + + + {isLaunchpad ? 'Launchpad' : 'Storage'} + {storage.capacity.toFixed(1)} m³ + {storage.used.toFixed(1)} m³ + {fillRate.toFixed(1)}% + + {storage.value > 0 ? ( + storage.value >= 1000000000 + ? `${(storage.value / 1000000000).toFixed(2)} B` + : `${(storage.value / 1000000).toFixed(0)} M` + ) : '-'} ISK + + + {contents.length > 0 && ( + + +
+ + {contents.map(content => ( + + + {PI_TYPES_MAP[content.type_id]?.name} + + + {content.amount.toFixed(1)} units + + + ))} + +
+ + + )} + + ); + })} + + + + } + componentsProps={{ + tooltip: { + sx: { + bgcolor: 'background.paper', + '& .MuiTooltip-arrow': { + color: 'background.paper', + }, + maxWidth: 'none', + width: 'fit-content' + } + } + }} + > +
+ {planetDetails.storageInfo.length === 0 &&No storage} + {planetDetails.storageInfo.map((storage: StorageInfo) => { + const isLaunchpad = LAUNCHPAD_IDS.includes(storage.type_id); + const fillRate = storage.fillRate; + const color = fillRate > 90 ? '#ff0000' : fillRate > 80 ? '#ffa500' : fillRate > 60 ? '#ffd700' : 'inherit'; + + return ( +
+ + {isLaunchpad ? 'L' : 'S'} - )} -
- ); - })} -
+ + {fillRate.toFixed(1)}% + + {storage.value > 0 && ( + + ({Math.round(storage.value / 1000000)}M) + + )} +
+ ); + })} +
+