File based settings (#1361)

* Rename GlobalStateContext to SettingsAuthContext

* Naive initial impl of settings persistence to file system

* Update app identifier in tauri config

* Add "show in folder" tauri command

* Load from and save to file system in Tauri app

* Add documents drive to tauri permission scope

* Add recursive prop to default dir selection dialog

* Add success toast to web restore defaults action

* Add a way to validate read-in settings

* Update imports to use separate settings lib file

* Validate localStorage-loaded settings, combine error message

* Add a e2e test for validation

* Clean up state state bugs

* Reverse validation looping so new users don't error

* update settingsMachine typegen to remove conflicts

* Fmt

* Fix TS errors
This commit is contained in:
Frank Noirot
2024-02-15 14:14:14 -05:00
committed by GitHub
parent d9bcadb062
commit 602e7afef6
32 changed files with 599 additions and 169 deletions

View File

@ -5,7 +5,7 @@ import {
useNextClick,
} from '.'
import { onboardingPaths } from 'routes/Onboarding/paths'
import { useGlobalStateContext } from 'hooks/useGlobalStateContext'
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
import { Themes, getSystemTheme } from 'lib/theme'
import { bracket } from 'lib/exampleKcl'
import {
@ -31,7 +31,7 @@ function OnboardingWithNewFile() {
settings: {
context: { defaultDirectory },
},
} = useGlobalStateContext()
} = useSettingsAuthContext()
async function createAndOpenNewProject() {
const projects = await getProjectsInDir(defaultDirectory)
@ -111,7 +111,7 @@ export default function Introduction() {
context: { theme },
},
},
} = useGlobalStateContext()
} = useSettingsAuthContext()
const getLogoTheme = () =>
theme === Themes.Light ||
(theme === Themes.System && getSystemTheme() === Themes.Light)