Skip to content

Commit 81a35e1

Browse files
authored
feat: Improve settings UI (#454)
* feat: add Icons to settings * chore: Fix tests
1 parent d7d7f4f commit 81a35e1

File tree

5 files changed

+167
-11
lines changed

5 files changed

+167
-11
lines changed

src/icons/AddAccount.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import * as React from 'react';
2+
3+
export const IconAddAccount = ({ 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 640 512"
10+
role="img"
11+
aria-labelledby="iconAddAccountId"
12+
>
13+
<title id="iconAddAccountId">Add Account</title>
14+
<g>
15+
<path
16+
fill="currentColor"
17+
d="M640 224v32a16 16 0 01-16 16h-64v64a16 16 0 01-16 16h-32a16 16 0 01-16-16v-64h-64a16 16 0 01-16-16v-32a16 16 0 0116-16h64v-64a16 16 0 0116-16h32a16 16 0 0116 16v64h64a16 16 0 0116 16z"
18+
opacity={0.4}
19+
/>
20+
<path
21+
fill="currentColor"
22+
d="M224 256A128 128 0 1096 128a128 128 0 00128 128zm89.6 32h-16.7a174.08 174.08 0 01-145.8 0h-16.7A134.43 134.43 0 000 422.4V464a48 48 0 0048 48h352a48 48 0 0048-48v-41.6A134.43 134.43 0 00313.6 288z"
23+
/>
24+
</g>
25+
</svg>
26+
);
27+
};

src/icons/Logout.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import * as React from 'react';
2+
3+
export const IconLogOut = ({ 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+
role="img"
11+
aria-labelledby="iconLogoutId"
12+
>
13+
<title id="iconLogoutId">Logout from all accounts</title>
14+
<g>
15+
<path
16+
fill="currentColor"
17+
d="M180 448H96a96 96 0 01-96-96V160a96 96 0 0196-96h84a12 12 0 0112 12v40a12 12 0 01-12 12H96a32 32 0 00-32 32v192a32 32 0 0032 32h84a12 12 0 0112 12v40a12 12 0 01-12 12z"
18+
opacity={0.4}
19+
/>
20+
<path
21+
fill="currentColor"
22+
d="M353 88.3l151.9 150.6a24 24 0 010 34.1l-152 150.8a24.08 24.08 0 01-33.9-.1l-21.9-21.9a24.07 24.07 0 01.8-34.7l77.6-71.1H184a23.94 23.94 0 01-24-24v-32a23.94 23.94 0 0124-24h191.5l-77.6-71.1a24 24 0 01-.7-34.6l21.9-21.9a24 24 0 0133.9-.1z"
23+
/>
24+
</g>
25+
</svg>
26+
);
27+
};

src/icons/Quit.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import * as React from 'react';
2+
3+
export const IconQuit = ({ 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+
role="img"
11+
aria-labelledby="iconQuitId"
12+
>
13+
<title id="iconQuitId">Quit Application</title>
14+
<g>
15+
<path
16+
fill="currentColor"
17+
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"
18+
opacity={0.4}
19+
/>
20+
<path
21+
fill="currentColor"
22+
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"
23+
/>
24+
</g>
25+
</svg>
26+
);
27+
};

src/js/routes/__snapshots__/settings.test.tsx.snap

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,24 +151,96 @@ exports[`routes/settings.tsx should render itself & its children 1`] = `
151151
<div>
152152
<button
153153
aria-label="Login with GitHub Enterprise"
154-
className="bg-gray-400 hover:bg-gray-500 hover:text-white rounded py-1 px-2 my-1 mx-2 text-sm focus:outline-none"
154+
className="hover:text-gray-500 py-1 px-2 my-1 mx-2 focus:outline-none"
155155
onClick={[Function]}
156156
>
157-
Add Enterprise
157+
<svg
158+
aria-hidden="true"
159+
aria-labelledby="iconAddAccountId"
160+
className="w-5 h-5"
161+
role="img"
162+
viewBox="0 0 640 512"
163+
xmlns="http://www.w3.org/2000/svg"
164+
>
165+
<title
166+
id="iconAddAccountId"
167+
>
168+
Add Account
169+
</title>
170+
<g>
171+
<path
172+
d="M640 224v32a16 16 0 01-16 16h-64v64a16 16 0 01-16 16h-32a16 16 0 01-16-16v-64h-64a16 16 0 01-16-16v-32a16 16 0 0116-16h64v-64a16 16 0 0116-16h32a16 16 0 0116 16v64h64a16 16 0 0116 16z"
173+
fill="currentColor"
174+
opacity={0.4}
175+
/>
176+
<path
177+
d="M224 256A128 128 0 1096 128a128 128 0 00128 128zm89.6 32h-16.7a174.08 174.08 0 01-145.8 0h-16.7A134.43 134.43 0 000 422.4V464a48 48 0 0048 48h352a48 48 0 0048-48v-41.6A134.43 134.43 0 00313.6 288z"
178+
fill="currentColor"
179+
/>
180+
</g>
181+
</svg>
158182
</button>
159183
<button
160184
aria-label="Logout"
161-
className="bg-gray-400 hover:bg-gray-500 hover:text-white rounded py-1 px-2 my-1 mx-2 text-sm focus:outline-none"
185+
className="hover:text-gray-500 py-1 px-2 my-1 mx-2 focus:outline-none"
162186
onClick={[Function]}
163187
>
164-
Logout
188+
<svg
189+
aria-hidden="true"
190+
aria-labelledby="iconLogoutId"
191+
className="w-5 h-5"
192+
role="img"
193+
viewBox="0 0 512 512"
194+
xmlns="http://www.w3.org/2000/svg"
195+
>
196+
<title
197+
id="iconLogoutId"
198+
>
199+
Logout from all accounts
200+
</title>
201+
<g>
202+
<path
203+
d="M180 448H96a96 96 0 01-96-96V160a96 96 0 0196-96h84a12 12 0 0112 12v40a12 12 0 01-12 12H96a32 32 0 00-32 32v192a32 32 0 0032 32h84a12 12 0 0112 12v40a12 12 0 01-12 12z"
204+
fill="currentColor"
205+
opacity={0.4}
206+
/>
207+
<path
208+
d="M353 88.3l151.9 150.6a24 24 0 010 34.1l-152 150.8a24.08 24.08 0 01-33.9-.1l-21.9-21.9a24.07 24.07 0 01.8-34.7l77.6-71.1H184a23.94 23.94 0 01-24-24v-32a23.94 23.94 0 0124-24h191.5l-77.6-71.1a24 24 0 01-.7-34.6l21.9-21.9a24 24 0 0133.9-.1z"
209+
fill="currentColor"
210+
/>
211+
</g>
212+
</svg>
165213
</button>
166214
<button
167215
aria-label="Quit Gitify"
168-
className="bg-gray-400 hover:bg-gray-500 hover:text-white rounded py-1 px-2 my-1 mx-2 text-sm focus:outline-none mr-0"
216+
className="hover:text-gray-500 py-1 px-2 my-1 mx-2 focus:outline-none mr-0"
169217
onClick={[Function]}
170218
>
171-
Quit
219+
<svg
220+
aria-hidden="true"
221+
aria-labelledby="iconQuitId"
222+
className="w-5 h-5"
223+
role="img"
224+
viewBox="0 0 512 512"
225+
xmlns="http://www.w3.org/2000/svg"
226+
>
227+
<title
228+
id="iconQuitId"
229+
>
230+
Quit Application
231+
</title>
232+
<g>
233+
<path
234+
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"
235+
fill="currentColor"
236+
opacity={0.4}
237+
/>
238+
<path
239+
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"
240+
fill="currentColor"
241+
/>
242+
</g>
243+
</svg>
172244
</button>
173245
</div>
174246
</div>

src/js/routes/settings.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { ArrowLeftIcon } from '@primer/octicons-react';
77
import { AppState, SettingsState } from '../../types/reducers';
88
import { fetchNotifications, updateSetting, logout } from '../actions';
99
import { FieldCheckbox } from '../components/ui/checkbox';
10+
import { IconAddAccount } from '../../icons/AddAccount';
11+
import { IconLogOut } from '../../icons/Logout';
12+
import { IconQuit } from '../../icons/Quit';
1013
import { updateTrayIcon } from '../utils/comms';
1114

1215
const isLinux = remote.process.platform === 'linux';
@@ -54,10 +57,10 @@ export class SettingsRoute extends React.Component<IProps> {
5457
}
5558

5659
render() {
57-
const { hasMultipleAccounts, settings } = this.props;
60+
const { settings } = this.props;
5861

5962
const footerButtonClass =
60-
'bg-gray-400 hover:bg-gray-500 hover:text-white rounded py-1 px-2 my-1 mx-2 text-sm focus:outline-none';
63+
'hover:text-gray-500 py-1 px-2 my-1 mx-2 focus:outline-none';
6164

6265
return (
6366
<div className="flex flex-1 flex-col">
@@ -129,23 +132,23 @@ export class SettingsRoute extends React.Component<IProps> {
129132
aria-label="Login with GitHub Enterprise"
130133
onClick={this.goToEnterprise.bind(this)}
131134
>
132-
Add Enterprise
135+
<IconAddAccount className="w-5 h-5" />
133136
</button>
134137

135138
<button
136139
className={footerButtonClass}
137140
aria-label="Logout"
138141
onClick={this.logout.bind(this)}
139142
>
140-
{hasMultipleAccounts ? 'Logout from all accounts' : 'Logout'}
143+
<IconLogOut className="w-5 h-5" />
141144
</button>
142145

143146
<button
144147
className={`${footerButtonClass} mr-0`}
145148
aria-label="Quit Gitify"
146149
onClick={this.quitApp}
147150
>
148-
Quit
151+
<IconQuit className="w-5 h-5" />
149152
</button>
150153
</div>
151154
</div>

0 commit comments

Comments
 (0)