Sort storages
This commit is contained in:
@@ -418,8 +418,13 @@ export const PlanetTableRow = ({
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{planetDetails.storageInfo.map((storage: StorageInfo, idx: number) => {
|
||||
const isLaunchpad = LAUNCHPAD_IDS.includes(storage.type_id);
|
||||
{planetDetails.storageInfo
|
||||
.map(storage => ({
|
||||
...storage,
|
||||
isLaunchpad: LAUNCHPAD_IDS.includes(storage.type_id)
|
||||
}))
|
||||
.sort((a, b) => (b.isLaunchpad ? 1 : 0) - (a.isLaunchpad ? 1 : 0))
|
||||
.map((storage, idx) => {
|
||||
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 || [];
|
||||
@@ -427,7 +432,7 @@ export const PlanetTableRow = ({
|
||||
return (
|
||||
<React.Fragment key={`storage-${character.character.characterId}-${planet.planet_id}-${storage.type}-${idx}`}>
|
||||
<TableRow>
|
||||
<TableCell>{isLaunchpad ? 'Launchpad' : 'Storage'}</TableCell>
|
||||
<TableCell>{storage.isLaunchpad ? 'Launchpad' : 'Storage'}</TableCell>
|
||||
<TableCell align="right">{storage.capacity.toFixed(1)} m³</TableCell>
|
||||
<TableCell align="right">{storage.used.toFixed(1)} m³</TableCell>
|
||||
<TableCell align="right" sx={{ color }}>{fillRate.toFixed(1)}%</TableCell>
|
||||
@@ -481,15 +486,20 @@ export const PlanetTableRow = ({
|
||||
>
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{planetDetails.storageInfo.length === 0 &&<Typography fontSize={theme.custom.smallText}>No storage</Typography>}
|
||||
{planetDetails.storageInfo.map((storage: StorageInfo, idx: number) => {
|
||||
const isLaunchpad = LAUNCHPAD_IDS.includes(storage.type_id);
|
||||
{planetDetails.storageInfo
|
||||
.map(storage => ({
|
||||
...storage,
|
||||
isLaunchpad: LAUNCHPAD_IDS.includes(storage.type_id)
|
||||
}))
|
||||
.sort((a, b) => (b.isLaunchpad ? 1 : 0) - (a.isLaunchpad ? 1 : 0))
|
||||
.map((storage, idx) => {
|
||||
const fillRate = storage.fillRate;
|
||||
const color = fillRate > 90 ? '#ff0000' : fillRate > 80 ? '#ffa500' : fillRate > 60 ? '#ffd700' : 'inherit';
|
||||
|
||||
return (
|
||||
<div key={`storage-${character.character.characterId}-${planet.planet_id}-${storage.type}-${idx}`} style={{ display: "flex", alignItems: "center" }}>
|
||||
<Typography fontSize={theme.custom.smallText} style={{ marginRight: "5px" }}>
|
||||
{isLaunchpad ? 'L' : 'S'}
|
||||
{storage.isLaunchpad ? 'L' : 'S'}
|
||||
</Typography>
|
||||
<Typography fontSize={theme.custom.smallText} style={{ color }}>
|
||||
{fillRate.toFixed(1)}%
|
||||
|
Reference in New Issue
Block a user