refactor: convert to bun-workspaces monorepo (desktop/ + www/)
- 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
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import { create } from "zustand";
|
||||
import type { ActiveView, DbType } from "../lib/types";
|
||||
|
||||
interface UiState {
|
||||
searchQuery: string;
|
||||
activeFolderId: string | null;
|
||||
activeTagIds: string[];
|
||||
activeDbTypes: DbType[];
|
||||
activeEnvironment: string | null;
|
||||
activeView: ActiveView;
|
||||
selectedItemIds: string[];
|
||||
prefilledConnectionString: string | null;
|
||||
activeConnectionId: string | null;
|
||||
settingsReturnView: Exclude<ActiveView, "settings"> | null;
|
||||
setActiveView: (view: ActiveView) => void;
|
||||
openSettings: () => void;
|
||||
closeSettings: () => void;
|
||||
setSearchQuery: (q: string) => void;
|
||||
setActiveFolderId: (id: string | null) => void;
|
||||
toggleTag: (id: string) => void;
|
||||
toggleDbType: (type: DbType) => void;
|
||||
setEnvironment: (env: string | null) => void;
|
||||
clearFilters: () => void;
|
||||
toggleItemSelection: (id: string) => void;
|
||||
selectAllItems: (ids: string[]) => void;
|
||||
clearSelection: () => void;
|
||||
setPrefilledConnectionString: (value: string) => void;
|
||||
clearPrefilledConnectionString: () => void;
|
||||
setActiveConnectionId: (id: string | null) => void;
|
||||
}
|
||||
|
||||
export const useUiStore = create<UiState>((set) => ({
|
||||
searchQuery: "", activeFolderId: null, activeTagIds: [], activeDbTypes: [], activeEnvironment: null, activeView: "home", selectedItemIds: [], prefilledConnectionString: null, activeConnectionId: null, settingsReturnView: null,
|
||||
setActiveView: (view) => set({ activeView: view }),
|
||||
openSettings: () => set((s) => ({
|
||||
settingsReturnView:
|
||||
s.activeView === "settings"
|
||||
? s.settingsReturnView
|
||||
: s.activeView === "home" || s.activeView === "db-viewer" || s.activeView === "new-connection"
|
||||
? s.activeView
|
||||
: null,
|
||||
activeView: "settings",
|
||||
})),
|
||||
closeSettings: () => set((s) => ({
|
||||
activeView: s.settingsReturnView ?? "home",
|
||||
settingsReturnView: null,
|
||||
})),
|
||||
setSearchQuery: (q) => set({ searchQuery: q }),
|
||||
setActiveFolderId: (id) => set({ activeFolderId: id, selectedItemIds: [] }),
|
||||
toggleTag: (id) => set((s) => ({ activeTagIds: s.activeTagIds.includes(id) ? s.activeTagIds.filter((t) => t !== id) : [...s.activeTagIds, id] })),
|
||||
toggleDbType: (type) => set((s) => ({ activeDbTypes: s.activeDbTypes.includes(type) ? s.activeDbTypes.filter((t) => t !== type) : [...s.activeDbTypes, type] })),
|
||||
setEnvironment: (env) => set({ activeEnvironment: env }),
|
||||
clearFilters: () => set({ searchQuery: "", activeTagIds: [], activeDbTypes: [], activeFolderId: null, activeEnvironment: null }),
|
||||
toggleItemSelection: (id) => set((s) => ({
|
||||
selectedItemIds: s.selectedItemIds.includes(id)
|
||||
? s.selectedItemIds.filter((i) => i !== id)
|
||||
: [...s.selectedItemIds, id],
|
||||
})),
|
||||
selectAllItems: (ids) => set({ selectedItemIds: ids }),
|
||||
clearSelection: () => set({ selectedItemIds: [] }),
|
||||
setPrefilledConnectionString: (value) => set({ prefilledConnectionString: value }),
|
||||
clearPrefilledConnectionString: () => set({ prefilledConnectionString: null }),
|
||||
setActiveConnectionId: (id) => set({ activeConnectionId: id }),
|
||||
}));
|
||||
Reference in New Issue
Block a user