diff --git a/app/notes/chat-sidebar-focus.md b/app/notes/chat-sidebar-focus.md new file mode 100644 index 00000000..dd70936b --- /dev/null +++ b/app/notes/chat-sidebar-focus.md @@ -0,0 +1,9 @@ +# Chat sidebar focus modes + +Each desktop chat header has a pinned native **Chat list layout** control. It offers expanded, compact and hidden modes. Compact mode keeps a 72-point rail with chat title initials and full-title tooltips; its expand button restores the full list. Hidden mode gives the panes the full width. The same pinned header control remains available to restore the list. + +Compact and hidden modes suppress the surrounding destination chrome while Chat is active. Search and destination keyboard shortcuts remain available. On narrow windows the normal list/back flow remains in use. The list and workspace stay mounted during mode changes so chat drafts, transcripts and pane identity survive. + +The preference is included in the device-local, server-scoped workspace snapshot with open chats, split axes, ratios and active pane. No server restart or session mutation is involved. + +Focused acceptance: sidebar toggles retain both chat states and composer draft, recover original width on expansion, and remove list space completely when hidden. Existing split/resize/narrow and shell regression suites are also exercised. Rendered capture evidence is recorded with the release note after browser review. diff --git a/app/test/features/chat/chat_split_integration_test.dart b/app/test/features/chat/chat_split_integration_test.dart index 3863a49d..7e2fc5f0 100644 --- a/app/test/features/chat/chat_split_integration_test.dart +++ b/app/test/features/chat/chat_split_integration_test.dart @@ -79,6 +79,40 @@ Future _split(WidgetTester tester, String id, String action) async { } void main() { + testWidgets('compact and hidden sidebar preserve panes and drafts', ( + tester, + ) async { + await _setup(tester); + await _split(tester, 'b', 'Open to the right'); + final stateA = tester.state(_thread('a')); + final stateB = tester.state(_thread('b')); + await tester.enterText(_input('a'), 'Keep this draft'); + final originalWidth = tester.getSize(_thread('a')).width; + Future choose(String label) async { + await tester.tap(find.byTooltip('Chat list layout').first); + await tester.pumpAndSettle(); + await tester.tap(find.text(label)); + await tester.pumpAndSettle(); + } + + await choose('Compact chat list'); + expect(find.byTooltip('Expand chat list'), findsOneWidget); + expect(tester.getSize(_thread('a')).width, greaterThan(originalWidth)); + expect(tester.state(_thread('a')), same(stateA)); + expect(tester.state(_thread('b')), same(stateB)); + await choose('Hide chat list'); + expect(find.byTooltip('Expand chat list'), findsNothing); + expect(tester.getRect(_thread('a')).left, 0); + expect(tester.state(_thread('a')), same(stateA)); + expect( + tester.widget(_input('a')).controller.text, + 'Keep this draft', + ); + await choose('Expanded chat list'); + expect(tester.getSize(_thread('a')).width, closeTo(originalWidth, 1)); + expect(tester.state(_thread('b')), same(stateB)); + }); + testWidgets( 'nested splits preserve drafts, resize, collapse and narrow restore', (tester) async { @@ -131,12 +165,21 @@ void main() { tester.widget(_input('b')).controller.text, 'Draft B', ); - await tester.tap( - find.descendant( - of: _thread('c'), - matching: find.byTooltip('Close pane'), - ), - ); + final closePane = find + .descendant(of: _thread('c'), matching: find.byTooltip('Close pane')) + .hitTestable(); + if (closePane.evaluate().isEmpty) { + await tester.tap( + find.descendant( + of: _thread('c'), + matching: find.byTooltip('More actions'), + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.text('Close pane')); + } else { + await tester.tap(closePane); + } await tester.pumpAndSettle(); expect(workspace.controller.paneCount, 2); expect(_thread('c'), findsNothing);