Skip to content

Commit 576e0e8

Browse files
committed
feat(settings): improve tooltips
Signed-off-by: Adam Setch <[email protected]>
1 parent 3835d0c commit 576e0e8

File tree

6 files changed

+189
-4
lines changed

6 files changed

+189
-4
lines changed

src/renderer/components/fields/Tooltip.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,28 @@ export interface ITooltip {
99

1010
export const Tooltip: FC<ITooltip> = (props: ITooltip) => {
1111
const [showTooltip, setShowTooltip] = useState(false);
12+
// Use CSS/Tailwind to center the tooltip and constrain its width to the
13+
// viewport so it doesn't overflow the application window.
1214

1315
return (
1416
<button
1517
aria-label={props.name}
1618
className="relative"
1719
data-testid={`tooltip-${props.name}`}
1820
id={props.name}
21+
onBlur={() => setShowTooltip(false)}
22+
onFocus={() => setShowTooltip(true)}
1923
onMouseEnter={() => setShowTooltip(true)}
2024
onMouseLeave={() => setShowTooltip(false)}
2125
type="button"
2226
>
2327
<QuestionIcon className="text-gitify-tooltip-icon" />
2428
{showTooltip && (
25-
<div className="absolute left-[-80px] z-10 w-30 rounded-sm border border-gray-300 p-2 shadow-sm bg-gitify-tooltip-popout">
29+
<div
30+
className={
31+
'absolute left-1/2 top-full mt-2 z-10 w-[240px] max-w-[calc(100vw-16px)] -translate-x-1/2 rounded-sm border border-gray-300 p-2 shadow-sm bg-gitify-tooltip-popout'
32+
}
33+
>
2634
<div className="text-left text-xs text-gitify-font">
2735
{props.tooltip}
2836
</div>

src/renderer/components/settings/AppearanceSettings.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,13 @@ export const AppearanceSettings: FC = () => {
9696
onChange={(evt) =>
9797
updateSetting('increaseContrast', evt.target.checked)
9898
}
99-
tooltip={<Text>Enable high contrast.</Text>}
99+
tooltip={
100+
<Text>
101+
Enable high contrast colors for improved legibility. This
102+
increases color contrast across the UI and may affect some
103+
color-specific themes.
104+
</Text>
105+
}
100106
/>
101107

102108
<Stack
@@ -159,6 +165,12 @@ export const AppearanceSettings: FC = () => {
159165
onChange={(evt) =>
160166
updateSetting('showAccountHeader', evt.target.checked)
161167
}
168+
tooltip={
169+
<Text>
170+
When enabled, displays an account header (avatar, username and
171+
quick links) above the notifications list.
172+
</Text>
173+
}
162174
visible={!hasMultipleAccounts(auth)}
163175
/>
164176

@@ -171,7 +183,9 @@ export const AppearanceSettings: FC = () => {
171183
}
172184
tooltip={
173185
<Text>
174-
Wrap long notification titles instead of truncating them.
186+
Wrap long notification titles onto multiple lines instead of
187+
truncating with an ellipsis. This shows the full title but may
188+
increase the height of the notification list.
175189
</Text>
176190
}
177191
/>

src/renderer/components/settings/NotificationSettings.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ export const NotificationSettings: FC = () => {
5858
{ label: 'Repository', value: GroupBy.REPOSITORY },
5959
{ label: 'Date', value: GroupBy.DATE },
6060
]}
61+
tooltip={
62+
<Stack direction="vertical" gap="condensed">
63+
<Text>Choose how notifications are displayed in the list.</Text>
64+
<Text>
65+
<Text as="strong">Repository</Text> groups notifications by
66+
their repository full name.
67+
</Text>
68+
<Text>
69+
<Text as="strong">Date</Text> shows notifications in
70+
chronological order.
71+
</Text>
72+
</Stack>
73+
}
6174
value={settings.groupBy}
6275
/>
6376

@@ -298,7 +311,7 @@ export const NotificationSettings: FC = () => {
298311
only participating notifications.
299312
</Text>
300313
<Text>
301-
When <Text as="em">unchecked</Text>, {APPLICATION.NAME} will
314+
When <Text as="u">unchecked</Text>, {APPLICATION.NAME} will
302315
fetch participating and watching notifications.
303316
</Text>
304317
<Text>

src/renderer/components/settings/SystemSettings.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ export const SystemSettings: FC = () => {
3232
{ label: 'Foreground', value: OpenPreference.FOREGROUND },
3333
{ label: 'Background', value: OpenPreference.BACKGROUND },
3434
]}
35+
tooltip={
36+
<Stack direction="vertical" gap="condensed">
37+
<Text>
38+
Controls the behavior of how external links should opened.
39+
</Text>
40+
<Text>
41+
<Text as="strong">Foreground</Text> will open the link and bring
42+
the opened window or browser to the front.
43+
</Text>
44+
<Text>
45+
<Text as="strong">Background</Text> opens the link without
46+
stealing focus from the current window.
47+
</Text>
48+
</Stack>
49+
}
3550
value={settings.openLinks}
3651
/>
3752

@@ -60,6 +75,12 @@ export const SystemSettings: FC = () => {
6075
onChange={(evt) =>
6176
updateSetting('showNotifications', evt.target.checked)
6277
}
78+
tooltip={
79+
<Text>
80+
Display native operating system notifications for new unread
81+
notifications.
82+
</Text>
83+
}
6384
/>
6485

6586
<Stack
@@ -136,6 +157,9 @@ export const SystemSettings: FC = () => {
136157
label="Open at startup"
137158
name="openAtStartup"
138159
onChange={(evt) => updateSetting('openAtStartup', evt.target.checked)}
160+
tooltip={
161+
<Text>Launch {APPLICATION.NAME} automatically at startup.</Text>
162+
}
139163
visible={!window.gitify.platform.isLinux()}
140164
/>
141165
</Stack>

src/renderer/components/settings/TraySettings.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export const TraySettings: FC = () => {
2424
onChange={(evt) =>
2525
updateSetting('showNotificationsCountInTray', evt.target.checked)
2626
}
27+
tooltip={
28+
<Text>
29+
Show the unread notification count next to the tray icon. Useful
30+
for a quick glance at unread activity.
31+
</Text>
32+
}
2733
visible={window.gitify.platform.isMacOS()}
2834
/>
2935

src/renderer/routes/__snapshots__/Settings.test.tsx.snap

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

0 commit comments

Comments
 (0)