diff --git a/src/app/components/Backup/UploadDialog.tsx b/src/app/components/Backup/UploadDialog.tsx index 5f75800..3f1d7cf 100644 --- a/src/app/components/Backup/UploadDialog.tsx +++ b/src/app/components/Backup/UploadDialog.tsx @@ -43,7 +43,7 @@ export const UploadDialog = ({ fileReader.readAsText(file); } - }, [file]); + }, [file, closeDialog, restoreCharacters, validate]); const changeHandler = (event: any) => { setFile(event.target.files[0]); diff --git a/src/app/components/PlanetaryInteraction/ProductionChainVisualization.tsx b/src/app/components/PlanetaryInteraction/ProductionChainVisualization.tsx index c7b70e0..71c2615 100644 --- a/src/app/components/PlanetaryInteraction/ProductionChainVisualization.tsx +++ b/src/app/components/PlanetaryInteraction/ProductionChainVisualization.tsx @@ -291,48 +291,12 @@ export const ProductionChainVisualization: React.FC - - {inputs.length > 0 && ( - <> - - - Inputs per cycle: - - - {inputs.map(input => ( - - • {PI_TYPES_MAP[input.typeId]?.name}: {input.quantity} units - {factoryCount > 0 && ` (${(input.quantity * factoryCount).toFixed(0)} total)`} - - ))} - - - )} - - - {factoryCount > 0 && ( - <> - - Factories: {factoryCount} - - {cycleTime && ( - - Cycles per hour: {(3600 / cycleTime).toFixed(1)} - - )} - - )} {production > 0 && ( <> Production: {production.toFixed(1)} units total - {factoryCount > 0 && ( - - ({(production / factoryCount).toFixed(1)} units/factory) - - )} )} {consumption > 0 && ( @@ -340,11 +304,6 @@ export const ProductionChainVisualization: React.FC Consumption: {consumption.toFixed(1)} units total - {factoryCount > 0 && ( - - ({(consumption / factoryCount).toFixed(1)} units/factory) - - )} )} {isImported && ( @@ -364,12 +323,6 @@ export const ProductionChainVisualization: React.FC Net: {(production - consumption).toFixed(1)} units total - {factoryCount > 0 && ( - <> -
- ({((production - consumption) / factoryCount).toFixed(1)} units/factory) - - )}
diff --git a/src/app/page.tsx b/src/app/page.tsx index 5e61ff5..a0d339c 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -3,7 +3,7 @@ import "@fontsource/roboto/300.css"; import "@fontsource/roboto/400.css"; import "@fontsource/roboto/500.css"; import "@fontsource/roboto/700.css"; -import { memo, useCallback, useEffect, useState } from "react"; +import { memo, useCallback, useEffect, useState, Suspense } from "react"; import { AccessToken, CharacterUpdate, Env, PlanetWithInfo } from "../types"; import { MainGrid } from "./components/MainGrid"; import { refreshToken } from "@/esi-sso"; @@ -20,6 +20,7 @@ import { getPlanet, getPlanetUniverse, getPlanets } from "@/planets"; import { PlanetConfig } from "./components/PlanetConfig/PlanetConfigDialog"; const Home = () => { + const searchParams = useSearchParams(); const [characters, setCharacters] = useState([]); const [sessionReady, setSessionReady] = useState(false); const [environment, setEnvironment] = useState(undefined); @@ -31,8 +32,6 @@ const Home = () => { const [colors, setColors] = useState(defaultColors); const [alertMode, setAlertMode] = useState(false); - const searchParams = useSearchParams(); - const code = searchParams && searchParams.get("code"); const deleteCharacter = (character: AccessToken) => { const charactersToSave = characters.filter( @@ -75,6 +74,7 @@ const Home = () => { const handleCallback = async ( characters: AccessToken[], ): Promise => { + const code = searchParams?.get("code"); if (code) { window.history.replaceState(null, "", "/"); const res = await fetch(`api/token?code=${code}`); @@ -246,6 +246,7 @@ const Home = () => { }, ESI_CACHE_TIME_MS); return () => clearInterval(interval); }); + return ( { ); }; -export default memo(Home); +const HomeWrapper = () => ( + + + +); +HomeWrapper.displayName = 'HomeWrapper'; + +export default memo(HomeWrapper);