Merge branch 'main' into pipelines/run-20261113-1158-ctrl-tab-cycles-all-chats-with-a-single-a9b6
This commit is contained in:
@@ -2,6 +2,8 @@ part of 'screen.dart';
|
|||||||
|
|
||||||
/// Pane layout, focus and route publication for one Chat destination visit.
|
/// Pane layout, focus and route publication for one Chat destination visit.
|
||||||
mixin _ChatScreenWorkspace on State<ChatScreen> {
|
mixin _ChatScreenWorkspace on State<ChatScreen> {
|
||||||
|
final _sessionsKey = GlobalKey<ChatSessionsScreenState>();
|
||||||
|
|
||||||
Map<String, JsonMap> get _openedSessions;
|
Map<String, JsonMap> get _openedSessions;
|
||||||
ChatComposerFocusRequests get _composerFocus;
|
ChatComposerFocusRequests get _composerFocus;
|
||||||
ChatPaneCommands get _paneCommands;
|
ChatPaneCommands get _paneCommands;
|
||||||
@@ -46,6 +48,10 @@ mixin _ChatScreenWorkspace on State<ChatScreen> {
|
|||||||
activeSessionId: selected,
|
activeSessionId: selected,
|
||||||
visibleSessionIds: _visibleSidebarSessions,
|
visibleSessionIds: _visibleSidebarSessions,
|
||||||
onOpen: _openSidebarSession,
|
onOpen: _openSidebarSession,
|
||||||
|
onNewChat: () {
|
||||||
|
final state = _sessionsKey.currentState;
|
||||||
|
if (state != null) unawaited(state.newChat());
|
||||||
|
},
|
||||||
onExpand: () => _setSidebarMode(ChatSidebarMode.expanded),
|
onExpand: () => _setSidebarMode(ChatSidebarMode.expanded),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -485,6 +485,7 @@ class _ChatScreenState extends State<ChatScreen>
|
|||||||
// The session list pads its first row by the bar's height itself, so it
|
// The session list pads its first row by the bar's height itself, so it
|
||||||
// scrolls behind the shell's floating bar like the other lists.
|
// scrolls behind the shell's floating bar like the other lists.
|
||||||
final sessions = ChatSessionsScreen(
|
final sessions = ChatSessionsScreen(
|
||||||
|
key: _sessionsKey,
|
||||||
gateway: widget.gateway,
|
gateway: widget.gateway,
|
||||||
embedded: true,
|
embedded: true,
|
||||||
syncToken: widget.syncToken,
|
syncToken: widget.syncToken,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class ChatCompactSidebar extends StatelessWidget {
|
|||||||
required this.activeSessionId,
|
required this.activeSessionId,
|
||||||
this.visibleSessionIds = const {},
|
this.visibleSessionIds = const {},
|
||||||
required this.onOpen,
|
required this.onOpen,
|
||||||
|
required this.onNewChat,
|
||||||
required this.onExpand,
|
required this.onExpand,
|
||||||
this.navigation,
|
this.navigation,
|
||||||
});
|
});
|
||||||
@@ -31,6 +32,7 @@ class ChatCompactSidebar extends StatelessWidget {
|
|||||||
final String? activeSessionId;
|
final String? activeSessionId;
|
||||||
final Set<String> visibleSessionIds;
|
final Set<String> visibleSessionIds;
|
||||||
final ValueChanged<JsonMap> onOpen;
|
final ValueChanged<JsonMap> onOpen;
|
||||||
|
final VoidCallback onNewChat;
|
||||||
final VoidCallback onExpand;
|
final VoidCallback onExpand;
|
||||||
final Widget? navigation;
|
final Widget? navigation;
|
||||||
static const width = 72.0;
|
static const width = 72.0;
|
||||||
@@ -135,6 +137,7 @@ class ChatCompactSidebar extends StatelessWidget {
|
|||||||
width: width,
|
width: width,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
_button(context, 'New chat', const Icon(Icons.add), onNewChat),
|
||||||
_button(
|
_button(
|
||||||
context,
|
context,
|
||||||
'Expand chat list',
|
'Expand chat list',
|
||||||
|
|||||||
@@ -98,10 +98,10 @@ class ChatSessionsScreen extends StatefulWidget {
|
|||||||
final ChatSectionFolds? folds;
|
final ChatSectionFolds? folds;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ChatSessionsScreen> createState() => _ChatSessionsScreenState();
|
ChatSessionsScreenState createState() => ChatSessionsScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
|
class ChatSessionsScreenState extends State<ChatSessionsScreen> {
|
||||||
late final ChatSessionsController _controller =
|
late final ChatSessionsController _controller =
|
||||||
(widget.controller ??
|
(widget.controller ??
|
||||||
ChatSessionsController(
|
ChatSessionsController(
|
||||||
@@ -233,6 +233,9 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
|
|||||||
if (session != null && mounted) widget.onOpen(session);
|
if (session != null && mounted) widget.onOpen(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Starts the same machine picker and create dialog used by the list action.
|
||||||
|
Future<void> newChat() => _newChat();
|
||||||
|
|
||||||
void _markOpened(JsonMap session) =>
|
void _markOpened(JsonMap session) =>
|
||||||
unawaited(_controller.markOpened(session));
|
unawaited(_controller.markOpened(session));
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Compact sidebar New chat
|
||||||
|
|
||||||
|
The compact chat rail now keeps a Material `+` action above its scrolling
|
||||||
|
session list. Its callback reaches the mounted `ChatSessionsScreenState` and
|
||||||
|
invokes the existing `_newChat` flow, so machine selection, harness discovery,
|
||||||
|
and the create dialog remain shared with the expanded list action.
|
||||||
|
|
||||||
|
## Regression coverage
|
||||||
|
|
||||||
|
- `test/features/chat/ui/sessions/chat_visibility_marker_test.dart`: the rail
|
||||||
|
exposes the `New chat` tooltip and invokes its callback.
|
||||||
|
- `test/features/chat/ui/sessions/chat_machine_creation_test.dart`: the
|
||||||
|
existing expanded-list flow still selects a machine before harness discovery.
|
||||||
|
- `test/features/chat/ui/sessions/chat_sessions_floating_bar_test.dart`: the
|
||||||
|
expanded list still has exactly one New chat action in its bar.
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
- `tool/memwatch/full.sh 'test/features/chat/ui/sessions/chat_visibility_marker_test.dart test/features/chat/ui/sessions/chat_state_legibility_test.dart test/features/chat/ui/sessions/chat_machine_creation_test.dart test/features/chat/ui/sessions/chat_sessions_floating_bar_test.dart'`: 10 passed.
|
||||||
|
- `tool/analyze.sh`: clean.
|
||||||
|
- Browser captures: desktop 1600x1000 compact rail in light and dark themes,
|
||||||
|
including the New chat tooltip, are in the shared artifact
|
||||||
|
`public/chat-compact-sidebar/`.
|
||||||
@@ -85,6 +85,7 @@ void main() {
|
|||||||
activeSessionId: null,
|
activeSessionId: null,
|
||||||
visibleSessionIds: const {'a'},
|
visibleSessionIds: const {'a'},
|
||||||
onOpen: (_) {},
|
onOpen: (_) {},
|
||||||
|
onNewChat: () {},
|
||||||
onExpand: () {},
|
onExpand: () {},
|
||||||
navigation: const Text('Destinations'),
|
navigation: const Text('Destinations'),
|
||||||
),
|
),
|
||||||
@@ -139,6 +140,7 @@ void main() {
|
|||||||
activeSessionId: 'a',
|
activeSessionId: 'a',
|
||||||
visibleSessionIds: const {'a', 'b'},
|
visibleSessionIds: const {'a', 'b'},
|
||||||
onOpen: (_) {},
|
onOpen: (_) {},
|
||||||
|
onNewChat: () {},
|
||||||
onExpand: () {},
|
onExpand: () {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ void main() {
|
|||||||
await controller.refresh();
|
await controller.refresh();
|
||||||
final folds = ChatSectionFolds();
|
final folds = ChatSectionFolds();
|
||||||
addTearDown(folds.dispose);
|
addTearDown(folds.dispose);
|
||||||
|
var newChatPressed = false;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
@@ -116,12 +117,16 @@ void main() {
|
|||||||
activeSessionId: 'a',
|
activeSessionId: 'a',
|
||||||
visibleSessionIds: const {'a', 'b'},
|
visibleSessionIds: const {'a', 'b'},
|
||||||
onOpen: (_) {},
|
onOpen: (_) {},
|
||||||
|
onNewChat: () => newChatPressed = true,
|
||||||
onExpand: () {},
|
onExpand: () {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byTooltip('New chat'), findsOneWidget);
|
||||||
|
await tester.tap(find.byTooltip('New chat'));
|
||||||
|
expect(newChatPressed, isTrue);
|
||||||
expect(find.byTooltip('Expand chat list'), findsOneWidget);
|
expect(find.byTooltip('Expand chat list'), findsOneWidget);
|
||||||
expect(edge(tester, 'a').width, 10);
|
expect(edge(tester, 'a').width, 10);
|
||||||
expect(edge(tester, 'b').width, 3);
|
expect(edge(tester, 'b').width, 3);
|
||||||
|
|||||||
Reference in New Issue
Block a user