mirror of
https://github.com/calli-eve/eve-pi.git
synced 2026-02-12 02:38:48 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b185e5d044 | ||
|
|
f0d4708b43 | ||
|
|
0f33a7ff0c | ||
|
|
bbdcece163 | ||
|
|
2a1e74ca79 | ||
|
|
0e141321b6 | ||
|
|
d433f5420e | ||
|
|
fa5f79068f | ||
|
|
c07dba3afc | ||
|
|
a871bac35f | ||
|
|
eca35f51ac | ||
|
|
9e9ab359ec | ||
|
|
1fc0efd3da |
@@ -43,11 +43,6 @@ module.exports = withSentryConfig(
|
||||
// Transpiles SDK to be compatible with IE11 (increases bundle size)
|
||||
transpileClientSDK: true,
|
||||
|
||||
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
|
||||
// This can increase your server load as well as your hosting bill.
|
||||
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
|
||||
// side errors will fail.
|
||||
tunnelRoute: "/monitoring",
|
||||
|
||||
// Hides source maps from generated client bundles
|
||||
hideSourceMaps: true,
|
||||
|
||||
32
package-lock.json
generated
32
package-lock.json
generated
@@ -22,7 +22,7 @@
|
||||
"chart.js": "^4.4.7",
|
||||
"crypto-js": "^4.1.1",
|
||||
"eslint": "8.42.0",
|
||||
"luxon": "^3.3.0",
|
||||
"luxon": "^3.6.1",
|
||||
"next": "^14.2.23",
|
||||
"next-plausible": "^3.12.0",
|
||||
"react": "^18.3.1",
|
||||
@@ -37,7 +37,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/luxon": "^3.3.0",
|
||||
"@types/luxon": "^3.6.1",
|
||||
"@types/react-color": "^3.0.7",
|
||||
"@types/three": "^0.152.1",
|
||||
"eslint-config-next": "^14.2.23",
|
||||
@@ -2516,10 +2516,11 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/luxon": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.3.0.tgz",
|
||||
"integrity": "sha512-uKRI5QORDnrGFYgcdAVnHvEIvEZ8noTpP/Bg+HeUzZghwinDlIS87DEenV5r1YoOF9G4x600YsUXLWZ19rmTmg==",
|
||||
"dev": true
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.6.1.tgz",
|
||||
"integrity": "sha512-GEo4k1yY5PBaPLqEbk+vp2LhVCKPa/TQlTjuCf3exvx6fjB+jVuDa/Zopi8eznEkJf8yeZRzSK/kzG14g5aXPQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/mysql": {
|
||||
"version": "2.15.26",
|
||||
@@ -6459,9 +6460,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/luxon": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.3.0.tgz",
|
||||
"integrity": "sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg==",
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.6.1.tgz",
|
||||
"integrity": "sha512-tJLxrKJhO2ukZ5z0gyjY1zPh3Rh88Ej9P7jNrZiHMUXHae1yvI2imgOZtL1TO8TW6biMMKfTtAOoEJANgtWBMQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -10963,9 +10965,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/luxon": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.3.0.tgz",
|
||||
"integrity": "sha512-uKRI5QORDnrGFYgcdAVnHvEIvEZ8noTpP/Bg+HeUzZghwinDlIS87DEenV5r1YoOF9G4x600YsUXLWZ19rmTmg==",
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.6.1.tgz",
|
||||
"integrity": "sha512-GEo4k1yY5PBaPLqEbk+vp2LhVCKPa/TQlTjuCf3exvx6fjB+jVuDa/Zopi8eznEkJf8yeZRzSK/kzG14g5aXPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/mysql": {
|
||||
@@ -13688,9 +13690,9 @@
|
||||
}
|
||||
},
|
||||
"luxon": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.3.0.tgz",
|
||||
"integrity": "sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg=="
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.6.1.tgz",
|
||||
"integrity": "sha512-tJLxrKJhO2ukZ5z0gyjY1zPh3Rh88Ej9P7jNrZiHMUXHae1yvI2imgOZtL1TO8TW6biMMKfTtAOoEJANgtWBMQ=="
|
||||
},
|
||||
"magic-string": {
|
||||
"version": "0.30.17",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"chart.js": "^4.4.7",
|
||||
"crypto-js": "^4.1.1",
|
||||
"eslint": "8.42.0",
|
||||
"luxon": "^3.3.0",
|
||||
"luxon": "^3.6.1",
|
||||
"next": "^14.2.23",
|
||||
"next-plausible": "^3.12.0",
|
||||
"react": "^18.3.1",
|
||||
@@ -39,7 +39,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/luxon": "^3.3.0",
|
||||
"@types/luxon": "^3.6.1",
|
||||
"@types/react-color": "^3.0.7",
|
||||
"@types/three": "^0.152.1",
|
||||
"eslint-config-next": "^14.2.23",
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Box, Stack, Typography, useTheme, Paper, IconButton } from "@mui/materi
|
||||
import { CharacterRow } from "../Characters/CharacterRow";
|
||||
import { PlanetaryInteractionRow } from "../PlanetaryInteraction/PlanetaryInteractionRow";
|
||||
import { SessionContext } from "@/app/context/Context";
|
||||
import { useContext, useState } from "react";
|
||||
import { useContext, useState, useEffect } from "react";
|
||||
import { PlanRow } from "./PlanRow";
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
|
||||
@@ -60,12 +60,17 @@ const calculateAccountTotals = (characters: AccessToken[], piPrices: EvePraisalR
|
||||
};
|
||||
};
|
||||
|
||||
export const AccountCard = ({ characters }: { characters: AccessToken[] }) => {
|
||||
export const AccountCard = ({ characters, isCollapsed: propIsCollapsed }: { characters: AccessToken[], isCollapsed?: boolean }) => {
|
||||
const theme = useTheme();
|
||||
const [isCollapsed, setIsCollapsed] = useState(false);
|
||||
const [localIsCollapsed, setLocalIsCollapsed] = useState(false);
|
||||
const { planMode, piPrices } = useContext(SessionContext);
|
||||
const { monthlyEstimate, storageValue } = calculateAccountTotals(characters, piPrices);
|
||||
|
||||
// Update local collapse state when prop changes
|
||||
useEffect(() => {
|
||||
setLocalIsCollapsed(propIsCollapsed ?? false);
|
||||
}, [propIsCollapsed]);
|
||||
|
||||
return (
|
||||
<Paper
|
||||
elevation={2}
|
||||
@@ -134,16 +139,16 @@ export const AccountCard = ({ characters }: { characters: AccessToken[] }) => {
|
||||
</Box>
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={() => setIsCollapsed(!isCollapsed)}
|
||||
onClick={() => setLocalIsCollapsed(!localIsCollapsed)}
|
||||
sx={{
|
||||
transform: isCollapsed ? 'rotate(-90deg)' : 'rotate(0deg)',
|
||||
transform: localIsCollapsed ? 'rotate(-90deg)' : 'rotate(0deg)',
|
||||
transition: 'transform 0.2s ease-in-out'
|
||||
}}
|
||||
>
|
||||
{isCollapsed ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
|
||||
{localIsCollapsed ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
|
||||
</IconButton>
|
||||
</Box>
|
||||
{!isCollapsed && characters.map((c) => (
|
||||
{!localIsCollapsed && characters.map((c) => (
|
||||
<Stack
|
||||
key={c.character.characterId}
|
||||
direction="row"
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
Grid,
|
||||
ThemeProvider,
|
||||
createTheme,
|
||||
Button,
|
||||
} from "@mui/material";
|
||||
import { AccountCard } from "./Account/AccountCard";
|
||||
import { AccessToken } from "@/types";
|
||||
@@ -12,6 +13,8 @@ import { CharacterContext, SessionContext } from "../context/Context";
|
||||
import ResponsiveAppBar from "./AppBar/AppBar";
|
||||
import { Summary } from "./Summary/Summary";
|
||||
import { DragDropContext, Droppable, Draggable, DropResult } from "@hello-pangea/dnd";
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
|
||||
|
||||
interface Grouped {
|
||||
[key: string]: AccessToken[];
|
||||
@@ -41,6 +44,7 @@ declare module "@mui/material/styles" {
|
||||
export const MainGrid = () => {
|
||||
const { characters, updateCharacter } = useContext(CharacterContext);
|
||||
const [accountOrder, setAccountOrder] = useState<string[]>([]);
|
||||
const [allCollapsed, setAllCollapsed] = useState(false);
|
||||
|
||||
// Initialize account order when characters change
|
||||
useEffect(() => {
|
||||
@@ -134,6 +138,15 @@ export const MainGrid = () => {
|
||||
<Box sx={{ flexGrow: 1 }}>
|
||||
<ResponsiveAppBar />
|
||||
{compactMode ? <></> : <Summary characters={characters} />}
|
||||
<Box sx={{ display: 'flex', justifyContent: 'flex-start', padding: 1 }}>
|
||||
<Button
|
||||
startIcon={allCollapsed ? <KeyboardArrowDownIcon /> : <KeyboardArrowUpIcon />}
|
||||
onClick={() => setAllCollapsed(!allCollapsed)}
|
||||
size="small"
|
||||
>
|
||||
{allCollapsed ? 'Expand All' : 'Collapse All'}
|
||||
</Button>
|
||||
</Box>
|
||||
<DragDropContextComponent onDragEnd={handleDragEnd}>
|
||||
<DroppableComponent droppableId="accounts">
|
||||
{(provided: any) => (
|
||||
@@ -165,7 +178,10 @@ export const MainGrid = () => {
|
||||
}}
|
||||
>
|
||||
{groupByAccount[account] && groupByAccount[account].length > 0 && (
|
||||
<AccountCard characters={groupByAccount[account]} />
|
||||
<AccountCard
|
||||
characters={groupByAccount[account]}
|
||||
isCollapsed={allCollapsed}
|
||||
/>
|
||||
)}
|
||||
</Grid>
|
||||
)}
|
||||
|
||||
@@ -170,7 +170,7 @@ export const ExtractionSimulationDisplay: React.FC<ExtractionSimulationDisplayPr
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Paper sx={{ p: 2 }}>
|
||||
{extractors.length > 0 ? <Paper sx={{ p: 2 }}>
|
||||
<Typography variant="h6" gutterBottom>
|
||||
Extraction Simulation
|
||||
</Typography>
|
||||
@@ -210,7 +210,7 @@ export const ExtractionSimulationDisplay: React.FC<ExtractionSimulationDisplayPr
|
||||
<div style={{ height: '300px' }}>
|
||||
<Line data={chartData} options={chartOptions} />
|
||||
</div>
|
||||
</Paper>
|
||||
</Paper> : null}
|
||||
|
||||
<ProductionChainVisualization
|
||||
extractedTypeIds={extractedTypeIds}
|
||||
|
||||
@@ -133,9 +133,9 @@ export const ExtractionSimulationTooltip: React.FC<ExtractionSimulationTooltipPr
|
||||
</Box>
|
||||
<Box sx={{ flex: 1, minWidth: 0 }}>
|
||||
<Stack spacing={1}>
|
||||
{extractorPrograms.map(({ typeId, cycleTime, cycles, installTime, expiryTime }) => {
|
||||
{extractorPrograms.map(({ typeId, cycleTime, cycles, installTime, expiryTime }, idx) => {
|
||||
const prediction = getProgramOutputPrediction(
|
||||
extractors.find(e => e.typeId === typeId)?.baseValue || 0,
|
||||
extractors[idx].baseValue,
|
||||
CYCLE_TIME,
|
||||
cycles
|
||||
);
|
||||
@@ -159,6 +159,9 @@ export const ExtractionSimulationTooltip: React.FC<ExtractionSimulationTooltipPr
|
||||
<Typography variant="body2">
|
||||
• Average per Cycle: {(totalOutput / cycles).toFixed(1)} units
|
||||
</Typography>
|
||||
<Typography variant="body2">
|
||||
• Average per hour: {(totalOutput / cycles * 2).toFixed(1)} units
|
||||
</Typography>
|
||||
<Typography variant="body2">
|
||||
• Expires in: <Countdown overtime={true} date={DateTime.fromISO(expiryTime).toMillis()} />
|
||||
</Typography>
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
import { Stack, Typography, styled, useTheme } from "@mui/material";
|
||||
import { Stack, Typography, styled, useTheme, Tooltip } from "@mui/material";
|
||||
import Image from "next/image";
|
||||
import {
|
||||
AccessToken,
|
||||
Planet,
|
||||
PlanetInfo,
|
||||
PlanetInfoUniverse,
|
||||
PlanetWithInfo,
|
||||
} from "@/types";
|
||||
import React, { forwardRef, useContext, useEffect, useState } from "react";
|
||||
import React, { useContext } from "react";
|
||||
import { DateTime } from "luxon";
|
||||
import { EXTRACTOR_TYPE_IDS } from "@/const";
|
||||
import Countdown from "react-countdown";
|
||||
import PinsCanvas3D from "./PinsCanvas3D";
|
||||
import Slide from "@mui/material/Slide";
|
||||
import { TransitionProps } from "@mui/material/transitions";
|
||||
import Dialog from "@mui/material/Dialog";
|
||||
import AppBar from "@mui/material/AppBar";
|
||||
import Toolbar from "@mui/material/Toolbar";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import Button from "@mui/material/Button";
|
||||
import { getProgramOutputPrediction } from "./ExtractionSimulation";
|
||||
import {
|
||||
alertModeVisibility,
|
||||
extractorsHaveExpired,
|
||||
timeColor,
|
||||
} from "./timeColors";
|
||||
import { ColorContext, SessionContext } from "@/app/context/Context";
|
||||
import { ExtractionSimulationTooltip } from "./ExtractionSimulationTooltip";
|
||||
|
||||
const StackItem = styled(Stack)(({ theme }) => ({
|
||||
...theme.typography.body2,
|
||||
@@ -36,15 +26,6 @@ const StackItem = styled(Stack)(({ theme }) => ({
|
||||
alignItems: "center",
|
||||
}));
|
||||
|
||||
const Transition = forwardRef(function Transition(
|
||||
props: TransitionProps & {
|
||||
children: React.ReactElement;
|
||||
},
|
||||
ref: React.Ref<unknown>,
|
||||
) {
|
||||
return <Slide direction="up" ref={ref} {...props} />;
|
||||
});
|
||||
|
||||
export const PlanetCard = ({
|
||||
character,
|
||||
planet,
|
||||
@@ -57,18 +38,8 @@ export const PlanetCard = ({
|
||||
const planetInfo = planet.info;
|
||||
const planetInfoUniverse = planet.infoUniverse;
|
||||
|
||||
const [planetRenderOpen, setPlanetRenderOpen] = useState(false);
|
||||
|
||||
const theme = useTheme();
|
||||
|
||||
const handle3DrenderOpen = () => {
|
||||
setPlanetRenderOpen(true);
|
||||
};
|
||||
|
||||
const handle3DrenderClose = () => {
|
||||
setPlanetRenderOpen(false);
|
||||
};
|
||||
|
||||
const extractorsExpiryTime =
|
||||
(planetInfo &&
|
||||
planetInfo.pins
|
||||
@@ -79,7 +50,77 @@ export const PlanetCard = ({
|
||||
const { colors } = useContext(ColorContext);
|
||||
const expired = extractorsHaveExpired(extractorsExpiryTime);
|
||||
|
||||
const CYCLE_TIME = 30 * 60; // 30 minutes in seconds
|
||||
|
||||
const extractors = planetInfo?.pins
|
||||
.filter((p) => EXTRACTOR_TYPE_IDS.some((e) => e === p.type_id))
|
||||
.map((p) => ({
|
||||
typeId: p.type_id,
|
||||
baseValue: p.extractor_details?.qty_per_cycle || 0,
|
||||
cycleTime: p.extractor_details?.cycle_time || 3600,
|
||||
installTime: p.install_time || "",
|
||||
expiryTime: p.expiry_time || "",
|
||||
installedSchematicId: p.extractor_details?.product_type_id || undefined
|
||||
})) || [];
|
||||
|
||||
// Calculate program duration and cycles for each extractor
|
||||
const extractorPrograms = extractors.map(extractor => {
|
||||
const installDate = new Date(extractor.installTime);
|
||||
const expiryDate = new Date(extractor.expiryTime);
|
||||
const programDuration = (expiryDate.getTime() - installDate.getTime()) / 1000; // Convert to seconds
|
||||
return {
|
||||
...extractor,
|
||||
programDuration,
|
||||
cycles: Math.floor(programDuration / CYCLE_TIME)
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
// Get output predictions for each extractor
|
||||
const extractorOutputs = extractorPrograms.map(extractor => ({
|
||||
typeId: extractor.typeId,
|
||||
cycleTime: CYCLE_TIME,
|
||||
cycles: extractor.cycles,
|
||||
prediction: getProgramOutputPrediction(
|
||||
extractor.baseValue,
|
||||
CYCLE_TIME,
|
||||
extractor.cycles
|
||||
)
|
||||
}));
|
||||
|
||||
// Calculate average per hour for each extractor
|
||||
const extractorAverages = extractorOutputs.map(extractor => {
|
||||
const totalOutput = extractor.prediction.reduce((sum, val) => sum + val, 0);
|
||||
const programDuration = extractor.cycles * CYCLE_TIME;
|
||||
const averagePerHour = (totalOutput / programDuration) * 3600;
|
||||
return {
|
||||
typeId: extractor.typeId,
|
||||
averagePerHour
|
||||
};
|
||||
});
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
title={
|
||||
extractors.length > 0 ? (
|
||||
<ExtractionSimulationTooltip
|
||||
extractors={extractors}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
componentsProps={{
|
||||
tooltip: {
|
||||
sx: {
|
||||
bgcolor: 'background.paper',
|
||||
'& .MuiTooltip-arrow': {
|
||||
color: 'background.paper',
|
||||
},
|
||||
maxWidth: 'none',
|
||||
width: 'fit-content'
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<StackItem
|
||||
alignItems="flex-start"
|
||||
height="100%"
|
||||
@@ -87,15 +128,32 @@ export const PlanetCard = ({
|
||||
minHeight={theme.custom.cardMinHeight}
|
||||
visibility={alertModeVisibility(alertMode, expired)}
|
||||
>
|
||||
<Image
|
||||
unoptimized
|
||||
src={`/${planet.planet_type}.png`}
|
||||
alt=""
|
||||
width={theme.custom.cardImageSize}
|
||||
height={theme.custom.cardImageSize}
|
||||
style={{ borderRadius: 8, marginRight: 4 }}
|
||||
onClick={handle3DrenderOpen}
|
||||
/>
|
||||
|
||||
<div style={{ position: 'relative' }}>
|
||||
<Image
|
||||
unoptimized
|
||||
src={`/${planet.planet_type}.png`}
|
||||
alt=""
|
||||
width={theme.custom.cardImageSize}
|
||||
height={theme.custom.cardImageSize}
|
||||
style={{
|
||||
borderRadius: 8,
|
||||
marginRight: 4,
|
||||
position: 'relative',
|
||||
zIndex: 0
|
||||
}}
|
||||
/>
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: theme.custom.cardImageSize,
|
||||
height: theme.custom.cardImageSize,
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
||||
borderRadius: 8,
|
||||
}} />
|
||||
</div>
|
||||
|
||||
{expired && (
|
||||
<Image
|
||||
width={32}
|
||||
@@ -109,55 +167,41 @@ export const PlanetCard = ({
|
||||
<Typography fontSize={theme.custom.smallText}>
|
||||
{planetInfoUniverse?.name}
|
||||
</Typography>
|
||||
<Typography fontSize={theme.custom.smallText}>
|
||||
L{planet.upgrade_level}
|
||||
</Typography>
|
||||
{extractorsExpiryTime.map((e, idx) => {
|
||||
const extractor = extractors[idx];
|
||||
const average = extractorAverages[idx];
|
||||
return (
|
||||
<div key={`${e}-${idx}-${character.character.characterId}`}>
|
||||
<Typography
|
||||
color={timeColor(e, colors)}
|
||||
fontSize={theme.custom.smallText}
|
||||
>
|
||||
{!expired && e && <Countdown
|
||||
overtime={true}
|
||||
date={DateTime.fromISO(e).toMillis()}
|
||||
/>
|
||||
}
|
||||
</Typography>
|
||||
{!expired && extractor && average && (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
|
||||
<Image
|
||||
unoptimized
|
||||
src={`https://images.evetech.net/types/${extractor.installedSchematicId}/icon?size=32`}
|
||||
alt=""
|
||||
width={16}
|
||||
height={16}
|
||||
style={{ borderRadius: 4 }}
|
||||
/>
|
||||
<Typography fontSize={theme.custom.smallText}>
|
||||
{average.averagePerHour.toFixed(1)}/h
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{extractorsExpiryTime.map((e, idx) => {
|
||||
return (
|
||||
<Typography
|
||||
key={`${e}-${idx}-${character.character.characterId}`}
|
||||
color={timeColor(e, colors)}
|
||||
fontSize={theme.custom.smallText}
|
||||
>
|
||||
{e ? (
|
||||
<Countdown
|
||||
overtime={true}
|
||||
date={DateTime.fromISO(e).toMillis()}
|
||||
/>
|
||||
) : (
|
||||
"STOPPED"
|
||||
)}
|
||||
</Typography>
|
||||
);
|
||||
})}
|
||||
<Dialog
|
||||
fullScreen
|
||||
open={planetRenderOpen}
|
||||
onClose={handle3DrenderClose}
|
||||
TransitionComponent={Transition}
|
||||
>
|
||||
<AppBar sx={{ position: "relative" }}>
|
||||
<Toolbar>
|
||||
<IconButton
|
||||
edge="start"
|
||||
color="inherit"
|
||||
onClick={handle3DrenderClose}
|
||||
aria-label="close"
|
||||
>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
<Typography sx={{ ml: 2, flex: 1 }} variant="h6" component="div">
|
||||
{planetInfoUniverse?.name}
|
||||
</Typography>
|
||||
<Button autoFocus color="inherit" onClick={handle3DrenderClose}>
|
||||
Close
|
||||
</Button>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
<PinsCanvas3D planetInfo={planetInfo} />
|
||||
</Dialog>
|
||||
</StackItem>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -23,8 +23,6 @@ import { ExtractionSimulationDisplay } from './ExtractionSimulationDisplay';
|
||||
import { ExtractionSimulationTooltip } from './ExtractionSimulationTooltip';
|
||||
import { ProductionNode } from './ExtractionSimulation';
|
||||
import { Collapse, Box, Stack } from "@mui/material";
|
||||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
||||
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
|
||||
|
||||
const Transition = forwardRef(function Transition(
|
||||
props: TransitionProps & {
|
||||
@@ -159,9 +157,19 @@ export const PlanetTableRow = ({
|
||||
<>
|
||||
<TableRow
|
||||
style={{ visibility: alertModeVisibility(alertMode, expired) }}
|
||||
sx={{ "&:last-child td, &:last-child th": { border: 0 } }}
|
||||
sx={{
|
||||
"&:last-child td, &:last-child th": { border: 0 },
|
||||
cursor: 'pointer',
|
||||
'&:hover': {
|
||||
backgroundColor: 'action.hover'
|
||||
}
|
||||
}}
|
||||
onClick={(e) => {
|
||||
if (!(e.target as HTMLElement).closest('.clickable-cell')) return;
|
||||
setSimulationOpen(!simulationOpen);
|
||||
}}
|
||||
>
|
||||
<TableCell component="th" scope="row">
|
||||
<TableCell component="th" scope="row" className="clickable-cell">
|
||||
<Tooltip
|
||||
title={`${
|
||||
planet.planet_type.charAt(0).toUpperCase() +
|
||||
@@ -179,17 +187,19 @@ export const PlanetTableRow = ({
|
||||
<Tooltip
|
||||
placement="right"
|
||||
title={
|
||||
<ExtractionSimulationTooltip
|
||||
extractors={extractors
|
||||
.filter(e => e.extractor_details?.product_type_id && e.extractor_details?.qty_per_cycle)
|
||||
.map(e => ({
|
||||
typeId: e.extractor_details!.product_type_id!,
|
||||
baseValue: e.extractor_details!.qty_per_cycle!,
|
||||
cycleTime: e.extractor_details!.cycle_time || 3600,
|
||||
installTime: e.install_time ?? "",
|
||||
expiryTime: e.expiry_time ?? ""
|
||||
}))}
|
||||
/>
|
||||
extractors.length > 0 ? (
|
||||
<ExtractionSimulationTooltip
|
||||
extractors={extractors
|
||||
.filter(e => e.extractor_details?.product_type_id && e.extractor_details?.qty_per_cycle)
|
||||
.map(e => ({
|
||||
typeId: e.extractor_details!.product_type_id!,
|
||||
baseValue: e.extractor_details!.qty_per_cycle!,
|
||||
cycleTime: e.extractor_details!.cycle_time || 3600,
|
||||
installTime: e.install_time ?? "",
|
||||
expiryTime: e.expiry_time ?? ""
|
||||
}))}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
componentsProps={{
|
||||
tooltip: {
|
||||
@@ -225,8 +235,8 @@ export const PlanetTableRow = ({
|
||||
</div>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell>{planet.upgrade_level}</TableCell>
|
||||
<TableCell>
|
||||
<TableCell className="clickable-cell">{planet.upgrade_level}</TableCell>
|
||||
<TableCell className="clickable-cell">
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{extractors.map((e, idx) => {
|
||||
return (
|
||||
@@ -259,7 +269,7 @@ export const PlanetTableRow = ({
|
||||
})}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<TableCell className="clickable-cell">
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{Array.from(localProduction).map((schematic, idx) => {
|
||||
return (
|
||||
@@ -273,19 +283,19 @@ export const PlanetTableRow = ({
|
||||
})}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<TableCell className="clickable-cell">
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{localImports.map((i) => (
|
||||
<Typography
|
||||
key={`import-${character.character.characterId}-${planet.planet_id}-${i.type_id}`}
|
||||
fontSize={theme.custom.smallText}
|
||||
>
|
||||
{PI_TYPES_MAP[i.type_id].name} ({i.quantity}/h)
|
||||
{PI_TYPES_MAP[i.type_id].name} ({i.quantity * i.factoryCount}/h)
|
||||
</Typography>
|
||||
))}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<TableCell className="clickable-cell">
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{localExports.map((exports) => (
|
||||
<Typography
|
||||
@@ -314,7 +324,7 @@ export const PlanetTableRow = ({
|
||||
))}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<TableCell className="clickable-cell">
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{localExports.map((exports) => (
|
||||
<Typography
|
||||
@@ -326,7 +336,7 @@ export const PlanetTableRow = ({
|
||||
))}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<TableCell className="clickable-cell">
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
@@ -359,7 +369,7 @@ export const PlanetTableRow = ({
|
||||
})}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<TableCell className="clickable-cell">
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{storageFacilities
|
||||
.sort((a, b) => {
|
||||
@@ -401,7 +411,7 @@ export const PlanetTableRow = ({
|
||||
})}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<TableCell className="menu-cell">
|
||||
<IconButton
|
||||
aria-label="more"
|
||||
aria-controls="planet-menu"
|
||||
@@ -423,14 +433,6 @@ export const PlanetTableRow = ({
|
||||
}}>
|
||||
Configure Planet
|
||||
</MenuItem>
|
||||
{extractors.length > 0 && (
|
||||
<MenuItem onClick={() => {
|
||||
setSimulationOpen(!simulationOpen);
|
||||
handleMenuClose();
|
||||
}}>
|
||||
{simulationOpen ? 'Hide Extraction Simulation' : 'Show Extraction Simulation'}
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem onClick={() => {
|
||||
handle3DrenderOpen();
|
||||
handleMenuClose();
|
||||
@@ -441,7 +443,7 @@ export const PlanetTableRow = ({
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell colSpan={6} style={{ paddingBottom: 0, paddingTop: 0 }}>
|
||||
<TableCell colSpan={6} style={{ paddingBottom: 0, paddingTop: 0, border: 'none' }}>
|
||||
<Collapse in={simulationOpen} timeout="auto" unmountOnExit>
|
||||
<Box sx={{ my: 2 }}>
|
||||
<ExtractionSimulationDisplay
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AccessToken } from "@/types";
|
||||
import { Stack, Tooltip, Typography, styled, useTheme } from "@mui/material";
|
||||
import { Icon, IconButton, Stack, Tooltip, Typography, styled, useTheme } from "@mui/material";
|
||||
import { PlanetCard } from "./PlanetCard";
|
||||
import { NoPlanetCard } from "./NoPlanetCard";
|
||||
import Table from "@mui/material/Table";
|
||||
@@ -10,7 +10,7 @@ import TableHead from "@mui/material/TableHead";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import { PlanetTableRow } from "./PlanetTableRow";
|
||||
import Image from "next/image";
|
||||
import { Settings } from "@mui/icons-material";
|
||||
|
||||
const StackItem = styled(Stack)(({ theme }) => ({
|
||||
...theme.typography.body2,
|
||||
@@ -102,6 +102,13 @@ const PlanetaryIteractionTable = ({
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Tooltip title="Planet settings">
|
||||
<IconButton aria-label="settings">
|
||||
<Settings fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React from 'react';
|
||||
import { Box, Paper, Typography, Grid, Stack, Divider, Tooltip } from '@mui/material';
|
||||
import { Box, Paper, Typography, Grid, Stack } from '@mui/material';
|
||||
import { EVE_IMAGE_URL } from '@/const';
|
||||
import { PI_TYPES_MAP } from '@/const';
|
||||
import { DateTime } from 'luxon';
|
||||
import Countdown from 'react-countdown';
|
||||
import Image from 'next/image';
|
||||
|
||||
interface Factory {
|
||||
schematic_id: number;
|
||||
@@ -291,7 +292,7 @@ export const ProductionChainVisualization: React.FC<ProductionChainVisualization
|
||||
}}
|
||||
>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
|
||||
<img
|
||||
<Image
|
||||
src={`${EVE_IMAGE_URL}/types/${typeId}/icon`}
|
||||
alt={type?.name ?? `Type ${typeId}`}
|
||||
width={48}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SessionContext } from "@/app/context/Context";
|
||||
import { PI_TYPES_MAP } from "@/const";
|
||||
import { PI_TYPES_MAP, STORAGE_IDS } from "@/const";
|
||||
import { planetCalculations } from "@/planets";
|
||||
import { AccessToken } from "@/types";
|
||||
import {
|
||||
@@ -19,10 +19,12 @@ import {
|
||||
AccordionSummary,
|
||||
AccordionDetails,
|
||||
TableSortLabel,
|
||||
Box,
|
||||
TextField,
|
||||
} from "@mui/material";
|
||||
import { useContext, useState } from "react";
|
||||
import { useContext, useState, useEffect } from "react";
|
||||
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
||||
import { argv0 } from "process";
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
const StackItem = styled(Stack)(({ theme }) => ({
|
||||
...theme.typography.body2,
|
||||
@@ -41,13 +43,39 @@ const displayValue = (valueInMillions: number): string =>
|
||||
? `${(valueInMillions / 1000).toFixed(2)} B`
|
||||
: `${valueInMillions.toFixed(2)} M`;
|
||||
|
||||
type SortBy = "name" | "perHour" | "price";
|
||||
type SortBy = "name" | "perHour" | "storage" | "price" | "storagePrice" | "progress";
|
||||
type SortDirection = "asc" | "desc";
|
||||
|
||||
export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
const { piPrices } = useContext(SessionContext);
|
||||
const [sortDirection, setSortDirection] = useState<SortDirection>("asc");
|
||||
const [sortBy, setSortBy] = useState<SortBy>("name");
|
||||
const [startDate, setStartDate] = useState<string>(DateTime.now().startOf('day').toISO());
|
||||
const [activityPercentage, setActivityPercentage] = useState<number>(100);
|
||||
|
||||
// Load saved values from localStorage on mount
|
||||
useEffect(() => {
|
||||
const savedDate = localStorage.getItem('productionStartDate');
|
||||
if (savedDate) {
|
||||
setStartDate(savedDate);
|
||||
}
|
||||
|
||||
const savedActivity = localStorage.getItem('activityPercentage');
|
||||
if (savedActivity) {
|
||||
setActivityPercentage(parseFloat(savedActivity));
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Save values to localStorage when they change
|
||||
useEffect(() => {
|
||||
localStorage.setItem('productionStartDate', startDate);
|
||||
}, [startDate]);
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem('activityPercentage', activityPercentage.toString());
|
||||
}, [activityPercentage]);
|
||||
|
||||
// Calculate exports and storage amounts
|
||||
const exports = characters.flatMap((char) => {
|
||||
return char.planets
|
||||
.filter(
|
||||
@@ -62,6 +90,28 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
});
|
||||
});
|
||||
|
||||
// Calculate storage amounts
|
||||
const storageAmounts = characters.reduce<Grouped>((totals, character) => {
|
||||
character.planets
|
||||
.filter(
|
||||
(p) =>
|
||||
!character.planetConfig.some(
|
||||
(c) => c.planetId == p.planet_id && c.excludeFromTotals,
|
||||
),
|
||||
)
|
||||
.forEach((planet) => {
|
||||
planet.info.pins
|
||||
.filter(pin => STORAGE_IDS().some(storage => storage.type_id === pin.type_id))
|
||||
.forEach(storage => {
|
||||
storage.contents?.forEach(content => {
|
||||
const current = totals[content.type_id] || 0;
|
||||
totals[content.type_id] = current + content.amount;
|
||||
});
|
||||
});
|
||||
});
|
||||
return totals;
|
||||
}, {});
|
||||
|
||||
const groupedByMaterial = exports.reduce<Grouped>((totals, material) => {
|
||||
const { typeId, amount } = material;
|
||||
const newTotal = isNaN(totals[typeId]) ? amount : totals[typeId] + amount;
|
||||
@@ -69,27 +119,44 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
return totals;
|
||||
}, {});
|
||||
|
||||
const startDateTime = DateTime.fromISO(startDate);
|
||||
const hoursSinceStart = DateTime.now().diff(startDateTime, 'hours').hours;
|
||||
|
||||
const withProductNameAndPrice = Object.keys(groupedByMaterial).map(
|
||||
(typeIdString) => {
|
||||
const typeId = parseInt(typeIdString);
|
||||
const amount = groupedByMaterial[typeId];
|
||||
const storageAmount = storageAmounts[typeId] || 0;
|
||||
const adjustedAmount = amount * (activityPercentage / 100);
|
||||
const valueInMillions =
|
||||
(((piPrices?.appraisal.items.find((a) => a.typeID === typeId)?.prices
|
||||
.sell.min ?? 0) *
|
||||
amount) /
|
||||
adjustedAmount) /
|
||||
1000000) *
|
||||
24 *
|
||||
30;
|
||||
const storageValueInMillions =
|
||||
((piPrices?.appraisal.items.find((a) => a.typeID === typeId)?.prices
|
||||
.sell.min ?? 0) *
|
||||
storageAmount) /
|
||||
1000000;
|
||||
|
||||
// Calculate expected production and progress
|
||||
const expectedProduction = adjustedAmount * hoursSinceStart;
|
||||
const progress = hoursSinceStart > 0 ? (storageAmount / expectedProduction) * 100 : 0;
|
||||
|
||||
return {
|
||||
typeId,
|
||||
amount,
|
||||
amount: adjustedAmount,
|
||||
storageAmount,
|
||||
materialName: PI_TYPES_MAP[typeId].name,
|
||||
price: valueInMillions,
|
||||
storageValue: storageValueInMillions,
|
||||
progress,
|
||||
};
|
||||
},
|
||||
);
|
||||
const theme = useTheme();
|
||||
|
||||
|
||||
return (
|
||||
<StackItem width="100%">
|
||||
@@ -98,14 +165,48 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
<h2>Totals</h2>
|
||||
</AccordionSummary>
|
||||
<AccordionDetails>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2, mb: 2 }}>
|
||||
<TextField
|
||||
label="Production Start Date"
|
||||
type="date"
|
||||
value={DateTime.fromISO(startDate).toFormat('yyyy-MM-dd')}
|
||||
onChange={(e) => {
|
||||
const newDate = DateTime.fromFormat(e.target.value, 'yyyy-MM-dd').startOf('day').toISO();
|
||||
if (newDate) setStartDate(newDate);
|
||||
}}
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
size="small"
|
||||
/>
|
||||
<TextField
|
||||
label="Activity %"
|
||||
type="number"
|
||||
value={activityPercentage}
|
||||
onChange={(e) => {
|
||||
const value = Math.min(100, Math.max(0, parseFloat(e.target.value) || 0));
|
||||
setActivityPercentage(value);
|
||||
}}
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
inputProps={{
|
||||
min: 0,
|
||||
max: 100,
|
||||
step: 1,
|
||||
}}
|
||||
size="small"
|
||||
sx={{ width: '100px' }}
|
||||
/>
|
||||
</Box>
|
||||
<TableContainer component={Paper}>
|
||||
<Table size="small" aria-label="a dense table">
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell width="40%">
|
||||
<TableCell width="20%">
|
||||
<Tooltip title="What exports factories are producing">
|
||||
<TableSortLabel
|
||||
active={true}
|
||||
active={sortBy === "name"}
|
||||
direction={sortDirection}
|
||||
onClick={() => {
|
||||
setSortDirection(
|
||||
@@ -118,10 +219,10 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
</TableSortLabel>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell width="10%">
|
||||
<Tooltip title="How many units per hour factories are producing">
|
||||
<TableCell width="10%" align="right">
|
||||
<Tooltip title={`Adjusted production rate (${activityPercentage}% activity)`}>
|
||||
<TableSortLabel
|
||||
active={true}
|
||||
active={sortBy === "perHour"}
|
||||
direction={sortDirection}
|
||||
onClick={() => {
|
||||
setSortDirection(
|
||||
@@ -135,9 +236,41 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell width="10%" align="right">
|
||||
<Tooltip title="How many million ISK per month this planet is exporting (Jita sell min)">
|
||||
<Tooltip title="Amount currently in storage">
|
||||
<TableSortLabel
|
||||
active={true}
|
||||
active={sortBy === "storage"}
|
||||
direction={sortDirection}
|
||||
onClick={() => {
|
||||
setSortDirection(
|
||||
sortDirection === "asc" ? "desc" : "asc",
|
||||
);
|
||||
setSortBy("storage");
|
||||
}}
|
||||
>
|
||||
Units in storage
|
||||
</TableSortLabel>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell width="15%" align="right">
|
||||
<Tooltip title="Current ISK value of storage">
|
||||
<TableSortLabel
|
||||
active={sortBy === "storagePrice"}
|
||||
direction={sortDirection}
|
||||
onClick={() => {
|
||||
setSortDirection(
|
||||
sortDirection === "asc" ? "desc" : "asc",
|
||||
);
|
||||
setSortBy("storagePrice");
|
||||
}}
|
||||
>
|
||||
Produced ISK value
|
||||
</TableSortLabel>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell width="15%" align="right">
|
||||
<Tooltip title="Monthly ISK value from production">
|
||||
<TableSortLabel
|
||||
active={sortBy === "price"}
|
||||
direction={sortDirection}
|
||||
onClick={() => {
|
||||
setSortDirection(
|
||||
@@ -146,7 +279,23 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
setSortBy("price");
|
||||
}}
|
||||
>
|
||||
ISK/M
|
||||
Maximum possible ISK/M
|
||||
</TableSortLabel>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell width="15%" align="right">
|
||||
<Tooltip title="Progress towards monthly production target">
|
||||
<TableSortLabel
|
||||
active={sortBy === "progress"}
|
||||
direction={sortDirection}
|
||||
onClick={() => {
|
||||
setSortDirection(
|
||||
sortDirection === "asc" ? "desc" : "asc",
|
||||
);
|
||||
setSortBy("progress");
|
||||
}}
|
||||
>
|
||||
Progress from start date
|
||||
</TableSortLabel>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
@@ -167,12 +316,30 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
if (sortDirection === "desc")
|
||||
return a.amount > b.amount ? -1 : 1;
|
||||
}
|
||||
if (sortBy === "storage") {
|
||||
if (sortDirection === "asc")
|
||||
return a.storageAmount > b.storageAmount ? 1 : -1;
|
||||
if (sortDirection === "desc")
|
||||
return a.storageAmount > b.storageAmount ? -1 : 1;
|
||||
}
|
||||
if (sortBy === "price") {
|
||||
if (sortDirection === "asc")
|
||||
return a.price > b.price ? 1 : -1;
|
||||
if (sortDirection === "desc")
|
||||
return a.price > b.price ? -1 : 1;
|
||||
}
|
||||
if (sortBy === "storagePrice") {
|
||||
if (sortDirection === "asc")
|
||||
return a.storageValue > b.storageValue ? 1 : -1;
|
||||
if (sortDirection === "desc")
|
||||
return a.storageValue > b.storageValue ? -1 : 1;
|
||||
}
|
||||
if (sortBy === "progress") {
|
||||
if (sortDirection === "asc")
|
||||
return a.progress > b.progress ? 1 : -1;
|
||||
if (sortDirection === "desc")
|
||||
return a.progress > b.progress ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
.map((product) => (
|
||||
@@ -180,7 +347,10 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
key={product.materialName}
|
||||
material={product.materialName}
|
||||
amount={product.amount}
|
||||
storageAmount={product.storageAmount}
|
||||
price={product.price}
|
||||
storageValue={product.storageValue}
|
||||
progress={product.progress}
|
||||
/>
|
||||
))}
|
||||
<SummaryRow
|
||||
@@ -189,6 +359,10 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
(amount, p) => amount + p.price,
|
||||
0,
|
||||
)}
|
||||
storageValue={withProductNameAndPrice.reduce(
|
||||
(amount, p) => amount + p.storageValue,
|
||||
0,
|
||||
)}
|
||||
/>
|
||||
</TableBody>
|
||||
</Table>
|
||||
@@ -202,17 +376,32 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
const SummaryRow = ({
|
||||
material,
|
||||
amount,
|
||||
storageAmount,
|
||||
price,
|
||||
storageValue,
|
||||
progress,
|
||||
}: {
|
||||
material: string;
|
||||
amount?: number;
|
||||
storageAmount?: number;
|
||||
price: number;
|
||||
storageValue?: number;
|
||||
progress?: number;
|
||||
}) => (
|
||||
<TableRow>
|
||||
<TableCell component="th" scope="row">
|
||||
{material}
|
||||
</TableCell>
|
||||
<TableCell>{amount}</TableCell>
|
||||
<TableCell align="right">{amount?.toFixed(1)}</TableCell>
|
||||
<TableCell align="right">{storageAmount?.toFixed(1)}</TableCell>
|
||||
<TableCell align="right">{storageValue !== undefined && displayValue(storageValue)}</TableCell>
|
||||
<TableCell align="right">{displayValue(price)}</TableCell>
|
||||
<TableCell align="right">
|
||||
{progress !== undefined && (
|
||||
<Typography color={progress >= 100 ? 'success.main' : progress >= 75 ? 'warning.main' : 'error.main'}>
|
||||
{progress.toFixed(1)}%
|
||||
</Typography>
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
|
||||
@@ -94,7 +94,13 @@ export const planetCalculations = (planet: PlanetWithInfo) => {
|
||||
![...locallyProduced, ...locallyExcavated].some(
|
||||
(lp) => lp === p.type_id,
|
||||
),
|
||||
);
|
||||
).map((p) => ({
|
||||
...p,
|
||||
factoryCount: planetInfo.pins
|
||||
.filter((f) => f.schematic_id === p.schematic_id)
|
||||
.length,
|
||||
}));
|
||||
|
||||
|
||||
const localExports = locallyProduced
|
||||
.filter((p) => !locallyConsumed.some((lp) => lp === p))
|
||||
|
||||
Reference in New Issue
Block a user