From 271643cfcc2a4c7969e893ca91bb29372444fb5f Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 11 Jan 2026 15:12:47 -0500 Subject: [PATCH 1/3] feat(sidebar): focused mode toggle. New sidebar control for quickly switching between participating or participating+watching notifications Signed-off-by: Adam Setch --- src/renderer/components/Sidebar.test.tsx | 36 ++++ src/renderer/components/Sidebar.tsx | 20 +++ .../__snapshots__/Sidebar.test.tsx.snap | 160 +++++++++++++----- .../__snapshots__/AppLayout.test.tsx.snap | 114 +++++++++++-- src/renderer/context/App.tsx | 1 + 5 files changed, 272 insertions(+), 59 deletions(-) diff --git a/src/renderer/components/Sidebar.test.tsx b/src/renderer/components/Sidebar.test.tsx index 5c58f3351..9b68b63b8 100644 --- a/src/renderer/components/Sidebar.test.tsx +++ b/src/renderer/components/Sidebar.test.tsx @@ -16,6 +16,7 @@ jest.mock('react-router-dom', () => ({ describe('renderer/components/Sidebar.tsx', () => { const fetchNotificationsMock = jest.fn(); + const updateSettingMock = jest.fn(); const openExternalLinkSpy = jest .spyOn(comms, 'openExternalLink') .mockImplementation(); @@ -106,6 +107,41 @@ describe('renderer/components/Sidebar.tsx', () => { }); }); + describe('Focused mode toggle', () => { + it('renders the focused mode button when logged in', () => { + renderWithAppContext( + + + , + { + isLoggedIn: true, + settings: { ...mockSettings, participating: false }, + }, + ); + + expect(screen.getByTestId('sidebar-focused-mode')).toBeInTheDocument(); + }); + + it('toggles participating when clicked', async () => { + renderWithAppContext( + + + , + { + isLoggedIn: true, + settings: { ...mockSettings, participating: false }, + updateSetting: updateSettingMock, + fetchNotifications: fetchNotificationsMock, + }, + ); + + await userEvent.click(screen.getByTestId('sidebar-focused-mode')); + + expect(updateSettingMock).toHaveBeenCalledTimes(1); + expect(updateSettingMock).toHaveBeenCalledWith('participating', true); + }); + }); + describe('Filter notifications', () => { it('go to the filters route', async () => { renderWithAppContext( diff --git a/src/renderer/components/Sidebar.tsx b/src/renderer/components/Sidebar.tsx index 0be792987..5cab32bab 100644 --- a/src/renderer/components/Sidebar.tsx +++ b/src/renderer/components/Sidebar.tsx @@ -3,6 +3,8 @@ import { useLocation, useNavigate } from 'react-router-dom'; import { BellIcon, + CrosshairsIcon, + EyeIcon, FilterIcon, GearIcon, GitPullRequestIcon, @@ -37,6 +39,7 @@ export const Sidebar: FC = () => { auth, unreadNotificationCount, hasUnreadNotifications, + updateSetting, } = useAppContext(); const primaryAccountHostname = getPrimaryAccountHostname(auth); @@ -98,6 +101,23 @@ export const Sidebar: FC = () => { /> {isLoggedIn && ( + { + updateSetting('participating', !settings.participating); + }} + size="small" + tooltipDirection="e" + variant={settings.participating ? 'primary' : 'invisible'} + /> + + + + + + + + +