import { Panel } from "@void-nav/ui"; import type { CargoItem, Ship } from "../module_bindings/types"; export function CargoPanel({ cargo, ship }: { cargo: CargoItem[]; ship?: Ship }) { const used = cargo.reduce((total, item) => total + item.quantity, 0n); const capacity = ship?.cargoCapacity ?? 0n; const fillPct = capacity > 0n ? Math.min(100, Math.round((Number(used) / Number(capacity)) * 100)) : 0; const barColor = fillPct >= 90 ? "#ef4444" : fillPct >= 60 ? "#f0a030" : "#22d3ee"; return (

Cargo

{used.toString()} / {capacity.toString()} m³
{cargo.length > 0 ? ( cargo.map((item) => (
{item.itemName} {item.quantity.toString()}
{item.category} / {item.unitPrice.toString()} ISK per unit
)) ) : (

Cargo hold empty.

)}
); }