Skip to content

Commit b5b3585

Browse files
authored
feat: Update sidebar icons & add quit button for logged out users (#467)
* feat: Update sidebar icons & add quit button for logged out users * Update README.md
1 parent af960b8 commit b5b3585

File tree

6 files changed

+144
-14
lines changed

6 files changed

+144
-14
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ brew install --cask gitify
1414

1515
Gitify supports macOS, Windows and Linux.
1616

17-
### Prerequisites
17+
### Prerequisites & Libraries
1818

19-
- Node 10+
19+
- Node 12+
2020
- [Yarn](https://yarnpkg.com/)
2121
- [Electron](https://electronjs.org/)
2222
- [TypeScript](https://www.typescriptlang.org/)
2323
- [React](https://reactjs.org/)
24-
- [Redux](http://redux.js.org/)
24+
- [Tailwind CSS](https://tailwindcss.com/)
2525

2626
### Installation
2727

@@ -37,7 +37,7 @@ To watch for changes(`webpack`) in the `src` directory:
3737

3838
yarn run watch
3939

40-
To run the actual **electron app**:
40+
To run the **electron app**:
4141

4242
yarn start
4343

src/components/Sidebar.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import React, { useCallback, useContext, useMemo } from 'react';
2-
import { shell } from 'electron';
2+
import { shell, ipcRenderer } from 'electron';
33
import * as Octicons from '@primer/octicons-react';
44
import { useHistory } from 'react-router-dom';
55

66
import { AppContext } from '../context/App';
77
import { Constants } from '../utils/constants';
8+
import { IconCog } from '../icons/Cog';
9+
import { IconRefresh } from '../icons/Refresh';
810
import { Logo } from '../components/Logo';
11+
import { IconQuit } from '../icons/Quit';
912

1013
export const Sidebar: React.FC = () => {
1114
const history = useHistory();
@@ -17,6 +20,10 @@ export const Sidebar: React.FC = () => {
1720
shell.openExternal(`https://github.com/${Constants.REPO_SLUG}`);
1821
}, []);
1922

23+
const quitApp = useCallback(() => {
24+
ipcRenderer.send('app-quit');
25+
}, []);
26+
2027
const notificationsCount = useMemo(() => {
2128
return notifications.reduce(
2229
(memo, account) => memo + account.notifications.length,
@@ -51,25 +58,35 @@ export const Sidebar: React.FC = () => {
5158
onClick={fetchNotifications}
5259
aria-label="Refresh Notifications"
5360
>
54-
<Octicons.SyncIcon size={16} />
61+
<IconRefresh className="w-3.5 h-3.5" />
5562
</button>
5663

5764
<button
5865
className={footerButtonClasses}
5966
onClick={() => history.push('/settings')}
6067
aria-label="Settings"
6168
>
62-
<Octicons.GearIcon size={16} />
69+
<IconCog className="w-4 h-4" />
6370
</button>
6471
</>
6572
)}
6673

74+
{!isLoggedIn && (
75+
<button
76+
className={footerButtonClasses}
77+
onClick={quitApp}
78+
aria-label="Quit App"
79+
>
80+
<IconQuit className="w-3.5 h-3.5" />
81+
</button>
82+
)}
83+
6784
<div
6885
className={footerButtonClasses}
6986
onClick={onOpenBrowser}
7087
aria-label="View project on GitHub"
7188
>
72-
<Octicons.MarkGithubIcon size={14} />
89+
<Octicons.MarkGithubIcon size={15} />
7390
</div>
7491
</div>
7592
</div>

src/components/__snapshots__/Sidebar.test.tsx.snap

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,37 @@ exports[`components/Sidebar.tsx should render itself & its children (logged in)
8181
<div
8282
className="py-4 px-3"
8383
>
84+
<button
85+
aria-label="Quit App"
86+
className="flex justify-evenly items-center bg-transparent border-0 w-full text-sm text-white my-1 py-2 cursor-pointer hover:text-gray-500 focus:outline-none"
87+
onClick={[Function]}
88+
>
89+
<svg
90+
aria-hidden="true"
91+
aria-labelledby="iconQuitId"
92+
className="w-3.5 h-3.5"
93+
role="img"
94+
viewBox="0 0 512 512"
95+
xmlns="http://www.w3.org/2000/svg"
96+
>
97+
<title
98+
id="iconQuitId"
99+
>
100+
Quit Application
101+
</title>
102+
<g>
103+
<path
104+
d="M272 0a23.94 23.94 0 0124 24v240a23.94 23.94 0 01-24 24h-32a23.94 23.94 0 01-24-24V24a23.94 23.94 0 0124-24z"
105+
fill="currentColor"
106+
opacity={0.4}
107+
/>
108+
<path
109+
d="M504 256c0 136.8-110.8 247.7-247.5 248C120 504.3 8.2 393 8 256.4A248 248 0 01111.8 54.2a24.07 24.07 0 0135 7.7L162.6 90a24 24 0 01-6.6 31 168 168 0 00100 303c91.6 0 168.6-74.2 168-169.1a168.07 168.07 0 00-68.1-134 23.86 23.86 0 01-6.5-30.9l15.8-28.1a24 24 0 0134.8-7.8A247.51 247.51 0 01504 256z"
110+
fill="currentColor"
111+
/>
112+
</g>
113+
</svg>
114+
</button>
84115
<div
85116
aria-label="View project on GitHub"
86117
className="flex justify-evenly items-center bg-transparent border-0 w-full text-sm text-white my-1 py-2 cursor-pointer hover:text-gray-500 focus:outline-none"
@@ -95,7 +126,7 @@ exports[`components/Sidebar.tsx should render itself & its children (logged in)
95126
}
96127
}
97128
fill="currentColor"
98-
height={14}
129+
height={15}
99130
role="img"
100131
style={
101132
Object {
@@ -105,7 +136,7 @@ exports[`components/Sidebar.tsx should render itself & its children (logged in)
105136
}
106137
}
107138
viewBox="0 0 16 16"
108-
width={14}
139+
width={15}
109140
/>
110141
</div>
111142
</div>
@@ -193,6 +224,37 @@ exports[`components/Sidebar.tsx should render itself & its children (logged out)
193224
<div
194225
className="py-4 px-3"
195226
>
227+
<button
228+
aria-label="Quit App"
229+
className="flex justify-evenly items-center bg-transparent border-0 w-full text-sm text-white my-1 py-2 cursor-pointer hover:text-gray-500 focus:outline-none"
230+
onClick={[Function]}
231+
>
232+
<svg
233+
aria-hidden="true"
234+
aria-labelledby="iconQuitId"
235+
className="w-3.5 h-3.5"
236+
role="img"
237+
viewBox="0 0 512 512"
238+
xmlns="http://www.w3.org/2000/svg"
239+
>
240+
<title
241+
id="iconQuitId"
242+
>
243+
Quit Application
244+
</title>
245+
<g>
246+
<path
247+
d="M272 0a23.94 23.94 0 0124 24v240a23.94 23.94 0 01-24 24h-32a23.94 23.94 0 01-24-24V24a23.94 23.94 0 0124-24z"
248+
fill="currentColor"
249+
opacity={0.4}
250+
/>
251+
<path
252+
d="M504 256c0 136.8-110.8 247.7-247.5 248C120 504.3 8.2 393 8 256.4A248 248 0 01111.8 54.2a24.07 24.07 0 0135 7.7L162.6 90a24 24 0 01-6.6 31 168 168 0 00100 303c91.6 0 168.6-74.2 168-169.1a168.07 168.07 0 00-68.1-134 23.86 23.86 0 01-6.5-30.9l15.8-28.1a24 24 0 0134.8-7.8A247.51 247.51 0 01504 256z"
253+
fill="currentColor"
254+
/>
255+
</g>
256+
</svg>
257+
</button>
196258
<div
197259
aria-label="View project on GitHub"
198260
className="flex justify-evenly items-center bg-transparent border-0 w-full text-sm text-white my-1 py-2 cursor-pointer hover:text-gray-500 focus:outline-none"
@@ -207,7 +269,7 @@ exports[`components/Sidebar.tsx should render itself & its children (logged out)
207269
}
208270
}
209271
fill="currentColor"
210-
height={14}
272+
height={15}
211273
role="img"
212274
style={
213275
Object {
@@ -217,7 +279,7 @@ exports[`components/Sidebar.tsx should render itself & its children (logged out)
217279
}
218280
}
219281
viewBox="0 0 16 16"
220-
width={14}
282+
width={15}
221283
/>
222284
</div>
223285
</div>

src/icons/Cog.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import * as React from 'react';
2+
3+
export const IconCog = ({ className = '' }: { className?: string }) => {
4+
return (
5+
<svg
6+
aria-hidden="true"
7+
className={className}
8+
xmlns="http://www.w3.org/2000/svg"
9+
viewBox="0 0 512 512"
10+
>
11+
<g className="prefix__fa-group">
12+
<path
13+
className="prefix__fa-secondary"
14+
fill="currentColor"
15+
d="M487.75 315.6l-42.6-24.6a192.62 192.62 0 000-70.2l42.6-24.6a12.11 12.11 0 005.5-14 249.2 249.2 0 00-54.7-94.6 12 12 0 00-14.8-2.3l-42.6 24.6a188.83 188.83 0 00-60.8-35.1V25.7A12 12 0 00311 14a251.43 251.43 0 00-109.2 0 12 12 0 00-9.4 11.7v49.2a194.59 194.59 0 00-60.8 35.1L89.05 85.4a11.88 11.88 0 00-14.8 2.3 247.66 247.66 0 00-54.7 94.6 12 12 0 005.5 14l42.6 24.6a192.62 192.62 0 000 70.2l-42.6 24.6a12.08 12.08 0 00-5.5 14 249 249 0 0054.7 94.6 12 12 0 0014.8 2.3l42.6-24.6a188.54 188.54 0 0060.8 35.1v49.2a12 12 0 009.4 11.7 251.43 251.43 0 00109.2 0 12 12 0 009.4-11.7v-49.2a194.7 194.7 0 0060.8-35.1l42.6 24.6a11.89 11.89 0 0014.8-2.3 247.52 247.52 0 0054.7-94.6 12.36 12.36 0 00-5.6-14.1zm-231.4 36.2a95.9 95.9 0 1195.9-95.9 95.89 95.89 0 01-95.9 95.9z"
16+
opacity={0.4}
17+
/>
18+
<path
19+
className="prefix__fa-primary"
20+
fill="currentColor"
21+
d="M256.35 319.8a63.9 63.9 0 1163.9-63.9 63.9 63.9 0 01-63.9 63.9z"
22+
/>
23+
</g>
24+
</svg>
25+
);
26+
};

src/icons/Refresh.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import * as React from 'react';
2+
3+
export const IconRefresh = ({ className = '' }: { className?: string }) => {
4+
return (
5+
<svg
6+
aria-hidden="true"
7+
className={className}
8+
xmlns="http://www.w3.org/2000/svg"
9+
viewBox="0 0 512 512"
10+
>
11+
<g className="prefix__fa-group">
12+
<path
13+
className="prefix__fa-secondary"
14+
fill="currentColor"
15+
d="M0 500V299.67a12 12 0 0112-12h200.33a12 12 0 0112 12v47.41a12 12 0 01-12.57 12l-101.87-4.88a176.07 176.07 0 00317.25-56.94 12 12 0 0111.67-9.26h49.09a12 12 0 0111.8 14.18C478.07 417.08 377.19 504 256 504a247.43 247.43 0 01-188.76-87.17l4.13 82.57a12 12 0 01-12 12.6H12a12 12 0 01-12-12z"
16+
opacity={0.4}
17+
/>
18+
<path
19+
className="prefix__fa-primary"
20+
fill="currentColor"
21+
d="M12.3 209.82C33.93 94.92 134.81 8 256 8a247.4 247.4 0 01188.9 87.34l-4-82.77A12 12 0 01452.92 0h47.41a12 12 0 0112 12v200.33a12 12 0 01-12 12H300a12 12 0 01-12-12v-47.41a12 12 0 0112.57-12l101.53 4.88a176.07 176.07 0 00-317.24 56.94A12 12 0 0173.19 224H24.1a12 12 0 01-11.8-14.18z"
22+
/>
23+
</g>
24+
</svg>
25+
);
26+
};

src/routes/Settings.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
const { ipcRenderer, remote } = require('electron');
2-
31
import React, { useCallback, useContext } from 'react';
2+
import { ipcRenderer, remote } from 'electron';
43
import { useHistory } from 'react-router-dom';
54
import { ArrowLeftIcon } from '@primer/octicons-react';
65

0 commit comments

Comments
 (0)