Initial skeleton: React/TS frontend + Go backend structure

This commit is contained in:
Hermes Agent
2026-06-16 08:51:55 -04:00
parent 78f19cde7d
commit 33c6648b84
40 changed files with 1799 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
import { create } from 'zustand'
import { devtools } from 'zustand/middleware'
export interface Krate {
id: string
type: string
title: string
x: number
y: number
width: number
height: number
minimized: boolean
windowLayout: WindowLayout
windows: Map<string, KrateWindow>
}
export interface WindowLayout {
cols: number
rows: number
cells: Map<string, { col: number; row: number; colSpan: number; rowSpan: number }>
}
export interface KrateWindow {
id: string
type: string
title: string
state: unknown
}
export interface KrateStore {
krates: Map<string, Krate>
selectedKrateId: string | null
}
const INITIAL_STATE: KrateStore = {
krates: new Map(),
selectedKrateId: null,
}
export const useKrateStore = create<KrateStore>()(
devtools((set) => ({
...INITIAL_STATE,
addKrate: (krate: Krate) =>
set((state) => ({ krates: new Map(state.krates).set(krate.id, krate) })),
removeKrate: (id: string) =>
set((state) => {
const newKrates = new Map(state.krates)
newKrates.delete(id)
return { krates: newKrates }
}),
selectKrate: (id: string | null) => set({ selectedKrateId: id }),
updateKrate: (id: string, updates: Partial<Krate>) =>
set((state) => {
const existing = state.krates.get(id)
if (!existing) return state
return {
krates: new Map(state.krates).set(id, { ...existing, ...updates }),
}
}),
}))
)