import { q, clientId } from "@thorium/context/AppContext"; import { toast } from "@thorium/context/ToastContext"; import { useStation } from "@thorium/routes/station/useStation"; import Button from "@thorium/ui/Button"; import { Icon } from "@thorium/ui/Icon"; import { Tooltip } from "@thorium/ui/Tooltip"; import { cn } from "@thorium/utils/cn"; import { LiveQueryError } from "@thorium/utils/live-query/client/client"; import { megaWattHourToGigaJoule } from "@thorium/utils/unitTypes"; import { useRef, useState } from "react"; import LauncherImage from "./assets/launcher.svg"; import href from "./assets/torpedoSprite.svg?url"; export function Torpedoes() { const { shipId } = useStation(); const [torpedoLaunchers] = q.targeting.torpedoes.launchers.useNetRequest({ shipId, }); const [torpedoList] = q.targeting.torpedoes.list.useNetRequest({ shipId }); const [selectedTorpedo, setSelectedTorpedo] = useState(null); return ( <>
{torpedoLaunchers?.map((launcher) => ( ))}
); } function Launcher({ launcherId, name, state, loadTime, selectedTorpedo, torpedo, }: { launcherId: number; state: "ready" | "loading" | "unloading" | "loaded" | "firing" | "fired"; name: string; loadTime: number; selectedTorpedo: string | null; torpedo: { casingColor: string | undefined; guidanceColor: string | undefined; guidanceMode: string | undefined; warheadColor: string | undefined; warheadDamageType: string | undefined; } | null; }) { const torpedoRef = useRef(null); const animationTime = state === "loading" || state === "unloading" ? loadTime : 100; return (

{name}

Torpedo Launcher
{torpedo?.warheadDamageType ? ( ) : null} {torpedo?.guidanceMode ? ( ) : null}
); }