Skip to content

Commit d6908fe

Browse files
committed
feat: ability to set fetch type (interval or inactivity)
Signed-off-by: Adam Setch <[email protected]>
1 parent 48159db commit d6908fe

File tree

3 files changed

+63
-23
lines changed

3 files changed

+63
-23
lines changed

src/renderer/components/fields/RadioGroup.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import type { ChangeEvent, FC } from 'react';
1+
import type { ChangeEvent, FC, ReactNode } from 'react';
22

33
import { Stack } from '@primer/react';
44

55
import type { RadioGroupItem } from '../../types';
66
import { FieldLabel } from './FieldLabel';
7+
import { Tooltip } from './Tooltip';
78

89
export interface IRadioGroup {
910
name: string;
1011
label: string;
1112
options: RadioGroupItem[];
1213
value: string;
1314
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
15+
tooltip?: ReactNode | string;
1416
}
1517

1618
export const RadioGroup: FC<IRadioGroup> = (props: IRadioGroup) => {
@@ -47,6 +49,10 @@ export const RadioGroup: FC<IRadioGroup> = (props: IRadioGroup) => {
4749
</Stack>
4850
);
4951
})}
52+
53+
{props.tooltip && (
54+
<Tooltip name={`tooltip-${props.name}`} tooltip={props.tooltip} />
55+
)}
5056
</Stack>
5157
);
5258
};

src/renderer/components/settings/NotificationSettings.tsx

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ export const NotificationSettings: FC = () => {
5151
{ label: 'Interval', value: FetchType.INTERVAL },
5252
{ label: 'Inactivity', value: FetchType.INACTIVITY },
5353
]}
54+
tooltip={
55+
<Stack direction="vertical" gap="condensed">
56+
<Text>Controls how new notifications are fetched.</Text>
57+
<Text>
58+
<Text as="strong">Interval</Text> will check for new
59+
notifications on a regular scheduled interval.
60+
</Text>
61+
<Text>
62+
<Text as="strong">Inactivity</Text> will check for new
63+
notifications only when there has been no user activity within{' '}
64+
{APPLICATION.NAME} for a specified period of time.
65+
</Text>
66+
</Stack>
67+
}
5468
value={settings.fetchType}
5569
/>
5670

@@ -115,7 +129,7 @@ export const NotificationSettings: FC = () => {
115129
tooltip={
116130
<Stack direction="vertical" gap="condensed">
117131
<Text>Show notification metric pills for:</Text>
118-
<div className="pl-4">
132+
<div className="pl-2">
119133
<Stack direction="vertical" gap="none">
120134
<Stack direction="horizontal" gap="condensed">
121135
<IssueOpenedIcon size={Size.SMALL} />
@@ -153,27 +167,23 @@ export const NotificationSettings: FC = () => {
153167
tooltip={
154168
<Stack direction="vertical" gap="condensed">
155169
<Text>Show GitHub number for:</Text>
156-
<div className="pl-4">
157-
<ul>
158-
<li>
159-
<Stack direction="horizontal" gap="condensed">
160-
<CommentIcon size={Size.SMALL} />
161-
Discussion
162-
</Stack>
163-
</li>
164-
<li>
165-
<Stack direction="horizontal" gap="condensed">
166-
<IssueOpenedIcon size={Size.SMALL} />
167-
Issue
168-
</Stack>
169-
</li>
170-
<li>
171-
<Stack direction="horizontal" gap="condensed">
172-
<GitPullRequestIcon size={Size.SMALL} />
173-
Pull Request
174-
</Stack>
175-
</li>
176-
</ul>
170+
<div className="pl-2">
171+
<Stack direction="vertical" gap="none">
172+
<Stack direction="horizontal" gap="condensed">
173+
<CommentIcon size={Size.SMALL} />
174+
Discussion
175+
</Stack>
176+
177+
<Stack direction="horizontal" gap="condensed">
178+
<IssueOpenedIcon size={Size.SMALL} />
179+
Issue
180+
</Stack>
181+
182+
<Stack direction="horizontal" gap="condensed">
183+
<GitPullRequestIcon size={Size.SMALL} />
184+
Pull Request
185+
</Stack>
186+
</Stack>
177187
</div>
178188
</Stack>
179189
}

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

Lines changed: 24 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)