mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user