mirror of
https://github.com/calli-eve/eve-pi.git
synced 2026-02-15 04:08:48 +01:00
Implement planet exclusion from totals calculations
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { SessionContext, ColorContext } from "@/app/context/Context";
|
||||
import { ColorContext, SessionContext } from "@/app/context/Context";
|
||||
import { PI_TYPES_MAP } from "@/const";
|
||||
import { AccessToken, PlanetWithInfo } from "@/types";
|
||||
import { planetCalculations } from "@/planets";
|
||||
import { AccessToken, PlanetWithInfo } from "@/types";
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import { Button, Tooltip, Typography, useTheme } from "@mui/material";
|
||||
import AppBar from "@mui/material/AppBar";
|
||||
@@ -16,9 +16,9 @@ import { DateTime } from "luxon";
|
||||
import Image from "next/image";
|
||||
import React, { forwardRef, useContext, useState } from "react";
|
||||
import Countdown from "react-countdown";
|
||||
import PinsCanvas3D from "./PinsCanvas3D";
|
||||
import { timeColor, alertModeVisibility } from "./timeColors";
|
||||
import { PlanetConfigDialog } from "../PlanetConfig/PlanetConfigDialog";
|
||||
import PinsCanvas3D from "./PinsCanvas3D";
|
||||
import { alertModeVisibility, timeColor } from "./timeColors";
|
||||
|
||||
const Transition = forwardRef(function Transition(
|
||||
props: TransitionProps & {
|
||||
@@ -62,6 +62,7 @@ export const PlanetTableRow = ({
|
||||
const planetInfoUniverse = planet.infoUniverse;
|
||||
const { expired, extractors, localProduction, localImports, localExports } =
|
||||
planetCalculations(planet);
|
||||
const planetConfig = character.planetConfig.find(p => p.planetId === planet.planet_id)
|
||||
const { colors } = useContext(ColorContext);
|
||||
return (
|
||||
<TableRow
|
||||
@@ -159,6 +160,18 @@ export const PlanetTableRow = ({
|
||||
))}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{localExports.map((exports) => (
|
||||
<Typography
|
||||
key={`export-excluded-${character.character.characterId}-${planet.planet_id}-${exports.typeId}`}
|
||||
fontSize={theme.custom.smallText}
|
||||
>
|
||||
{planetConfig?.excludeFromTotals ? 'ex' : ''}
|
||||
</Typography>
|
||||
))}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{localExports.map((exports) => (
|
||||
|
||||
@@ -77,6 +77,11 @@ const PlanetaryIteractionTable = ({
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell width="2%">
|
||||
<Tooltip title="Is planet ecluded from totals">
|
||||
<Typography fontSize={theme.custom.smallText}>Excluded</Typography>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell width="2%">
|
||||
<Tooltip title="How many units per hour factories are producing">
|
||||
<Typography fontSize={theme.custom.smallText}>u/h</Typography>
|
||||
|
||||
@@ -40,9 +40,10 @@ const displayValue = (valueInMillions: number): string =>
|
||||
: `${valueInMillions.toFixed(2)} M`;
|
||||
|
||||
export const Summary = ({ characters }: { characters: AccessToken[] }) => {
|
||||
const { piPrices, alertMode } = useContext(SessionContext);
|
||||
const { piPrices } = useContext(SessionContext);
|
||||
const exports = characters.flatMap((char) => {
|
||||
return char.planets.flatMap((planet) => {
|
||||
return char.planets.filter(p => !char.planetConfig.some(c => c.planetId == p.planet_id && c.excludeFromTotals))
|
||||
.flatMap((planet) => {
|
||||
const { localExports } = planetCalculations(planet);
|
||||
return localExports;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user