@@ -4,19 +4,26 @@ import {
44 BellIcon ,
55 CheckIcon ,
66 CommentIcon ,
7+ DashIcon ,
78 GitPullRequestIcon ,
89 IssueOpenedIcon ,
910 MilestoneIcon ,
11+ PlusIcon ,
12+ SyncIcon ,
1013 TagIcon ,
1114} from '@primer/octicons-react' ;
12- import { Stack , Text } from '@primer/react' ;
15+ import { Button , ButtonGroup , IconButton , Stack , Text } from '@primer/react' ;
16+
17+ import { formatDuration , millisecondsToMinutes } from 'date-fns' ;
1318
1419import { APPLICATION } from '../../../shared/constants' ;
1520
21+ import { Constants } from '../../constants' ;
1622import { AppContext } from '../../context/App' ;
1723import { FetchType , GroupBy , Size } from '../../types' ;
1824import { openGitHubParticipatingDocs } from '../../utils/links' ;
1925import { Checkbox } from '../fields/Checkbox' ;
26+ import { FieldLabel } from '../fields/FieldLabel' ;
2027import { RadioGroup } from '../fields/RadioGroup' ;
2128import { Title } from '../primitives/Title' ;
2229
@@ -68,6 +75,74 @@ export const NotificationSettings: FC = () => {
6875 value = { settings . fetchType }
6976 />
7077
78+ < Stack
79+ align = "center"
80+ className = "text-sm"
81+ direction = "horizontal"
82+ gap = "condensed"
83+ >
84+ < FieldLabel label = "Fetch interval:" name = "fetchInterval" />
85+
86+ < ButtonGroup className = "ml-2" >
87+ < IconButton
88+ aria-label = "Decrease fetch interval"
89+ data-testid = "settings-decrease-fetch-interval"
90+ icon = { DashIcon }
91+ onClick = { ( ) => {
92+ updateSetting (
93+ 'fetchInterval' ,
94+ Math . max (
95+ settings . fetchInterval -
96+ Constants . FETCH_NOTIFICATIONS_INTERVAL_STEP_MS ,
97+ Constants . MIN_FETCH_NOTIFICATIONS_INTERVAL_MS ,
98+ ) ,
99+ ) ;
100+ } }
101+ size = "small"
102+ unsafeDisableTooltip = { true }
103+ />
104+
105+ < Button aria-label = "Fetch interval" disabled size = "small" >
106+ { formatDuration ( {
107+ minutes : millisecondsToMinutes ( settings . fetchInterval ) ,
108+ } ) }
109+ </ Button >
110+
111+ < IconButton
112+ aria-label = "Increase fetch interval"
113+ data-testid = "settings-increase-fetch-interval"
114+ icon = { PlusIcon }
115+ onClick = { ( ) => {
116+ updateSetting (
117+ 'fetchInterval' ,
118+ Math . min (
119+ settings . fetchInterval +
120+ Constants . FETCH_NOTIFICATIONS_INTERVAL_STEP_MS ,
121+ Constants . MAX_FETCH_NOTIFICATIONS_INTERVAL_MS ,
122+ ) ,
123+ ) ;
124+ } }
125+ size = "small"
126+ unsafeDisableTooltip = { true }
127+ />
128+
129+ < IconButton
130+ aria-label = "Reset zoom"
131+ data-testid = "settings-zoom-reset"
132+ icon = { SyncIcon }
133+ onClick = { ( ) => {
134+ updateSetting (
135+ 'fetchInterval' ,
136+ Constants . DEFAULT_FETCH_NOTIFICATIONS_INTERVAL_MS ,
137+ ) ;
138+ } }
139+ size = "small"
140+ unsafeDisableTooltip = { true }
141+ variant = "danger"
142+ />
143+ </ ButtonGroup >
144+ </ Stack >
145+
71146 < Checkbox
72147 checked = { settings . fetchAllNotifications }
73148 label = "Fetch all notifications"
0 commit comments