f80c623a74
Wires the first end-to-end command through the full pipeline:
inspector rename action → local order draft → user.games.order
submit → optimistic overlay on map / inspector → server hydration
on cache miss via the new user.games.order.get message type.
Backend: GET /api/v1/user/games/{id}/orders forwards to engine
GET /api/v1/order. Gateway parses the engine PUT response into the
extended UserGamesOrderResponse FBS envelope and adds
executeUserGamesOrderGet for the read-back path. Frontend ports
ValidateTypeName to TS, lands the inline rename editor + Submit
button, and exposes a renderedReport context so consumers see the
overlay-applied snapshot.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
// Exposes the per-game `GalaxyClient` instance through a Svelte
|
|
// context so command-driven UI (the order-tab submit button,
|
|
// later phases' inspector actions) can issue gateway calls without
|
|
// re-instantiating the client. The handle is intentionally a thin
|
|
// reactive wrapper: the layout populates `client` after the boot
|
|
// `Promise.all` resolves, and consumers read the latest value
|
|
// through the getter — `null` while the boot is in flight, set to
|
|
// the live client once the keypair / gateway public key are loaded.
|
|
|
|
import type { GalaxyClient } from "../api/galaxy-client";
|
|
|
|
/**
|
|
* GALAXY_CLIENT_CONTEXT_KEY is the Svelte context key the in-game
|
|
* shell layout uses to expose its bound `GalaxyClient` to
|
|
* descendants. The order-tab submit button reads this to call
|
|
* `submitOrder`.
|
|
*/
|
|
export const GALAXY_CLIENT_CONTEXT_KEY = Symbol("galaxy-client");
|
|
|
|
export interface GalaxyClientHandle {
|
|
readonly client: GalaxyClient | null;
|
|
}
|
|
|
|
export class GalaxyClientHolder implements GalaxyClientHandle {
|
|
#client: GalaxyClient | null = $state(null);
|
|
|
|
get client(): GalaxyClient | null {
|
|
return this.#client;
|
|
}
|
|
|
|
set(client: GalaxyClient | null): void {
|
|
this.#client = client;
|
|
}
|
|
}
|