diff --git a/src/app/components/MainGrid.tsx b/src/app/components/MainGrid.tsx index c63d505..89a55b4 100644 --- a/src/app/components/MainGrid.tsx +++ b/src/app/components/MainGrid.tsx @@ -153,7 +153,7 @@ export const MainGrid = () => { diff --git a/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx b/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx index 8b55101..0e7161b 100644 --- a/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx +++ b/src/app/components/PlanetaryInteraction/PlanetTableRow.tsx @@ -1,5 +1,5 @@ import { ColorContext, SessionContext } from "@/app/context/Context"; -import { PI_TYPES_MAP, STORAGE_IDS, STORAGE_CAPACITIES, PI_PRODUCT_VOLUMES } from "@/const"; +import { PI_TYPES_MAP, STORAGE_IDS, STORAGE_CAPACITIES, PI_PRODUCT_VOLUMES, EVE_IMAGE_URL } from "@/const"; import { planetCalculations } from "@/planets"; import { AccessToken, PlanetWithInfo } from "@/types"; import CloseIcon from "@mui/icons-material/Close"; @@ -41,6 +41,7 @@ export const PlanetTableRow = ({ character: AccessToken; }) => { const theme = useTheme(); + const { showProductIcons } = useContext(SessionContext); const [planetRenderOpen, setPlanetRenderOpen] = useState(false); const [planetConfigOpen, setPlanetConfigOpen] = useState(false); @@ -153,6 +154,39 @@ export const PlanetTableRow = ({ }); }; + const renderProductDisplay = (typeId: number, amount?: number) => { + if (showProductIcons) { + return ( +
+ {PI_TYPES_MAP[typeId].name} + {amount !== undefined && ( + + {amount}/h + + )} +
+ ); + } + return ( +
+ + {PI_TYPES_MAP[typeId].name} + + {amount !== undefined && ( + + {amount}/h + + )} +
+ ); + }; + return ( <> {planet.upgrade_level}
+ {extractors.length === 0 &&No extractors} {extractors.map((e, idx) => { return (
- - { - PI_TYPES_MAP[e.extractor_details?.product_type_id ?? 0] - ?.name - } - + {renderProductDisplay(e.extractor_details?.product_type_id ?? 0)}
); })} @@ -273,12 +303,12 @@ export const PlanetTableRow = ({
{Array.from(localProduction).map((schematic, idx) => { return ( - - {schematic[1].name} - + {renderProductDisplay(schematic[1].outputs[0].type_id)} +
); })}
@@ -286,24 +316,24 @@ export const PlanetTableRow = ({
{localImports.map((i) => ( - - {PI_TYPES_MAP[i.type_id].name} ({i.quantity * i.factoryCount}/h) - + {renderProductDisplay(i.type_id, i.quantity * i.factoryCount)} +
))}
{localExports.map((exports) => ( - - {PI_TYPES_MAP[exports.typeId].name} - + {renderProductDisplay(exports.typeId, exports.amount)} +
))}
@@ -371,6 +401,7 @@ export const PlanetTableRow = ({
+ {storageFacilities.length === 0 &&No storage} {storageFacilities .sort((a, b) => { const isALaunchpad = a.type_id === 2256 || a.type_id === 2542 || a.type_id === 2543 || a.type_id === 2544 || a.type_id === 2552 || a.type_id === 2555 || a.type_id === 2556 || a.type_id === 2557; diff --git a/src/app/components/PlanetaryInteraction/PlanetaryInteractionRow.tsx b/src/app/components/PlanetaryInteraction/PlanetaryInteractionRow.tsx index 4e0e089..09ba6f8 100644 --- a/src/app/components/PlanetaryInteraction/PlanetaryInteractionRow.tsx +++ b/src/app/components/PlanetaryInteraction/PlanetaryInteractionRow.tsx @@ -36,8 +36,8 @@ const PlanetaryIteractionTable = ({ return ( - - + +
diff --git a/src/app/components/Settings/SettingsButtons.tsx b/src/app/components/Settings/SettingsButtons.tsx index 881767d..cc79a77 100644 --- a/src/app/components/Settings/SettingsButtons.tsx +++ b/src/app/components/Settings/SettingsButtons.tsx @@ -13,13 +13,15 @@ import { Typography, TextField, Box, + FormControlLabel, + Checkbox, } from "@mui/material"; import { ColorChangeHandler, ColorResult, CompactPicker } from "react-color"; import React, { useState, useContext } from "react"; export const SettingsButton = () => { const { colors, setColors } = useContext(ColorContext); - const { balanceThreshold, setBalanceThreshold } = useContext(SessionContext); + const { balanceThreshold, setBalanceThreshold, showProductIcons, setShowProductIcons } = useContext(SessionContext); const [open, setOpen] = useState(false); const handleClickOpen = () => { @@ -45,6 +47,10 @@ export const SettingsButton = () => { } }; + const handleShowProductIconsChange = (event: React.ChangeEvent) => { + setShowProductIcons(event.target.checked); + }; + return ( <> @@ -57,13 +63,24 @@ export const SettingsButton = () => { aria-labelledby="alert-dialog-title" aria-describedby="alert-dialog-description" > - {"Settings"} - + + Display Settings + + } + label="Show product icons instead of names" + /> + + Balance Threshold { ); })} - diff --git a/src/app/components/Summary/Summary.tsx b/src/app/components/Summary/Summary.tsx index 35c7a05..2df28c8 100644 --- a/src/app/components/Summary/Summary.tsx +++ b/src/app/components/Summary/Summary.tsx @@ -199,8 +199,8 @@ export const Summary = ({ characters }: { characters: AccessToken[] }) => { sx={{ width: '100px' }} /> - -
+ +
diff --git a/src/app/context/Context.tsx b/src/app/context/Context.tsx index 6105767..8199377 100644 --- a/src/app/context/Context.tsx +++ b/src/app/context/Context.tsx @@ -37,6 +37,8 @@ export const SessionContext = createContext<{ }) => PlanetConfig; balanceThreshold: number; setBalanceThreshold: Dispatch>; + showProductIcons: boolean; + setShowProductIcons: (show: boolean) => void; }>({ sessionReady: false, refreshSession: () => {}, @@ -62,7 +64,10 @@ export const SessionContext = createContext<{ }, balanceThreshold: 1000, setBalanceThreshold: () => {}, + showProductIcons: false, + setShowProductIcons: () => {}, }); + export type ColorSelectionType = { defaultColor: string; expiredColor: string; @@ -84,6 +89,7 @@ export const defaultColors = { dayColor: "#2F695A", twoDaysColor: "#2F695A", }; + export const ColorContext = createContext<{ colors: ColorSelectionType; setColors: (colors: ColorSelectionType) => void; diff --git a/src/app/page.tsx b/src/app/page.tsx index e35b0cc..3e27c8d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -30,6 +30,7 @@ const Home = () => { undefined, ); const [balanceThreshold, setBalanceThreshold] = useState(1000); + const [showProductIcons, setShowProductIcons] = useState(false); const [colors, setColors] = useState(defaultColors); const [alertMode, setAlertMode] = useState(false); @@ -278,6 +279,8 @@ const Home = () => { readPlanetConfig, balanceThreshold, setBalanceThreshold, + showProductIcons, + setShowProductIcons, }} >