diff --git a/packages/web/src/components/nav.test.tsx b/packages/web/src/components/nav.test.tsx index 2cb2b616..a3ed70f3 100644 --- a/packages/web/src/components/nav.test.tsx +++ b/packages/web/src/components/nav.test.tsx @@ -7,7 +7,6 @@ import {SidebarProvider} from '@proxy/ui/components/sidebar'; import {ThemeProvider} from '@proxy/ui/components/theme-provider'; import {TooltipProvider} from '@proxy/ui/components/tooltip'; import {AppSidebar} from '@/components/nav'; -import {type Unread, UnreadContext} from '@/hooks/use-unread'; import type {Human} from '@/lib/orgs'; import {testHuman, testOrg} from '@/test-org'; @@ -15,16 +14,7 @@ afterEach(() => { cleanup(); }); -// What is unread, as the provider around the human side would have it. -function unreadOf(ids: string[]): Unread { - return { - unreadIds: new Set(ids), - answers: null, - setViewing: () => undefined, - }; -} - -function renderSidebar(human: Human, entry = '/acme', unread = unreadOf([])) { +function renderSidebar(human: Human, entry = '/acme') { const router = createMemoryRouter( [ { @@ -41,9 +31,7 @@ function renderSidebar(human: Human, entry = '/acme', unread = unreadOf([])) { - - - + , @@ -78,28 +66,16 @@ describe('AppSidebar', () => { expect(settings.getAttribute('href')).toBe('/acme/settings'); }); - test('shows Chat beside Home, and Alerts under Activity, with the harness experiment', async () => { + test('shows Alerts under Activity with the harness experiment, but no Chat tab', async () => { renderSidebar(testHuman({...testOrg, experiments: ['harness']})); await screen.findByRole('link', {name: 'Home'}); expect(groupLabels()).toEqual([ - ['Home', 'Chat'], + ['Home'], ['Connections', 'Agent permissions'], ['Activity', 'Alerts'], ]); - }); - - test('counts the conversations with something unread on Chat', async () => { - renderSidebar( - testHuman({...testOrg, experiments: ['harness']}), - '/acme', - unreadOf(['general', 'finance']), - ); - await screen.findByRole('link', {name: 'Chat'}); - - const badge = screen.getByRole('status', {name: '2 unread'}); - expect(badge.textContent).toBe('2'); - expect(badge.closest('li')?.querySelector('a')?.textContent).toBe('Chat'); + expect(screen.queryByRole('link', {name: 'Chat'})).toBeNull(); }); test("lights the switcher on the organization's members and settings", async () => { diff --git a/packages/web/src/components/nav.tsx b/packages/web/src/components/nav.tsx index 00aa4fed..5f5988a1 100644 --- a/packages/web/src/components/nav.tsx +++ b/packages/web/src/components/nav.tsx @@ -1,12 +1,4 @@ -import { - BellIcon, - BotIcon, - HomeIcon, - MessageSquareIcon, - PlugIcon, - ScrollTextIcon, - type LucideIcon, -} from 'lucide-react'; +import {BellIcon, BotIcon, HomeIcon, PlugIcon, ScrollTextIcon, type LucideIcon} from 'lucide-react'; import type {Experiment} from '@proxy/utils'; import {Link, useLocation} from 'react-router'; import {OrgSwitcher} from '@/components/org-switcher'; @@ -24,34 +16,14 @@ import { useSidebar, } from '@proxy/ui/components/sidebar'; import {useHuman} from '@/hooks/use-human'; -import {useUnread} from '@/hooks/use-unread'; // `experiment` is the experiment a destination is behind, shown only with it on. type Destination = {to: string; label: string; icon: LucideIcon; experiment?: Experiment}; -const CHAT = '/chat'; - -// How many conversations have something unread, on Chat: over the icon's corner on the rail, at -// the row's end where the labels show. -function UnreadBadge({count}: {count: number}) { - return ( - - {count} - - ); -} - // The organization's, under the switcher, each under its slug, in groups set apart from each // other. Its members and settings are in the switcher. const GROUPS: Destination[][] = [ - [ - {to: '', label: 'Home', icon: HomeIcon}, - {to: '/chat', label: 'Chat', icon: MessageSquareIcon, experiment: 'harness'}, - ], + [{to: '', label: 'Home', icon: HomeIcon}], [ {to: '/connections', label: 'Connections', icon: PlugIcon}, {to: '/agents', label: 'Agent permissions', icon: BotIcon}, @@ -76,7 +48,6 @@ export function AppSidebar() { const {pathname} = useLocation(); const human = useHuman(); const experiments = useExperiments(); - const unread = useUnread(); const {setOpenMobile} = useSidebar(); const home = `/${human?.org.slug ?? ''}`; const groups = GROUPS.map((group) => @@ -111,9 +82,6 @@ export function AppSidebar() { {destination.label} - {destination.to === CHAT && unread.unreadIds.size > 0 && ( - - )} ))}