import { Api } from "@/esi-api"; import { AccessToken, Planet } from "@/types"; import { Stack, Tooltip, Typography, styled, useTheme } from "@mui/material"; import { useEffect, useState } from "react"; import { PlanetCard } from "./PlanetCard"; import { NoPlanetCard } from "./NoPlanetCard"; import Table from "@mui/material/Table"; import TableBody from "@mui/material/TableBody"; import TableCell from "@mui/material/TableCell"; import TableContainer from "@mui/material/TableContainer"; import TableHead from "@mui/material/TableHead"; import TableRow from "@mui/material/TableRow"; import Paper from "@mui/material/Paper"; import { PlanetTableRow } from "./PlanetTableRow"; const StackItem = styled(Stack)(({ theme }) => ({ ...theme.typography.body2, padding: theme.custom.compactMode ? theme.spacing(1) : theme.spacing(2), textAlign: "left", justifyContent: "center", alignItems: "center", })); const getPlanets = async (character: AccessToken): Promise => { const api = new Api(); const planets = ( await api.v1.getCharactersCharacterIdPlanets( character.character.characterId, { token: character.access_token, } ) ).data; return planets; }; const PlanetaryIteractionTable = ({ character, planets, }: { character: AccessToken; planets: Planet[]; }) => { const theme = useTheme(); return ( Planet CC Extraction Production Imports Exports u/h ISK/M {planets.map((planet) => ( ))}
); }; const PlanetaryInteractionIconsRow = ({ character, planets, }: { character: AccessToken; planets: Planet[]; }) => { return ( {planets.map((planet) => ( ))} {Array.from(Array(6 - planets.length).keys()).map((i, id) => ( ))} ); }; export const PlanetaryInteractionRow = ({ character, }: { character: AccessToken; }) => { const [planets, setPlanets] = useState([]); const theme = useTheme(); useEffect(() => { getPlanets(character).then(setPlanets).catch(console.log); }, [character]); return theme.custom.compactMode ? ( ) : ( ); };