mirror of
https://github.com/calli-eve/eve-pi.git
synced 2026-02-20 06:29:52 +01:00
refactor main view to table and add production, import and export information per planet
This commit is contained in:
@@ -9,12 +9,16 @@ import { MainGrid } from "./components/MainGrid";
|
||||
import { refreshToken } from "@/esi-sso";
|
||||
import { CharacterContext, SessionContext } from "./context/Context";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { EvePraisalResult, fetchAllPrices } from "@/eve-praisal";
|
||||
|
||||
const Home = () => {
|
||||
const [characters, setCharacters] = useState<AccessToken[]>([]);
|
||||
const [sessionReady, setSessionReady] = useState(false);
|
||||
const [environment, setEnvironment] = useState<Env | undefined>(undefined);
|
||||
const [compactMode, setCompactMode] = useState(false);
|
||||
const [piPrices, setPiPrices] = useState<EvePraisalResult | undefined>(
|
||||
undefined
|
||||
);
|
||||
|
||||
const searchParams = useSearchParams();
|
||||
const code = searchParams && searchParams.get("code");
|
||||
@@ -110,6 +114,12 @@ const Home = () => {
|
||||
.then(() => setSessionReady(true));
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
fetchAllPrices()
|
||||
.then(setPiPrices)
|
||||
.catch(() => console.log("failed getting pi prices"));
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const ESI_CACHE_TIME_MS = 600000;
|
||||
const interval = setInterval(() => {
|
||||
@@ -128,6 +138,7 @@ const Home = () => {
|
||||
EVE_SSO_CLIENT_ID: environment?.EVE_SSO_CLIENT_ID ?? "",
|
||||
compactMode,
|
||||
toggleCompactMode,
|
||||
piPrices,
|
||||
}}
|
||||
>
|
||||
<CharacterContext.Provider
|
||||
|
||||
Reference in New Issue
Block a user