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
+7 -1
View File
@@ -24,7 +24,7 @@ export function HomePage() {
currentEntry,
} = useFileStore();
const navigate = useNavigate();
const { fetch: fetchSettings } = useSettingsStore();
const { fetch: fetchSettings, defaultToolView, loaded: settingsLoaded } = useSettingsStore();
const { fetch: fetchFeatures, isToolInstalled } = useFeaturesStore();
useEffect(() => {
@@ -32,6 +32,12 @@ export function HomePage() {
fetchFeatures();
}, [fetchSettings, fetchFeatures]);
useEffect(() => {
if (settingsLoaded && defaultToolView === "fullscreen" && files.length === 0) {
navigate("/fullscreen", { replace: true });
}
}, [settingsLoaded, defaultToolView, files.length, navigate]);
const handleFiles = useCallback(
(newFiles: File[]) => {
reset();