Skip to content

Commit

Permalink
fix: avoid blinking on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
notmedia committed Aug 17, 2022
1 parent 1603446 commit 96717fd
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@ import { Main } from './pages';
import { ThemeType, useSettingsStore } from './storage';
import { DarkTheme, globalStyles, LightTheme } from './themes';

export const THEMES = {
[ThemeType.Dark]: DarkTheme,
[ThemeType.Light]: LightTheme,
};

function App(): JSX.Element {
const theme =
useSettingsStore((store) => store.theme) === ThemeType.Dark ? DarkTheme : LightTheme;
const theme = useSettingsStore((store) => store.theme);

globalStyles();

return (
<NextUIProvider theme={theme}>
<NotificationContainer />
<Main />
</NextUIProvider>
theme && (
<NextUIProvider theme={THEMES[theme]}>
<NotificationContainer />
<Main />
</NextUIProvider>
)
);
}

Expand Down

0 comments on commit 96717fd

Please sign in to comment.