Restructure into pnpm monorepo with game shell, docs, and SpacetimeDB backend
- Restructure flat static prototype into pnpm workspace monorepo - apps/game: playable shell with R3F 3D scene, HUD, SpacetimeDB connection - apps/docs: design docs and prototypes - apps/site: landing page - packages/ui: shared Button and Panel primitives - services/spacetimedb: backend module (9 tables, 11 reducers) - Archive legacy static files to archive/legacy-static/ - Game loop: connect, undock, target, approach, dock, mine, sell - Add pnpm-workspace.yaml, tsconfig.base.json, spacetime.json
This commit is contained in:
35
apps/game/src/ui/CargoPanel.tsx
Normal file
35
apps/game/src/ui/CargoPanel.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
|
||||
return (
|
||||
<Panel className="p-4">
|
||||
<div className="flex items-baseline justify-between gap-3">
|
||||
<p className="m-0 font-mono text-xs uppercase tracking-[0.1em] text-muted">Cargo</p>
|
||||
<span className="font-mono text-xs text-fg-dim">
|
||||
{used.toString()} / {capacity.toString()}
|
||||
</span>
|
||||
</div>
|
||||
<div className="mt-3 grid gap-2">
|
||||
{cargo.length > 0 ? (
|
||||
cargo.map((item) => (
|
||||
<div key={String(item.cargoItemId)} className="rounded-md border border-border bg-bg-subtle px-3 py-2">
|
||||
<div className="flex items-center justify-between gap-3 text-sm">
|
||||
<span className="font-semibold text-fg-bright">{item.itemName}</span>
|
||||
<span className="font-mono text-xs text-cyan">{item.quantity.toString()}</span>
|
||||
</div>
|
||||
<div className="mt-1 font-mono text-xs uppercase tracking-[0.08em] text-muted">
|
||||
{item.category} / {item.unitPrice.toString()} ISK
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<p className="m-0 rounded-md border border-border bg-bg-subtle p-3 text-sm text-fg-dim">Cargo hold empty.</p>
|
||||
)}
|
||||
</div>
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user