diff --git a/src/components/Settings/AppearanceSettings.tsx b/src/components/Settings/AppearanceSettings.tsx index a4bcef99..c2f40bb8 100644 --- a/src/components/Settings/AppearanceSettings.tsx +++ b/src/components/Settings/AppearanceSettings.tsx @@ -15,14 +15,14 @@ export function AppearanceSettings() { return ( ( { ( {' '} diff --git a/src/main.ts b/src/main.ts index 9c4ad33a..9fbed470 100644 --- a/src/main.ts +++ b/src/main.ts @@ -198,9 +198,9 @@ const createWindow = async () => { app.whenReady().then(async () => { await initSettings() appSettings = await getSettings() - nativeTheme.themeSource = appSettings.appearance.theme + nativeTheme.themeSource = appSettings.general.appearance.theme - await sendReport(appSettings.usageReport) + await sendReport(appSettings.general.usageReport) await createSplashWindow() await setupProjectStructure() await createWindow() @@ -353,7 +353,7 @@ ipcMain.handle( browserWindow, resolvedScriptPath, appSettings.proxy.port, - appSettings.usageReport.enabled + appSettings.general.usageReport.enabled ) } ) @@ -628,12 +628,12 @@ async function applySettings( if (modifiedSettings.recorder) { appSettings.recorder = modifiedSettings.recorder } - if (modifiedSettings.usageReport) { - appSettings.usageReport = modifiedSettings.usageReport + if (modifiedSettings.general?.usageReport) { + appSettings.general.usageReport = modifiedSettings.general.usageReport } - if (modifiedSettings.appearance) { - appSettings.appearance = modifiedSettings.appearance - nativeTheme.themeSource = appSettings.appearance.theme + if (modifiedSettings.general?.appearance) { + appSettings.general.appearance = modifiedSettings.general.appearance + nativeTheme.themeSource = appSettings.general.appearance.theme } } diff --git a/src/schemas/settings/v1/index.ts b/src/schemas/settings/v1/index.ts index 6d04b894..897e024f 100644 --- a/src/schemas/settings/v1/index.ts +++ b/src/schemas/settings/v1/index.ts @@ -117,8 +117,10 @@ export function migrate( proxy: settings.proxy, recorder: settings.recorder, windowState: settings.windowState, - usageReport: settings.usageReport, - appearance: settings.appearance, + general: { + usageReport: settings.usageReport, + appearance: settings.appearance, + }, } } diff --git a/src/schemas/settings/v2/index.ts b/src/schemas/settings/v2/index.ts index 758adfbb..aaea7bf0 100644 --- a/src/schemas/settings/v2/index.ts +++ b/src/schemas/settings/v2/index.ts @@ -20,8 +20,10 @@ export const AppSettingsSchema = z.object({ proxy: ProxySettingsSchema, recorder: RecorderSettingsSchema, windowState: WindowStateSchema, - usageReport: UsageReportSettingsSchema, - appearance: AppearanceSchema, + general: z.object({ + usageReport: UsageReportSettingsSchema, + appearance: AppearanceSchema, + }), }) export type AppSettings = z.infer diff --git a/src/settings.ts b/src/settings.ts index d2983f72..46d016e1 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -24,11 +24,13 @@ const defaultSettings: AppSettings = { y: 0, isMaximized: true, }, - usageReport: { - enabled: true, - }, - appearance: { - theme: 'system', + general: { + usageReport: { + enabled: true, + }, + appearance: { + theme: 'system', + }, }, }