Initial commit: Triple-C app, container, and CI
Tauri v2 desktop app (React/TypeScript + Rust) for managing containerized Claude Code environments. Includes Gitea Actions workflow for building and pushing the sandbox container image, and a BUILDING.md guide for manual app builds on Linux and Windows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
80
app/src/store/appState.ts
Normal file
80
app/src/store/appState.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import { create } from "zustand";
|
||||
import type { Project, TerminalSession } from "../lib/types";
|
||||
|
||||
interface AppState {
|
||||
// Projects
|
||||
projects: Project[];
|
||||
selectedProjectId: string | null;
|
||||
setProjects: (projects: Project[]) => void;
|
||||
setSelectedProject: (id: string | null) => void;
|
||||
updateProjectInList: (project: Project) => void;
|
||||
removeProjectFromList: (id: string) => void;
|
||||
|
||||
// Terminal sessions
|
||||
sessions: TerminalSession[];
|
||||
activeSessionId: string | null;
|
||||
addSession: (session: TerminalSession) => void;
|
||||
removeSession: (id: string) => void;
|
||||
setActiveSession: (id: string | null) => void;
|
||||
|
||||
// UI state
|
||||
sidebarView: "projects" | "settings";
|
||||
setSidebarView: (view: "projects" | "settings") => void;
|
||||
dockerAvailable: boolean | null;
|
||||
setDockerAvailable: (available: boolean | null) => void;
|
||||
imageExists: boolean | null;
|
||||
setImageExists: (exists: boolean | null) => void;
|
||||
hasKey: boolean | null;
|
||||
setHasKey: (has: boolean | null) => void;
|
||||
}
|
||||
|
||||
export const useAppState = create<AppState>((set) => ({
|
||||
// Projects
|
||||
projects: [],
|
||||
selectedProjectId: null,
|
||||
setProjects: (projects) => set({ projects }),
|
||||
setSelectedProject: (id) => set({ selectedProjectId: id }),
|
||||
updateProjectInList: (project) =>
|
||||
set((state) => ({
|
||||
projects: state.projects.map((p) =>
|
||||
p.id === project.id ? project : p,
|
||||
),
|
||||
})),
|
||||
removeProjectFromList: (id) =>
|
||||
set((state) => ({
|
||||
projects: state.projects.filter((p) => p.id !== id),
|
||||
selectedProjectId:
|
||||
state.selectedProjectId === id ? null : state.selectedProjectId,
|
||||
})),
|
||||
|
||||
// Terminal sessions
|
||||
sessions: [],
|
||||
activeSessionId: null,
|
||||
addSession: (session) =>
|
||||
set((state) => ({
|
||||
sessions: [...state.sessions, session],
|
||||
activeSessionId: session.id,
|
||||
})),
|
||||
removeSession: (id) =>
|
||||
set((state) => {
|
||||
const sessions = state.sessions.filter((s) => s.id !== id);
|
||||
return {
|
||||
sessions,
|
||||
activeSessionId:
|
||||
state.activeSessionId === id
|
||||
? (sessions[sessions.length - 1]?.id ?? null)
|
||||
: state.activeSessionId,
|
||||
};
|
||||
}),
|
||||
setActiveSession: (id) => set({ activeSessionId: id }),
|
||||
|
||||
// UI state
|
||||
sidebarView: "projects",
|
||||
setSidebarView: (view) => set({ sidebarView: view }),
|
||||
dockerAvailable: null,
|
||||
setDockerAvailable: (available) => set({ dockerAvailable: available }),
|
||||
imageExists: null,
|
||||
setImageExists: (exists) => set({ imageExists: exists }),
|
||||
hasKey: null,
|
||||
setHasKey: (has) => set({ hasKey: has }),
|
||||
}));
|
||||
Reference in New Issue
Block a user