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:
30
archive/legacy-static/js/state.js
Normal file
30
archive/legacy-static/js/state.js
Normal file
@@ -0,0 +1,30 @@
|
||||
window.GDD = window.GDD || {};
|
||||
|
||||
/* Simple pub/sub state store — Zustand-like for prototype */
|
||||
window.GDD.createStore = function createStore(initialState) {
|
||||
let state = { ...initialState };
|
||||
const listeners = new Set();
|
||||
|
||||
return {
|
||||
getState: () => ({ ...state }),
|
||||
setState: (partial) => {
|
||||
const next = typeof partial === 'function' ? partial(state) : partial;
|
||||
state = { ...state, ...next };
|
||||
listeners.forEach(fn => fn(state));
|
||||
},
|
||||
subscribe: (fn) => {
|
||||
listeners.add(fn);
|
||||
return () => listeners.delete(fn);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/* App-level store */
|
||||
window.GDD.appStore = window.GDD.createStore({
|
||||
currentPage: 'overview',
|
||||
sidebarCollapsed: false,
|
||||
sidebarOpen: false, // mobile
|
||||
connected: true,
|
||||
playerName: 'Captain Riker',
|
||||
playerCredits: 125000,
|
||||
});
|
||||
Reference in New Issue
Block a user