import React from "react"; import styles from "./Debug.module.css"; import { CalculationDetail, type CalculationSlot, type CalculationSlotType, useCurrentFit, useEveData, useStatistics, } from "@eveshipfit/react"; const slotTypeToValue: Record = { High: 0, Medium: 1, Low: 2, Rig: 3, SubSystem: 4, DroneBay: 5, Charge: 6, }; const slotToOrder = (slot: CalculationSlot) => { return slotTypeToValue[slot.type] * 100 + (slot.index ?? 0); }; export const Debug = () => { const currentFit = useCurrentFit(); const eveData = useEveData(); const statistics = useStatistics(); const [tab, setTab] = React.useState< "JSON" | "Ship" | "Char" | "Structure" | "Target" | { Item?: number; Charge?: number } >("Ship"); if (eveData === null || statistics === null) { return <>; } const items = statistics.items .map((item, index) => { return { item, index }; }) .sort((a, b) => slotToOrder(a.item.slot) - slotToOrder(b.item.slot)) ?? []; return ( <>
EVEShip.fit debugger
{tab === "JSON" &&
{JSON.stringify(currentFit.fit, null, 2)}
} {tab !== "JSON" && }
); };