Skip to content

Commit 3744758

Browse files
authored
feat: error tray icon (#1742)
Signed-off-by: Adam Setch <[email protected]>
1 parent 778d9f7 commit 3744758

File tree

15 files changed

+71
-45
lines changed

15 files changed

+71
-45
lines changed

assets/images/tray-error.png

1.88 KB
Loading

assets/images/[email protected]

3.21 KB
Loading

src/main/icons.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@ describe('main/icons.ts', () => {
44
it('should return icon images', () => {
55
expect(TrayIcons.active).toContain('assets/images/tray-active.png');
66

7-
expect(TrayIcons.activeUpdateIcon).toContain(
7+
expect(TrayIcons.activeWithUpdate).toContain(
88
'assets/images/tray-active-update.png',
99
);
1010

1111
expect(TrayIcons.idle).toContain('assets/images/tray-idleTemplate.png');
1212

13-
expect(TrayIcons.idleUpdateIcon).toContain(
13+
expect(TrayIcons.idleWithUpdate).toContain(
1414
'assets/images/tray-idle-update.png',
1515
);
1616

1717
expect(TrayIcons.idleAlternate).toContain(
1818
'assets/images/tray-idle-white.png',
1919
);
2020

21-
expect(TrayIcons.idleAlternateUpdateIcon).toContain(
21+
expect(TrayIcons.idleAlternateWithUpdate).toContain(
2222
'assets/images/tray-idle-white-update.png',
2323
);
24+
25+
expect(TrayIcons.error).toContain('assets/images/tray-error.png');
2426
});
2527
});

src/main/icons.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import path from 'node:path';
22

33
export const TrayIcons = {
44
active: getIconPath('tray-active.png'),
5-
activeUpdateIcon: getIconPath('tray-active-update.png'),
5+
activeWithUpdate: getIconPath('tray-active-update.png'),
66
idle: getIconPath('tray-idleTemplate.png'),
7-
idleUpdateIcon: getIconPath('tray-idle-update.png'),
7+
idleWithUpdate: getIconPath('tray-idle-update.png'),
88
idleAlternate: getIconPath('tray-idle-white.png'),
9-
idleAlternateUpdateIcon: getIconPath('tray-idle-white-update.png'),
9+
idleAlternateWithUpdate: getIconPath('tray-idle-white-update.png'),
10+
error: getIconPath('tray-error.png'),
1011
};
1112

1213
function getIconPath(iconName: string) {

src/main/main.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,17 @@ app.whenReady().then(async () => {
118118
},
119119
);
120120

121+
ipc.on(namespacedEvent('icon-error'), () => {
122+
if (!mb.tray.isDestroyed()) {
123+
mb.tray.setImage(TrayIcons.error);
124+
}
125+
});
126+
121127
ipc.on(namespacedEvent('icon-active'), () => {
122128
if (!mb.tray.isDestroyed()) {
123129
mb.tray.setImage(
124130
menuBuilder.isUpdateAvailable()
125-
? TrayIcons.activeUpdateIcon
131+
? TrayIcons.activeWithUpdate
126132
: TrayIcons.active,
127133
);
128134
}
@@ -133,13 +139,13 @@ app.whenReady().then(async () => {
133139
if (shouldUseAlternateIdleIcon) {
134140
mb.tray.setImage(
135141
menuBuilder.isUpdateAvailable()
136-
? TrayIcons.idleAlternateUpdateIcon
142+
? TrayIcons.idleAlternateWithUpdate
137143
: TrayIcons.idleAlternate,
138144
);
139145
} else {
140146
mb.tray.setImage(
141147
menuBuilder.isUpdateAvailable()
142-
? TrayIcons.idleUpdateIcon
148+
? TrayIcons.idleWithUpdate
143149
: TrayIcons.idle,
144150
);
145151
}

src/renderer/components/Oops.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const Oops: FC<IOops> = ({ error }: IOops) => {
1818
return (
1919
<Centered>
2020
<Stack direction="vertical" align="center">
21-
<div className="mt-2 mb-5 text-5xl">
21+
<div className="mt-2 text-5xl">
2222
<EmojiText text={emoji} />
2323
</div>
2424

src/renderer/components/__snapshots__/AllRead.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/components/__snapshots__/Oops.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/components/notifications/__snapshots__/AccountNotifications.test.tsx.snap

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/components/primitives/Centered.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface ICentered {
66

77
export const Centered: FC<ICentered> = (props: ICentered) => {
88
return (
9-
<div className="flex flex-1 flex-col items-center justify-center min-h-screen">
9+
<div className="flex flex-1 flex-col items-center justify-center p-8 min-h-screen">
1010
{props.children}
1111
</div>
1212
);

0 commit comments

Comments
 (0)