From 8135c2a861b827fd6e70d3289ce73ae336e6b237 Mon Sep 17 00:00:00 2001 From: William Grant Date: Tue, 11 Oct 2022 11:46:01 +1100 Subject: [PATCH] fix: make cleaner defaults for switchThemeTo function --- ts/components/AboutView.tsx | 2 -- ts/components/DebugLogView.tsx | 2 -- ts/components/SessionPasswordPrompt.tsx | 2 -- ts/components/leftpane/ActionsPanel.tsx | 1 - ts/themes/switchTheme.tsx | 6 +++--- 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/ts/components/AboutView.tsx b/ts/components/AboutView.tsx index 363584729..3af5df44a 100644 --- a/ts/components/AboutView.tsx +++ b/ts/components/AboutView.tsx @@ -38,8 +38,6 @@ export const AboutView = () => { if ((window as any).theme) { void switchThemeTo({ theme: (window as any).theme, - mainWindow: false, - resetPrimaryColor: false, }); } }, []); diff --git a/ts/components/DebugLogView.tsx b/ts/components/DebugLogView.tsx index 377e2137d..2eeb809cd 100644 --- a/ts/components/DebugLogView.tsx +++ b/ts/components/DebugLogView.tsx @@ -103,8 +103,6 @@ export const DebugLogView = () => { if ((window as any).theme) { void switchThemeTo({ theme: (window as any).theme, - mainWindow: false, - resetPrimaryColor: false, }); } }, []); diff --git a/ts/components/SessionPasswordPrompt.tsx b/ts/components/SessionPasswordPrompt.tsx index 5c7c44817..5f4c0b934 100644 --- a/ts/components/SessionPasswordPrompt.tsx +++ b/ts/components/SessionPasswordPrompt.tsx @@ -194,8 +194,6 @@ export const SessionPasswordPrompt = () => { if ((window as any).theme) { void switchThemeTo({ theme: (window as any).theme, - mainWindow: false, - resetPrimaryColor: false, }); } }, []); diff --git a/ts/components/leftpane/ActionsPanel.tsx b/ts/components/leftpane/ActionsPanel.tsx index 575b015c0..43f23ca0d 100644 --- a/ts/components/leftpane/ActionsPanel.tsx +++ b/ts/components/leftpane/ActionsPanel.tsx @@ -164,7 +164,6 @@ const setupTheme = async () => { await switchThemeTo({ theme, mainWindow: true, - resetPrimaryColor: false, dispatch: window?.inboxStore?.dispatch || undefined, }); diff --git a/ts/themes/switchTheme.tsx b/ts/themes/switchTheme.tsx index 118ec5df4..fecb0b225 100644 --- a/ts/themes/switchTheme.tsx +++ b/ts/themes/switchTheme.tsx @@ -8,13 +8,13 @@ import { findPrimaryColorId, switchPrimaryColorTo } from './switchPrimaryColor'; type SwitchThemeProps = { theme: ThemeStateType; - mainWindow: boolean; - resetPrimaryColor: boolean; + mainWindow?: boolean; + resetPrimaryColor?: boolean; dispatch?: Dispatch; }; export async function switchThemeTo(props: SwitchThemeProps) { - const { theme, mainWindow = true, resetPrimaryColor = true, dispatch } = props; + const { theme, mainWindow, resetPrimaryColor, dispatch } = props; let newTheme: ThemeStateType | null = null; switch (theme) {