diff --git a/app/lib/features/chat/shell/chat_shell_history_chip.dart b/app/lib/features/chat/shell/chat_shell_history_chip.dart index c70e682d..d11ae1c4 100644 --- a/app/lib/features/chat/shell/chat_shell_history_chip.dart +++ b/app/lib/features/chat/shell/chat_shell_history_chip.dart @@ -1,3 +1,4 @@ +import '../../../shell/windows/window_scope.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -48,10 +49,31 @@ class ChatShellHistoryChip extends StatelessWidget { } Future _open(BuildContext context, bool cupertino) { - return showAppDetails( - context, - builder: (_) => - ChatShellHistoryView(controller: controller, runIds: runIds), + // A dialog in the tiled app on a wide layout. A phone keeps the + // full-screen page, and a floating window opens it as a page of that + // window, so what it opens next (a diff, a command's output) stays in + // the window too. + if (usesDesktopPopups(context) && WindowScope.maybeOf(context) == null) { + return showAppDetails( + context, + builder: (_) => + ChatShellHistoryView(controller: controller, runIds: runIds), + ); + } + return Navigator.of(context).push( + MaterialPageRoute( + fullscreenDialog: true, + builder: (_) => Scaffold( + appBar: AppBar(title: const Text(chatShellHistoryTitle)), + body: SafeArea( + child: ChatShellHistoryView( + controller: controller, + runIds: runIds, + inSheet: false, + ), + ), + ), + ), ); } } diff --git a/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart b/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart index 7aeeb012..524728fb 100644 --- a/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart +++ b/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart @@ -1,3 +1,4 @@ +import '../../../../shell/windows/window_scope.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -65,9 +66,30 @@ class ChatTurnDiffChip extends StatelessWidget { } Future _open(BuildContext context, bool cupertino) { - return showAppDetails( - context, - builder: (_) => ChatTurnDiffView(summary: summary, load: load), + // A dialog in the tiled app on a wide layout. A phone keeps the + // full-screen page, and a floating window opens it as a page of that + // window, so what it opens next (a diff, a command's output) stays in + // the window too. + if (usesDesktopPopups(context) && WindowScope.maybeOf(context) == null) { + return showAppDetails( + context, + builder: (_) => ChatTurnDiffView(summary: summary, load: load), + ); + } + return Navigator.of(context).push( + MaterialPageRoute( + fullscreenDialog: true, + builder: (_) => Scaffold( + appBar: AppBar(title: const Text('Turn changes')), + body: SafeArea( + child: ChatTurnDiffView( + summary: summary, + load: load, + inSheet: false, + ), + ), + ), + ), ); } } diff --git a/app/test/features/chat/shell/chat_shell_history_view_test.dart b/app/test/features/chat/shell/chat_shell_history_view_test.dart index 7ea3fb99..c9a154cf 100644 --- a/app/test/features/chat/shell/chat_shell_history_view_test.dart +++ b/app/test/features/chat/shell/chat_shell_history_view_test.dart @@ -187,14 +187,24 @@ void main() { expect(chip, findsNothing); }); - testWidgets('narrow: the history opens as a bottom sheet', (tester) async { + testWidgets('narrow: the history opens as a full-screen page', ( + tester, + ) async { size(tester, const Size(430, 900)); gateway.messages = [reply('a1', 10000, 'Answer')]; history([dismissed('run_a', 5000)]); await open(tester); await tester.tap(chip); await tester.pumpAndSettle(); - expect(find.byType(BottomSheet), findsOneWidget); + expect(find.byType(BottomSheet), findsNothing); + expect(find.byType(Dialog), findsNothing); + expect( + find.descendant( + of: find.byType(AppBar), + matching: find.text('Dismissed commands'), + ), + findsOneWidget, + ); await tester.tap( find.byKey(const ValueKey('chat-shell-history-restore-run_a')), ); diff --git a/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart b/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart index d6d35cfe..f64b4d82 100644 --- a/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart +++ b/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart @@ -160,7 +160,7 @@ void main() { expect(find.textContaining('truncated'), findsWidgets); }); - testWidgets('a narrow window opens the changes as a bottom sheet ($host)', ( + testWidgets('a phone opens the changes full screen ($host)', ( tester, ) async { tester.view.physicalSize = const Size(400, 800); @@ -180,7 +180,9 @@ void main() { ); await tester.tap(_chip); await tester.pumpAndSettle(); - expect(find.byType(BottomSheet), findsOneWidget); + expect(find.byType(BottomSheet), findsNothing); + expect(find.byType(Dialog), findsNothing); + expect(find.text('Turn changes'), findsOneWidget); expect(find.text('lib/a.dart'), findsOneWidget); });