diff --git a/src/main/main.ts b/src/main/main.ts
index 0f307a007..ffc8de619 100644
--- a/src/main/main.ts
+++ b/src/main/main.ts
@@ -1,4 +1,4 @@
-import { app, globalShortcut, ipcMain as ipc, nativeTheme } from 'electron';
+import { app, globalShortcut, ipcMain as ipc } from 'electron';
import log from 'electron-log';
import { menubar } from 'menubar';
@@ -92,20 +92,6 @@ app.whenReady().then(async () => {
});
});
- nativeTheme.on('updated', () => {
- if (nativeTheme.shouldUseDarkColors) {
- mb.window.webContents.send(
- namespacedEvent('update-theme'),
- 'DARK_DEFAULT',
- );
- } else {
- mb.window.webContents.send(
- namespacedEvent('update-theme'),
- 'LIGHT_DEFAULT',
- );
- }
- });
-
/**
* Gitify custom IPC events
*/
diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx
index eda622c32..d3ad42080 100644
--- a/src/renderer/App.tsx
+++ b/src/renderer/App.tsx
@@ -21,10 +21,6 @@ import { NotificationsRoute } from './routes/Notifications';
import { SettingsRoute } from './routes/Settings';
import './App.css';
-import {
- DEFAULT_DAY_COLOR_SCHEME,
- DEFAULT_NIGHT_COLOR_SCHEME,
-} from './utils/theme';
function RequireAuth({ children }) {
const { isLoggedIn } = useContext(AppContext);
@@ -39,11 +35,7 @@ function RequireAuth({ children }) {
export const App = () => {
return (
-
+
diff --git a/src/renderer/components/settings/AppearanceSettings.tsx b/src/renderer/components/settings/AppearanceSettings.tsx
index a2cfb3210..5d58ed82d 100644
--- a/src/renderer/components/settings/AppearanceSettings.tsx
+++ b/src/renderer/components/settings/AppearanceSettings.tsx
@@ -1,5 +1,5 @@
-import { ipcRenderer, webFrame } from 'electron';
-import { type FC, useContext, useEffect, useState } from 'react';
+import { webFrame } from 'electron';
+import { type FC, useContext, useState } from 'react';
import {
CheckIcon,
@@ -21,19 +21,11 @@ import {
Select,
Stack,
Text,
- useTheme,
} from '@primer/react';
-import { namespacedEvent } from '../../../shared/events';
import { AppContext } from '../../context/App';
import { Size, Theme } from '../../types';
import { hasMultipleAccounts } from '../../utils/auth/utils';
-import {
- DEFAULT_DAY_COLOR_SCHEME,
- DEFAULT_NIGHT_COLOR_SCHEME,
- isDayScheme,
- setScrollbarTheme,
-} from '../../utils/theme';
import { zoomLevelToPercentage, zoomPercentageToLevel } from '../../utils/zoom';
import { Checkbox } from '../fields/Checkbox';
import { FieldLabel } from '../fields/FieldLabel';
@@ -43,27 +35,11 @@ let timeout: NodeJS.Timeout;
const DELAY = 200;
export const AppearanceSettings: FC = () => {
- const { setColorMode, setDayScheme, setNightScheme } = useTheme();
const { auth, settings, updateSetting } = useContext(AppContext);
const [zoomPercentage, setZoomPercentage] = useState(
zoomLevelToPercentage(webFrame.getZoomLevel()),
);
- useEffect(() => {
- ipcRenderer.on(
- namespacedEvent('update-theme'),
- (_, updatedTheme: Theme) => {
- if (settings.theme === Theme.SYSTEM) {
- const mode = isDayScheme(updatedTheme) ? 'day' : 'night';
- setColorMode('auto');
- setDayScheme(DEFAULT_DAY_COLOR_SCHEME);
- setNightScheme(DEFAULT_NIGHT_COLOR_SCHEME);
- setScrollbarTheme(mode);
- }
- },
- );
- }, [settings.theme, setColorMode, setDayScheme, setNightScheme]);
-
window.addEventListener('resize', () => {
// clear the timeout
clearTimeout(timeout);
diff --git a/src/renderer/context/App.tsx b/src/renderer/context/App.tsx
index bc477aba5..6aadc648b 100644
--- a/src/renderer/context/App.tsx
+++ b/src/renderer/context/App.tsx
@@ -56,9 +56,8 @@ import { clearState, loadState, saveState } from '../utils/storage';
import {
DEFAULT_DAY_COLOR_SCHEME,
DEFAULT_NIGHT_COLOR_SCHEME,
- isDayScheme,
+ mapThemeModeToColorMode,
mapThemeModeToColorScheme,
- setScrollbarTheme,
} from '../utils/theme';
import { zoomPercentageToLevel } from '../utils/zoom';
@@ -155,17 +154,12 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
}, []);
useEffect(() => {
+ const colorMode = mapThemeModeToColorMode(settings.theme);
const colorScheme = mapThemeModeToColorScheme(settings.theme);
- if (isDayScheme(settings.theme)) {
- setDayScheme(colorScheme ?? DEFAULT_DAY_COLOR_SCHEME);
- setColorMode('day');
- setScrollbarTheme('day');
- } else {
- setNightScheme(colorScheme ?? DEFAULT_NIGHT_COLOR_SCHEME);
- setColorMode('night');
- setScrollbarTheme('night');
- }
+ setColorMode(colorMode);
+ setDayScheme(colorScheme ?? DEFAULT_DAY_COLOR_SCHEME);
+ setNightScheme(colorScheme ?? DEFAULT_NIGHT_COLOR_SCHEME);
}, [settings.theme, setColorMode, setDayScheme, setNightScheme]);
// biome-ignore lint/correctness/useExhaustiveDependencies: We only want fetchNotifications to be called for account changes
diff --git a/src/renderer/routes/Notifications.tsx b/src/renderer/routes/Notifications.tsx
index 6b9b8b354..407549a3c 100644
--- a/src/renderer/routes/Notifications.tsx
+++ b/src/renderer/routes/Notifications.tsx
@@ -2,6 +2,7 @@ import { type FC, useContext, useMemo } from 'react';
import { AllRead } from '../components/AllRead';
import { Oops } from '../components/Oops';
+import { Page } from '../components/layout/Page';
import { AccountNotifications } from '../components/notifications/AccountNotifications';
import { AppContext } from '../context/App';
import { getAccountUUID } from '../utils/auth/utils';
@@ -35,7 +36,7 @@ export const NotificationsRoute: FC = () => {
}
return (
- <>
+
{notifications.map((accountNotifications) => (
{
showAccountHeader={hasMultipleAccounts || settings.showAccountHeader}
/>
))}
- >
+
);
};
diff --git a/src/renderer/routes/__snapshots__/Notifications.test.tsx.snap b/src/renderer/routes/__snapshots__/Notifications.test.tsx.snap
index a8bb76bc4..05d667890 100644
--- a/src/renderer/routes/__snapshots__/Notifications.test.tsx.snap
+++ b/src/renderer/routes/__snapshots__/Notifications.test.tsx.snap
@@ -419,15 +419,25 @@ exports[`renderer/routes/Notifications.tsx should render itself & its children (
"asFragment": [Function],
"baseElement":
+
+
+ AccountNotifications
+
+
+
+ ,
+ "container":
+
+
+ AccountNotifications
+
+
+ AccountNotifications
+
+
+
+