fix: wire up Default Tool View save in General settings

The <select> for Default Tool View was an uncontrolled dead control with
no value binding, no onChange handler, and no save mechanism. This wires
it up end-to-end:

- Add defaultToolView to the Zustand settings store
- Load the persisted value from the settings API on mount
- Bind the <select> with value/onChange
- Add Save Settings button mirroring SystemSection's pattern
- Redirect home page to /fullscreen when defaultToolView is "fullscreen"

Closes #75
This commit is contained in:
ashim-hq
2026-04-21 23:25:34 +08:00
parent 77a60b24cc
commit afac4b9870
3 changed files with 78 additions and 14 deletions
+3 -1
View File
@@ -4,6 +4,7 @@ import { apiGet } from "@/lib/api";
interface SettingsState {
disabledTools: string[];
experimentalEnabled: boolean;
defaultToolView: "sidebar" | "fullscreen";
loaded: boolean;
fetch: () => Promise<void>;
}
@@ -11,6 +12,7 @@ interface SettingsState {
export const useSettingsStore = create<SettingsState>((set, get) => ({
disabledTools: [],
experimentalEnabled: false,
defaultToolView: "sidebar",
loaded: false,
fetch: async () => {
@@ -23,10 +25,10 @@ export const useSettingsStore = create<SettingsState>((set, get) => ({
set({
disabledTools: data.settings.disabledTools ? JSON.parse(data.settings.disabledTools) : [],
experimentalEnabled: data.settings.enableExperimentalTools === "true",
defaultToolView: data.settings.defaultToolView === "fullscreen" ? "fullscreen" : "sidebar",
loaded: true,
});
} catch {
// Settings fetch failed - default to no disabled tools
set({ loaded: true });
}
},