diff --git a/src/main/handlers/tray.ts b/src/main/handlers/tray.ts index 67b552a1b..b3f013d91 100644 --- a/src/main/handlers/tray.ts +++ b/src/main/handlers/tray.ts @@ -21,13 +21,14 @@ export function registerTrayHandlers(mb: Menubar): void { return; } const { notificationsCount, isOnline } = status; - const icon = !isOnline - ? TrayIcons.offline - : notificationsCount < 0 - ? TrayIcons.error - : notificationsCount > 0 && highlightUnread - ? TrayIcons.active - : getIdleTrayIcon(appearance); + let icon = getIdleTrayIcon(appearance); + if (!isOnline) { + icon = TrayIcons.offline; + } else if (notificationsCount < 0) { + icon = TrayIcons.error; + } else if (notificationsCount > 0 && highlightUnread) { + icon = TrayIcons.active; + } mb.tray.setImage(icon); }; diff --git a/src/renderer/components/settings/SystemSettings.tsx b/src/renderer/components/settings/SystemSettings.tsx index 1b2c5813f..af8aaf4ad 100644 --- a/src/renderer/components/settings/SystemSettings.tsx +++ b/src/renderer/components/settings/SystemSettings.tsx @@ -121,6 +121,11 @@ export const SystemSettings: FC = () => { const hasLiveModifiers = liveModifierAccelerator.length > 0; const liveModifierDisplay = formatAcceleratorForDisplay(liveModifierAccelerator, isMac); + let shortcutButtonLabel = shortcutDisplay; + if (recordingShortcut) { + shortcutButtonLabel = hasLiveModifiers ? `${liveModifierDisplay}…` : 'Press keys…'; + } + return (
System @@ -237,11 +242,7 @@ export const SystemSettings: FC = () => { tabIndex={-1} > - {recordingShortcut - ? hasLiveModifiers - ? `${liveModifierDisplay}…` - : 'Press keys…' - : shortcutDisplay} + {shortcutButtonLabel} { const navigate = useNavigate(); @@ -232,17 +242,7 @@ export const AccountsRoute: FC = () => { ( - - )} + icon={() => } onClick={() => navigate('/account-scopes', { state: { account }, diff --git a/src/renderer/stores/useAccountsStore.ts b/src/renderer/stores/useAccountsStore.ts index 69ac7fd2f..a689d30a8 100644 --- a/src/renderer/stores/useAccountsStore.ts +++ b/src/renderer/stores/useAccountsStore.ts @@ -109,13 +109,12 @@ const useAccountsStore = create()( ); set({ - accounts: accounts.flatMap((account, index) => - replacesAccount(account) - ? index === existingAccountIndex - ? [newAccount] - : [] - : [account], - ), + accounts: accounts.flatMap((account, index) => { + if (!replacesAccount(account)) { + return [account]; + } + return index === existingAccountIndex ? [newAccount] : []; + }), }); } else { set({ accounts: [...accounts, newAccount] }); diff --git a/src/renderer/stores/useSettingsStore.ts b/src/renderer/stores/useSettingsStore.ts index 6f965758b..644aecd00 100644 --- a/src/renderer/stores/useSettingsStore.ts +++ b/src/renderer/stores/useSettingsStore.ts @@ -1,6 +1,8 @@ import { create } from 'zustand'; import { persist, subscribeWithSelector } from 'zustand/middleware'; +import type { TrayIconAppearance } from '../../shared/events'; + import { Constants } from '../constants'; import type { SettingsStore } from './types'; @@ -49,15 +51,16 @@ const useSettingsStore = create()( useAlternateIdleIcon: undefined, ...persisted, }; + let trayIconAppearance: TrayIconAppearance = 'auto'; + if (useAlternateIdleIcon === true) { + trayIconAppearance = 'light'; + } else if (useAlternateIdleIcon === false && !window.gitify.platform.isMacOS()) { + trayIconAppearance = 'dark'; + } return { ...DEFAULT_SETTINGS_STATE, ...settings, - trayIconAppearance: - useAlternateIdleIcon === true - ? 'light' - : useAlternateIdleIcon === false && !window.gitify.platform.isMacOS() - ? 'dark' - : 'auto', + trayIconAppearance, }; }, }, diff --git a/src/renderer/utils/system/keyboardShortcut.ts b/src/renderer/utils/system/keyboardShortcut.ts index f8090f79c..d479166c9 100644 --- a/src/renderer/utils/system/keyboardShortcut.ts +++ b/src/renderer/utils/system/keyboardShortcut.ts @@ -91,7 +91,10 @@ export function formatAcceleratorForDisplay(accelerator: string, isMac: boolean) .split('+') .map((segment) => { const entry = MODIFIER_SEGMENTS.find((m) => m.accelerator === segment); - return entry ? (isMac ? entry.mac : entry.other) : segment; + if (!entry) { + return segment; + } + return isMac ? entry.mac : entry.other; }) .join(isMac ? '·' : '+'); }