diff --git a/src/components/ChatViewer.tsx b/src/components/ChatViewer.tsx index c5710ac..049f932 100644 --- a/src/components/ChatViewer.tsx +++ b/src/components/ChatViewer.tsx @@ -46,6 +46,8 @@ interface ChatViewerProps { protocol: ChatProtocol; identifier: ProtocolIdentifier; customTitle?: string; + /** Optional content to render before the title (e.g., sidebar toggle on mobile) */ + headerPrefix?: React.ReactNode; } /** @@ -315,6 +317,7 @@ export function ChatViewer({ protocol, identifier, customTitle, + headerPrefix, }: ChatViewerProps) { const { addWindow } = useGrimoire(); @@ -590,9 +593,10 @@ export function ChatViewer({ return (
{/* Header with conversation info and controls */} -
+
+ {headerPrefix} diff --git a/src/components/GroupListViewer.tsx b/src/components/GroupListViewer.tsx index 78fcdae..79b52df 100644 --- a/src/components/GroupListViewer.tsx +++ b/src/components/GroupListViewer.tsx @@ -123,9 +123,11 @@ const MemoizedChatViewer = memo( function MemoizedChatViewer({ groupId, relayUrl, + headerPrefix, }: { groupId: string; relayUrl: string; + headerPrefix?: React.ReactNode; }) { return ( ); }, // Custom comparison: only re-render if group actually changed + // Note: headerPrefix is intentionally excluded - it's expected to be stable or change with isMobile (prev, next) => prev.groupId === next.groupId && prev.relayUrl === next.relayUrl, ); @@ -469,11 +473,25 @@ export function GroupListViewer({ identifier }: GroupListViewerProps) {
); + // Sidebar toggle button for mobile - passed to ChatViewer's headerPrefix + const sidebarToggle = isMobile ? ( + + ) : null; + // Chat view content const chatContent = selectedGroup ? ( ) : (
@@ -496,37 +514,6 @@ export function GroupListViewer({ identifier }: GroupListViewerProps) { if (isMobile) { return (
- {/* Mobile header with sidebar toggle */} -
- - {selectedGroup && ( - - {groupsWithRecency.find( - (g) => - g.groupId === selectedGroup.groupId && - g.relayUrl === selectedGroup.relayUrl, - )?.metadata - ? getTagValue( - groupsWithRecency.find( - (g) => - g.groupId === selectedGroup.groupId && - g.relayUrl === selectedGroup.relayUrl, - )!.metadata!, - "name", - ) || selectedGroup.groupId - : selectedGroup.groupId} - - )} -
- {/* Mobile sheet sidebar */} @@ -537,7 +524,7 @@ export function GroupListViewer({ identifier }: GroupListViewerProps) { - {/* Chat content */} + {/* Chat content - takes full height, sidebar toggle is in ChatViewer header */}
{chatContent}
);