- Move the Tauri app (React frontend + Rust backend) into desktop/ via git mv — configs unchanged (relative paths: tauri.conf.json, vite.config.ts) - Root package.json becomes a private bun workspace container with orchestration scripts; desktop package renamed gridline-desktop - Scaffold www/ with Astro 7 + Tailwind v4 (hand-wired vite plugin, static output, ready for Dokploy) - Update release.yml for the new layout: projectPath: desktop, desktop/src-tauri resource paths, rust-cache workspace path - Update README + AGENTS.md structure trees and dev commands - Verified: vitest (1074), cargo test (354), desktop build, tauri dev (window launches), tauri build (dmg + app bundles), Astro build
26 lines
818 B
TypeScript
26 lines
818 B
TypeScript
import { create } from "zustand";
|
|
import type { Settings } from "../lib/types";
|
|
import * as cmd from "../lib/commands";
|
|
|
|
interface SettingsState {
|
|
settings: Settings | null; loading: boolean; error: string | null;
|
|
load: () => Promise<void>;
|
|
updateSetting: (key: string, value: string) => Promise<void>;
|
|
}
|
|
|
|
export const useSettingsStore = create<SettingsState>((set, get) => ({
|
|
settings: null, loading: false, error: null,
|
|
load: async () => {
|
|
set({ loading: true, error: null });
|
|
try {
|
|
const settings = await cmd.getSettings();
|
|
set({ settings, loading: false });
|
|
} catch (e) {
|
|
set({ loading: false, error: e instanceof Error ? e.message : String(e) });
|
|
}
|
|
},
|
|
updateSetting: async (key, value) => {
|
|
await cmd.updateSetting(key, value);
|
|
await get().load();
|
|
},
|
|
})); |