diff --git a/src/renderer/__mocks__/state-mocks.ts b/src/renderer/__mocks__/state-mocks.ts index 640110c6e..2baa46299 100644 --- a/src/renderer/__mocks__/state-mocks.ts +++ b/src/renderer/__mocks__/state-mocks.ts @@ -87,9 +87,6 @@ export const mockToken = 'token-123-456' as Token; const mockAppearanceSettings: AppearanceSettingsState = { theme: Theme.SYSTEM, zoomPercentage: 100, - detailedNotifications: true, - showPills: true, - showNumber: true, showAccountHeader: false, wrapNotificationTitle: false, }; @@ -97,6 +94,9 @@ const mockAppearanceSettings: AppearanceSettingsState = { const mockNotificationSettings: NotificationSettingsState = { groupBy: GroupBy.REPOSITORY, fetchAllNotifications: true, + detailedNotifications: true, + showPills: true, + showNumber: true, participating: false, markAsDoneOnOpen: false, markAsDoneOnUnsubscribe: false, diff --git a/src/renderer/components/settings/AppearanceSettings.test.tsx b/src/renderer/components/settings/AppearanceSettings.test.tsx index 19447762b..94ff794e7 100644 --- a/src/renderer/components/settings/AppearanceSettings.test.tsx +++ b/src/renderer/components/settings/AppearanceSettings.test.tsx @@ -123,75 +123,6 @@ describe('renderer/routes/components/settings/AppearanceSettings.tsx', () => { }); }); - it('should toggle detailed notifications checkbox', async () => { - await act(async () => { - render( - - - - - , - ); - }); - - fireEvent.click(screen.getByTestId('checkbox-detailedNotifications')); - - expect(updateSetting).toHaveBeenCalledTimes(1); - expect(updateSetting).toHaveBeenCalledWith('detailedNotifications', false); - }); - - it('should toggle metric pills checkbox', async () => { - await act(async () => { - render( - - - - - , - ); - }); - - fireEvent.click(screen.getByTestId('checkbox-showPills')); - - expect(updateSetting).toHaveBeenCalledTimes(1); - expect(updateSetting).toHaveBeenCalledWith('showPills', false); - }); - - it('should toggle show number checkbox', async () => { - await act(async () => { - render( - - - - - , - ); - }); - - fireEvent.click(screen.getByTestId('checkbox-showNumber')); - - expect(updateSetting).toHaveBeenCalledTimes(1); - expect(updateSetting).toHaveBeenCalledWith('showNumber', false); - }); - it('should toggle account header checkbox', async () => { await act(async () => { render( diff --git a/src/renderer/components/settings/AppearanceSettings.tsx b/src/renderer/components/settings/AppearanceSettings.tsx index 2ec750508..f69037a8a 100644 --- a/src/renderer/components/settings/AppearanceSettings.tsx +++ b/src/renderer/components/settings/AppearanceSettings.tsx @@ -2,19 +2,12 @@ import { webFrame } from 'electron'; import { type FC, useContext, useState } from 'react'; import { - CheckIcon, - CommentIcon, DashIcon, - GitPullRequestIcon, - IssueClosedIcon, - MilestoneIcon, PaintbrushIcon, PlusIcon, - TagIcon, XCircleIcon, } from '@primer/octicons-react'; import { - Box, Button, ButtonGroup, IconButton, @@ -24,7 +17,7 @@ import { } from '@primer/react'; import { AppContext } from '../../context/App'; -import { Size, Theme } from '../../types'; +import { Theme } from '../../types'; import { hasMultipleAccounts } from '../../utils/auth/utils'; import { zoomLevelToPercentage, zoomPercentageToLevel } from '../../utils/zoom'; import { Checkbox } from '../fields/Checkbox'; @@ -157,108 +150,6 @@ export const AppearanceSettings: FC = () => { - - updateSetting('detailedNotifications', evt.target.checked) - } - tooltip={ - - - Enrich notifications with detailed user and state information. - - - You may also choose to display{' '} - notification metric pills or{' '} - notification numbers. - - - ⚠️ Users with a large number of unread notifications may{' '} - experience rate limiting under certain circumstances. Please - disable this setting if you experience this. - - - } - /> - - - { expect(updateSetting).toHaveBeenCalledWith('fetchAllNotifications', false); }); + it('should toggle detailed notifications checkbox', async () => { + await act(async () => { + render( + + + + + , + ); + }); + + fireEvent.click(screen.getByTestId('checkbox-detailedNotifications')); + + expect(updateSetting).toHaveBeenCalledTimes(1); + expect(updateSetting).toHaveBeenCalledWith('detailedNotifications', false); + }); + + it('should toggle metric pills checkbox', async () => { + await act(async () => { + render( + + + + + , + ); + }); + + fireEvent.click(screen.getByTestId('checkbox-showPills')); + + expect(updateSetting).toHaveBeenCalledTimes(1); + expect(updateSetting).toHaveBeenCalledWith('showPills', false); + }); + + it('should toggle show number checkbox', async () => { + await act(async () => { + render( + + + + + , + ); + }); + + fireEvent.click(screen.getByTestId('checkbox-showNumber')); + + expect(updateSetting).toHaveBeenCalledTimes(1); + expect(updateSetting).toHaveBeenCalledWith('showNumber', false); + }); + it('should toggle the showOnlyParticipating checkbox', async () => { await act(async () => { render( diff --git a/src/renderer/components/settings/NotificationSettings.tsx b/src/renderer/components/settings/NotificationSettings.tsx index 555ba3847..d7c5f26c4 100644 --- a/src/renderer/components/settings/NotificationSettings.tsx +++ b/src/renderer/components/settings/NotificationSettings.tsx @@ -1,11 +1,19 @@ import { type FC, type MouseEvent, useContext } from 'react'; -import { BellIcon } from '@primer/octicons-react'; +import { + BellIcon, + CheckIcon, + CommentIcon, + GitPullRequestIcon, + IssueClosedIcon, + MilestoneIcon, + TagIcon, +} from '@primer/octicons-react'; import { Box, Stack, Text } from '@primer/react'; import { APPLICATION } from '../../../shared/constants'; import { AppContext } from '../../context/App'; -import { GroupBy } from '../../types'; +import { GroupBy, Size } from '../../types'; import { openGitHubParticipatingDocs } from '../../utils/links'; import { Checkbox } from '../fields/Checkbox'; import { RadioGroup } from '../fields/RadioGroup'; @@ -42,38 +50,154 @@ export const NotificationSettings: FC = () => { tooltip={ - When checked, Gitify will fetch{' '} + When checked, {APPLICATION.NAME} will fetch{' '} all notifications from your inbox. - When unchecked, Gitify will only fetch the - first page of notifications (max 50 records per GitHub account) + When unchecked, {APPLICATION.NAME} will + fetch the first page of notifications (max 50 records per GitHub + account) } /> + + updateSetting('detailedNotifications', evt.target.checked) + } + tooltip={ + + + When checked, {APPLICATION.NAME} will enrich + notifications with detailed user and state information. You may + also choose to display{' '} + notification metric pills or{' '} + notification reference numbers. + + + When unchecked, {APPLICATION.NAME} will only + fetch basic notification details. + + + ⚠️ Users with a large number of unread notifications may{' '} + experience rate limiting under certain circumstances. Please + disable this setting if you experience this. + + + } + /> + + + updateSetting('participating', evt.target.checked)} tooltip={ - - See{' '} - ) => { - // Don't trigger onClick of parent element. - event.stopPropagation(); - openGitHubParticipatingDocs(); - }} - > - official docs - {' '} - for more details. - + + + When checked, {APPLICATION.NAME} will fetch + only participating notifications. + + + When unchecked, {APPLICATION.NAME} will + fetch participating and watching notifications. + + + See{' '} + ) => { + // Don't trigger onClick of parent element. + event.stopPropagation(); + openGitHubParticipatingDocs(); + }} + > + official docs + {' '} + for more details. + + } /> diff --git a/src/renderer/context/App.tsx b/src/renderer/context/App.tsx index 6aadc648b..3b53c6186 100644 --- a/src/renderer/context/App.tsx +++ b/src/renderer/context/App.tsx @@ -71,9 +71,6 @@ export const defaultAuth: AuthState = { const defaultAppearanceSettings: AppearanceSettingsState = { theme: Theme.SYSTEM, zoomPercentage: 100, - detailedNotifications: true, - showPills: true, - showNumber: true, showAccountHeader: false, wrapNotificationTitle: false, }; @@ -81,6 +78,9 @@ const defaultAppearanceSettings: AppearanceSettingsState = { const defaultNotificationSettings: NotificationSettingsState = { groupBy: GroupBy.REPOSITORY, fetchAllNotifications: true, + detailedNotifications: true, + showPills: true, + showNumber: true, participating: false, markAsDoneOnOpen: false, markAsDoneOnUnsubscribe: false, diff --git a/src/renderer/routes/__snapshots__/Settings.test.tsx.snap b/src/renderer/routes/__snapshots__/Settings.test.tsx.snap index dbc50ff24..43397da94 100644 --- a/src/renderer/routes/__snapshots__/Settings.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/Settings.test.tsx.snap @@ -380,158 +380,6 @@ exports[`renderer/routes/Settings.tsx should render itself & its children 1`] = -
- - -
- -
-
-
-
-
- - -
- -
-
-
- - -
- -
-
-
-
+
+ + +
+ +
+
+
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+
- Show only participating + Fetch only participating