From f0f06671cc835748da7530df49ba8ea054cb4c2b Mon Sep 17 00:00:00 2001 From: Jack Kingsman Date: Tue, 31 Mar 2026 12:28:47 -0700 Subject: [PATCH] Make new message button clearer --- frontend/src/components/Sidebar.tsx | 54 ++++++++++++++++------------- frontend/src/test/sidebar.test.tsx | 40 +++++++++++++++++++++ 2 files changed, 69 insertions(+), 25 deletions(-) diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 088031b..0ae9bf1 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -853,41 +853,45 @@ export function Sidebar({ aria-label="Conversations" > {/* Header */} -
-
- setSearchQuery(e.target.value)} - className={cn('h-7 text-[13px] bg-background/50', searchQuery ? 'pr-8' : 'pr-3')} - /> - {searchQuery && ( - - )} -
+
{/* List */}
+
+
+ setSearchQuery(e.target.value)} + className={cn('h-7 text-[13px] bg-background/50', searchQuery ? 'pr-8' : 'pr-3')} + /> + {searchQuery && ( + + )} +
+
+ {/* Tools */} {toolRows.length > 0 && ( <> diff --git a/frontend/src/test/sidebar.test.tsx b/frontend/src/test/sidebar.test.tsx index 167ab1d..a2a75ab 100644 --- a/frontend/src/test/sidebar.test.tsx +++ b/frontend/src/test/sidebar.test.tsx @@ -122,6 +122,46 @@ describe('Sidebar section summaries', () => { expect(within(getSectionHeaderContainer('Repeaters')).getByText('4')).toBeInTheDocument(); }); + it('renders a full add channel/contact button above search and calls onNewMessage', () => { + const onNewMessage = vi.fn(); + + render( + + ); + + const addButton = screen.getByRole('button', { name: 'Add channel or contact' }); + const search = screen.getByLabelText('Search conversations'); + const nav = screen.getByRole('navigation', { name: 'Conversations' }); + const toolsButton = screen.getByRole('button', { name: 'Tools' }); + + expect(addButton).toHaveTextContent('Add Channel/Contact'); + expect( + addButton.compareDocumentPosition(search) & Node.DOCUMENT_POSITION_FOLLOWING + ).toBeTruthy(); + expect(nav.compareDocumentPosition(search) & Node.DOCUMENT_POSITION_CONTAINED_BY).toBeTruthy(); + expect( + search.compareDocumentPosition(toolsButton) & Node.DOCUMENT_POSITION_FOLLOWING + ).toBeTruthy(); + + fireEvent.click(addButton); + expect(onNewMessage).toHaveBeenCalledTimes(1); + }); + it('turns favorites and channels rollups red when they contain a mention', () => { renderSidebar({ mentions: {