Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Swarm sidebar: a collapsed Closed (N) row lists a project's archived groups (#1564)

0xken151638c9e832e3
diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dart
index 5fbf910ba..d4bec52a2 100644
--- a/desktop/lib/super_tabs/controller.dart
+++ b/desktop/lib/super_tabs/controller.dart
@@ -159,6 +159,17 @@ class SuperTabController extends ChangeNotifier {
_changed();
}
+ /// Projects whose "Closed (N)" row is open; every one starts collapsed and
+ /// the choice is not saved.
+ final closedOpenProjects = <String>{};
+
+ void toggleClosed(String projectId) {
+ if (!closedOpenProjects.remove(projectId)) {
+ closedOpenProjects.add(projectId);
+ }
+ _changed();
+ }
+
void toggleProjectsGroup() {
projectsGroupOpen = !projectsGroupOpen;
_saveSoon();
@@ -366,7 +377,9 @@ class SuperTabController extends ChangeNotifier {
void select(String id) {
if (snapshot?.conversation(id) == null || id == selectedId) return;
if (!snapshot!.isProjectLead(id)) {
- expandedProjects.add(snapshot!.conversation(id)!.projectId);
+ final group = snapshot!.conversation(id)!;
+ expandedProjects.add(group.projectId);
+ if (group.archived) closedOpenProjects.add(group.projectId);
}
selectedId = id;
_saveSoon();
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index 730c124b3..1727fb235 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -53,8 +53,12 @@ class ProjectSidebar extends StatelessWidget {
SuperTabSectionHeading.actionWidth / 2 - _dotSize / 2;
/// A project's lead row (level 1, under the heading) or a workgroup (level 2, under its project).
- Widget _row(SuperTabConversation group, {SuperTabProject? project}) {
- final level = project == null ? 2 : 1;
+ Widget _row(
+ SuperTabConversation group, {
+ SuperTabProject? project,
+ bool closed = false,
+ }) {
+ final level = project != null ? 1 : (closed ? 3 : 2);
final selected = controller.selectedId == group.id;
final groups = project == null
? [group]
@@ -185,6 +189,72 @@ class ProjectSidebar extends StatelessWidget {
);
}
+ /// A project's "Closed (N)" row and, when it is open, the archived groups under it.
+ List<Widget> _closed(SuperTabProject project) {
+ final groups = controller.snapshot!.conversations
+ .where(
+ (g) =>
+ g.projectId == project.id &&
+ g.id != project.leadConversationId &&
+ g.archived,
+ )
+ .toList();
+ if (groups.isEmpty) return const [];
+ final open = controller.closedOpenProjects.contains(project.id);
+ return [
+ Padding(
+ padding: const EdgeInsets.only(bottom: 2),
+ child: Material(
+ color: Colors.transparent,
+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
+ clipBehavior: Clip.antiAlias,
+ child: Semantics(
+ button: true,
+ expanded: open,
+ child: InkWell(
+ key: ValueKey('super-closed-${project.id}'),
+ onTap: () => controller.toggleClosed(project.id),
+ hoverColor: grid.AppSurface.hoverFill,
+ focusColor: grid.AppSurface.hoverFill,
+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
+ child: Row(
+ children: [
+ SizedBox(width: SuperTabSectionHeading.indentFor(2)),
+ SizedBox(
+ width: _iconColumn,
+ child: Icon(
+ open ? AppIcons.chevronDown : AppIcons.chevronRight,
+ size: AppIcons.inlineSize,
+ color: DesktopChrome.muted,
+ ),
+ ),
+ Expanded(
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(minHeight: 36),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Text(
+ 'Closed (${groups.length})',
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.control(
+ color: DesktopChrome.muted,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ if (open)
+ for (final group in groups) _row(group, closed: true),
+ ];
+ }
+
List<Widget> _workgroups(SuperTabProject project) {
final groups = controller.snapshot!.conversations.where(
(g) =>
@@ -238,8 +308,10 @@ class ProjectSidebar extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
_row(lead, project: project),
- if (controller.expandedProjects.contains(project.id))
+ if (controller.expandedProjects.contains(project.id)) ...[
..._workgroups(project),
+ ..._closed(project),
+ ],
],
),
const SizedBox(height: 16),
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 23ba53813..9a2cc7b69 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -1316,193 +1316,221 @@ class _SuperTabViewState extends State<SuperTabView>
),
),
),
- Padding(
- padding: const EdgeInsets.fromLTRB(24, 12, 24, 16),
- child: Focus(
- onKeyEvent: (node, event) {
- final keys = HardwareKeyboard.instance;
- final composing = _composer.value.composing;
- if (_focus.hasFocus &&
- event is KeyDownEvent &&
- choices.isNotEmpty &&
- !keys.isControlPressed &&
- !keys.isMetaPressed &&
- !keys.isAltPressed &&
- !keys.isShiftPressed &&
- !(composing.isValid && !composing.isCollapsed)) {
- final key = event.logicalKey;
- if (key == LogicalKeyboardKey.arrowDown ||
- key == LogicalKeyboardKey.arrowUp) {
- _moveCompletion(
- (_mentionIndex +
- (key == LogicalKeyboardKey.arrowDown ? 1 : -1)) %
- choices.length,
- );
- return KeyEventResult.handled;
- }
- if (key == LogicalKeyboardKey.tab ||
- key == LogicalKeyboardKey.enter) {
- choices[_mentionIndex.clamp(0, choices.length - 1)].choose();
- return KeyEventResult.handled;
+ if (group != null && group.archived)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(24, 12, 24, 16),
+ child: Row(
+ children: [
+ Expanded(
+ child: Text(
+ 'This group is closed. You can read it but not write.',
+ style: DesktopChrome.metadata(),
+ ),
+ ),
+ if (c.canWrite)
+ TextButton(
+ key: const ValueKey('super-group-reopen'),
+ onPressed: c.saving
+ ? null
+ : () => _groupAction('archive', group),
+ child: const Text('Reopen'),
+ ),
+ ],
+ ),
+ )
+ else
+ Padding(
+ padding: const EdgeInsets.fromLTRB(24, 12, 24, 16),
+ child: Focus(
+ onKeyEvent: (node, event) {
+ final keys = HardwareKeyboard.instance;
+ final composing = _composer.value.composing;
+ if (_focus.hasFocus &&
+ event is KeyDownEvent &&
+ choices.isNotEmpty &&
+ !keys.isControlPressed &&
+ !keys.isMetaPressed &&
+ !keys.isAltPressed &&
+ !keys.isShiftPressed &&
+ !(composing.isValid && !composing.isCollapsed)) {
+ final key = event.logicalKey;
+ if (key == LogicalKeyboardKey.arrowDown ||
+ key == LogicalKeyboardKey.arrowUp) {
+ _moveCompletion(
+ (_mentionIndex +
+ (key == LogicalKeyboardKey.arrowDown ? 1 : -1)) %
+ choices.length,
+ );
+ return KeyEventResult.handled;
+ }
+ if (key == LogicalKeyboardKey.tab ||
+ key == LogicalKeyboardKey.enter) {
+ choices[_mentionIndex.clamp(0, choices.length - 1)]
+ .choose();
+ return KeyEventResult.handled;
+ }
+ if (key == LogicalKeyboardKey.escape) {
+ setState(
+ () => _dismissedMention = _composer.text.substring(
+ 0,
+ _composer.selection.baseOffset,
+ ),
+ );
+ return KeyEventResult.handled;
+ }
}
- if (key == LogicalKeyboardKey.escape) {
- setState(
- () => _dismissedMention = _composer.text.substring(
- 0,
- _composer.selection.baseOffset,
- ),
- );
+ if (_focus.hasFocus &&
+ event is KeyDownEvent &&
+ event.logicalKey == LogicalKeyboardKey.enter &&
+ !keys.isShiftPressed &&
+ !keys.isControlPressed &&
+ !keys.isMetaPressed &&
+ !keys.isAltPressed &&
+ !(composing.isValid && !composing.isCollapsed)) {
+ unawaited(_send());
return KeyEventResult.handled;
}
- }
- if (_focus.hasFocus &&
- event is KeyDownEvent &&
- event.logicalKey == LogicalKeyboardKey.enter &&
- !keys.isShiftPressed &&
- !keys.isControlPressed &&
- !keys.isMetaPressed &&
- !keys.isAltPressed &&
- !(composing.isValid && !composing.isCollapsed)) {
- unawaited(_send());
- return KeyEventResult.handled;
- }
- return KeyEventResult.ignored;
- },
- child: DecoratedBox(
- key: const ValueKey('super-message-composer-surface'),
- decoration: BoxDecoration(
- color: DesktopChrome.field,
- borderRadius: BorderRadius.circular(
- DesktopChrome.controlRadius,
+ return KeyEventResult.ignored;
+ },
+ child: DecoratedBox(
+ key: const ValueKey('super-message-composer-surface'),
+ decoration: BoxDecoration(
+ color: DesktopChrome.field,
+ borderRadius: BorderRadius.circular(
+ DesktopChrome.controlRadius,
+ ),
+ border: Border.all(color: DesktopChrome.rim),
),
- border: Border.all(color: DesktopChrome.rim),
- ),
- child: NewHarnessDropZone(
- attachments: _files,
- enabled: writable && !busy,
- child: GestureDetector(
- behavior: HitTestBehavior.translucent,
- onTap: writable ? _focus.requestFocus : null,
- child: Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 8, 8),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- ListenableBuilder(
- listenable: _files,
- builder: (context, _) => _files.isEmpty
- ? const SizedBox.shrink()
- : Padding(
- padding: const EdgeInsets.only(
- bottom: 8,
- right: 8,
- ),
- child: NewHarnessAttachmentChips(
- attachments: _files,
- enabled: !c.saving,
- isUploading: c.isUploading,
- progressOf: c.uploadProgress,
+ child: NewHarnessDropZone(
+ attachments: _files,
+ enabled: writable && !busy,
+ child: GestureDetector(
+ behavior: HitTestBehavior.translucent,
+ onTap: writable ? _focus.requestFocus : null,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(16, 8, 8, 8),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ ListenableBuilder(
+ listenable: _files,
+ builder: (context, _) => _files.isEmpty
+ ? const SizedBox.shrink()
+ : Padding(
+ padding: const EdgeInsets.only(
+ bottom: 8,
+ right: 8,
+ ),
+ child: NewHarnessAttachmentChips(
+ attachments: _files,
+ enabled: !c.saving,
+ isUploading: c.isUploading,
+ progressOf: c.uploadProgress,
+ ),
),
- ),
- ),
- ConstrainedBox(
- constraints: BoxConstraints(
- minHeight: grid.AppControl.heightFieldScaled,
),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Expanded(
- child: NewHarnessPasteTarget(
- attachments: _files,
- enabled: writable && !busy,
- focusNode: _focus,
- child: TextField(
- key: const ValueKey(
- 'super-message-composer',
- ),
- controller: _composer,
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: grid.AppControl.heightFieldScaled,
+ ),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Expanded(
+ child: NewHarnessPasteTarget(
+ attachments: _files,
+ enabled: writable && !busy,
focusNode: _focus,
- autofocus: !_terminalsVisible,
- enabled: writable,
- minLines: 1,
- maxLines:
- MediaQuery.sizeOf(context).height < 600
- ? 3
- : 8,
- maxLength: 32000,
- keyboardType: TextInputType.multiline,
- textAlignVertical: TextAlignVertical.center,
- style: DesktopChrome.text(),
- decoration: InputDecoration(
- // The row centers the line. Inheriting a decorated
- // field's minimum height leaves slack below its text.
- isCollapsed: true,
- constraints: const BoxConstraints(),
- visualDensity: VisualDensity.standard,
- hintStyle: DesktopChrome.text(
- color: DesktopChrome.muted,
+ child: TextField(
+ key: const ValueKey(
+ 'super-message-composer',
+ ),
+ controller: _composer,
+ focusNode: _focus,
+ autofocus: !_terminalsVisible,
+ enabled: writable,
+ minLines: 1,
+ maxLines:
+ MediaQuery.sizeOf(context).height <
+ 600
+ ? 3
+ : 8,
+ maxLength: 32000,
+ keyboardType: TextInputType.multiline,
+ textAlignVertical:
+ TextAlignVertical.center,
+ style: DesktopChrome.text(),
+ decoration: InputDecoration(
+ // The row centers the line. Inheriting a decorated
+ // field's minimum height leaves slack below its text.
+ isCollapsed: true,
+ constraints: const BoxConstraints(),
+ visualDensity: VisualDensity.standard,
+ hintStyle: DesktopChrome.text(
+ color: DesktopChrome.muted,
+ ),
+ contentPadding: EdgeInsets.zero,
+ hintText: group == null
+ ? 'Loading conversation…'
+ : c.canWrite
+ ? c.snapshot!.isProjectLead(
+ group.id,
+ )
+ ? 'Message Product Manager'
+ : 'Message ${group.title}'
+ : 'Read-only conversation',
+ border: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ disabledBorder: InputBorder.none,
+ filled: false,
+ counterText: '',
),
- contentPadding: EdgeInsets.zero,
- hintText: group == null
- ? 'Loading conversation…'
- : c.canWrite
- ? c.snapshot!.isProjectLead(group.id)
- ? 'Message Product Manager'
- : 'Message ${group.title}'
- : 'Read-only conversation',
- border: InputBorder.none,
- enabledBorder: InputBorder.none,
- focusedBorder: InputBorder.none,
- disabledBorder: InputBorder.none,
- filled: false,
- counterText: '',
+ onChanged: (text) {
+ c.setDraft(c.selectedId, text);
+ setState(() {
+ _mentionIndex = 0;
+ _dismissedMention = null;
+ });
+ },
),
- onChanged: (text) {
- c.setDraft(c.selectedId, text);
- setState(() {
- _mentionIndex = 0;
- _dismissedMention = null;
- });
- },
),
),
- ),
- NewHarnessAttachButton(
- attachments: _files,
- enabled: writable && !busy,
- ),
- ListenableBuilder(
- listenable: Listenable.merge([
- _composer,
- _files,
- ]),
- builder: (context, _) => AppIconButton(
- icon: AppIcons.arrowUp,
- tooltip: 'Send message',
- color: DesktopChrome.accent,
- onPressed:
- writable &&
- !busy &&
- !c.hasPendingAction &&
- (_composer.text.trim().isNotEmpty ||
- !_files.isEmpty)
- ? () => unawaited(_send())
- : null,
+ NewHarnessAttachButton(
+ attachments: _files,
+ enabled: writable && !busy,
),
- ),
- ],
+ ListenableBuilder(
+ listenable: Listenable.merge([
+ _composer,
+ _files,
+ ]),
+ builder: (context, _) => AppIconButton(
+ icon: AppIcons.arrowUp,
+ tooltip: 'Send message',
+ color: DesktopChrome.accent,
+ onPressed:
+ writable &&
+ !busy &&
+ !c.hasPendingAction &&
+ (_composer.text.trim().isNotEmpty ||
+ !_files.isEmpty)
+ ? () => unawaited(_send())
+ : null,
+ ),
+ ),
+ ],
+ ),
),
- ),
- ],
+ ],
+ ),
),
),
),
),
),
),
- ),
],
);
}
diff --git a/desktop/test/super_tab_closed_groups_test.dart b/desktop/test/super_tab_closed_groups_test.dart
new file mode 100644
index 000000000..e7377f573
--- /dev/null
+++ b/desktop/test/super_tab_closed_groups_test.dart
@@ -0,0 +1,172 @@
+import 'dart:io';
+import 'dart:ui' as ui;
+
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/project_sidebar.dart';
+import 'package:harness/super_tabs/view.dart';
+
+import 'box_render_preview_test.dart' show loadPreviewFonts;
+import 'support/super_tab_fixture.dart';
+
+final _picture = GlobalKey();
+
+Widget _app(
+ ConversationServer server,
+ controller, [
+ Brightness brightness = Brightness.light,
+]) => MaterialApp(
+ theme: grid.buildAppTheme(brightness: brightness),
+ home: Scaffold(
+ body: RepaintBoundary(
+ key: _picture,
+ child: SuperTabView(
+ controller: controller,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ machineName: (_) => 'Test Mac',
+ ),
+ ),
+ ),
+);
+
+/// Writes the view to `$SUPER_TAB_CLOSED_SHOTS/<name>.png` when that is set.
+Future<void> _shot(WidgetTester tester, String name) async {
+ final directory = Platform.environment['SUPER_TAB_CLOSED_SHOTS'];
+ if (directory == null) return;
+ await tester.runAsync(() async {
+ final boundary =
+ _picture.currentContext!.findRenderObject()! as RenderRepaintBoundary;
+ final image = await boundary.toImage();
+ final bytes = await image.toByteData(format: ui.ImageByteFormat.png);
+ await Directory(directory).create(recursive: true);
+ await File('$directory/$name.png')
+ .writeAsBytes(bytes!.buffer.asUint8List());
+ image.dispose();
+ });
+}
+
+void main() {
+ setUpAll(() async {
+ if (Platform.environment['SUPER_TAB_CLOSED_SHOTS'] != null) {
+ await loadPreviewFonts();
+ }
+ });
+ final closedRow = find.byKey(const ValueKey('super-closed-lead'));
+
+ testWidgets('a project with no archived groups has no Closed row', (
+ tester,
+ ) async {
+ final server = ConversationServer();
+ final controller = server.controller();
+ await controller.refresh();
+ await tester.pumpWidget(_app(server, controller));
+ await tester.pumpAndSettle();
+ expect(closedRow, findsNothing);
+ expect(find.textContaining('Closed ('), findsNothing);
+ await tester.pumpWidget(const SizedBox());
+ await controller.flush();
+ controller.dispose();
+ });
+
+ for (final brightness in Brightness.values) {
+ testWidgets(
+ 'Closed (N) starts collapsed, lists archived groups, opens one read-only and reopens it (${brightness.name})',
+ (tester) async {
+ await tester.binding.setSurfaceSize(const Size(1280, 800));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final server = ConversationServer();
+ await tester.binding.setSurfaceSize(const Size(1280, 800));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final oldBrightness = grid.AppTheme.brightness.value;
+ final oldPalette = grid.AppTheme.palette.value;
+ grid.AppTheme.brightness.value = brightness;
+ grid.AppTheme.palette.value = grid.AppTheme.paletteFor(brightness);
+ addTearDown(() {
+ grid.AppTheme.brightness.value = oldBrightness;
+ grid.AppTheme.palette.value = oldPalette;
+ });
+ final groups = server.state['conversations'] as List;
+ groups[1]['archived'] = true;
+ groups.add({
+ ...conversationFixture('second', 'Second closed'),
+ 'projectId': 'lead',
+ 'archived': true,
+ });
+ server.append(
+ 'Verified the offline result.',
+ conversationId: 'offline',
+ );
+ final controller = server.controller();
+ await controller.refresh();
+ await tester.pumpWidget(_app(server, controller, brightness));
+ await tester.pumpAndSettle();
+ final sidebar = find.byType(ProjectSidebar);
+ Finder inside(Finder f) => find.descendant(of: sidebar, matching: f);
+ if (closedRow.evaluate().isEmpty) {
+ await tester.tap(
+ find.byKey(const ValueKey('super-project-expand-lead')),
+ );
+ await tester.pumpAndSettle();
+ }
+
+ expect(inside(find.text('Closed (2)')), findsOneWidget);
+ expect(find.byKey(const ValueKey('super-group-offline')), findsNothing);
+ expect(find.byKey(const ValueKey('super-group-second')), findsNothing);
+
+ await tester.tap(closedRow);
+ await tester.pumpAndSettle();
+ expect(
+ find.byKey(const ValueKey('super-group-offline')),
+ findsOneWidget,
+ );
+ expect(
+ find.byKey(const ValueKey('super-group-second')),
+ findsOneWidget,
+ );
+ await _shot(tester, 'closed-open-${brightness.name}');
+
+ await tester.tap(find.byKey(const ValueKey('super-group-offline')));
+ await tester.pumpAndSettle();
+ expect(controller.selectedId, 'offline');
+ expect(find.text('Verified the offline result.'), findsOneWidget);
+ // A closed group has no message box, only the notice and Reopen.
+ expect(
+ find.byKey(const ValueKey('super-message-composer')),
+ findsNothing,
+ );
+ expect(find.textContaining('This group is closed'), findsOneWidget);
+
+ await _shot(tester, 'closed-read-only-${brightness.name}');
+ await tester.tap(find.byKey(const ValueKey('super-group-reopen')));
+ await tester.pumpAndSettle();
+ expect(server.posts.last['command'], {
+ 'type': 'conversation.archive',
+ 'conversationId': 'offline',
+ 'archived': false,
+ });
+ expect(inside(find.text('Closed (1)')), findsOneWidget);
+ expect(find.byKey(const ValueKey('super-group-reopen')), findsNothing);
+ expect(
+ find.byKey(const ValueKey('super-group-offline')),
+ findsOneWidget,
+ );
+ expect(
+ tester
+ .widget<TextField>(
+ find.byKey(const ValueKey('super-message-composer')),
+ )
+ .enabled,
+ isTrue,
+ );
+
+ await tester.pumpWidget(const SizedBox());
+ await controller.flush();
+ controller.dispose();
+ },
+ );
+ }
+}
diff --git a/desktop/test/super_tab_view_test.dart b/desktop/test/super_tab_view_test.dart
index 554179a81..6f17bdada 100644
--- a/desktop/test/super_tab_view_test.dart
+++ b/desktop/test/super_tab_view_test.dart
@@ -95,14 +95,7 @@ void main() {
await tester.pumpAndSettle();
expect(controller.selectedId, 'offline');
expect(find.text('Verified the offline result.'), findsOneWidget);
- expect(
- tester
- .widget<TextField>(
- find.byKey(const ValueKey('super-message-composer')),
- )
- .enabled,
- isFalse,
- );
+ expect(find.byKey(const ValueKey('super-message-composer')), findsNothing);
await tester.tap(find.byTooltip('Workgroup options'));
await tester.pumpAndSettle();
await tester.tap(find.text('Reopen conversation'));
@@ -222,45 +215,44 @@ void main() {
},
);
- testWidgets(
- 'projects stay collapsed and creation remains in the sidebar',
- (tester) async {
- await tester.binding.setSurfaceSize(const Size(1100, 700));
- addTearDown(() => tester.binding.setSurfaceSize(null));
- final server = ConversationServer();
- final controller = server.controller();
- await controller.refresh();
- await tester.pumpWidget(
- MaterialApp(
- home: Scaffold(
- body: SuperTabView(
- controller: controller,
- onInvite: () {},
- onAddAgent: (_) {},
- onOpenTerminal: (_) {},
- onNewProject: () {},
- machineName: (_) => 'Test Mac',
- ),
+ testWidgets('projects stay collapsed and creation remains in the sidebar', (
+ tester,
+ ) async {
+ await tester.binding.setSurfaceSize(const Size(1100, 700));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final server = ConversationServer();
+ final controller = server.controller();
+ await controller.refresh();
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: SuperTabView(
+ controller: controller,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ onNewProject: () {},
+ machineName: (_) => 'Test Mac',
),
),
- );
- await tester.pumpAndSettle();
- expect(find.text('Pilot'), findsNWidgets(2));
- expect(find.text('CHATS'), findsNothing);
- expect(find.byKey(const ValueKey('super-group-lead')), findsOneWidget);
- expect(find.byKey(const ValueKey('super-group-offline')), findsNothing);
- expect(find.text('New group'), findsNothing);
- expect(find.byTooltip('New project'), findsOneWidget);
- expect(find.byTooltip('Invite people'), findsOneWidget);
- expect(
- tester.getCenter(find.byTooltip('Invite people')).dx,
- greaterThan(800),
- );
- await tester.pumpWidget(const SizedBox());
- await controller.flush();
- controller.dispose();
- },
- );
+ ),
+ );
+ await tester.pumpAndSettle();
+ expect(find.text('Pilot'), findsNWidgets(2));
+ expect(find.text('CHATS'), findsNothing);
+ expect(find.byKey(const ValueKey('super-group-lead')), findsOneWidget);
+ expect(find.byKey(const ValueKey('super-group-offline')), findsNothing);
+ expect(find.text('New group'), findsNothing);
+ expect(find.byTooltip('New project'), findsOneWidget);
+ expect(find.byTooltip('Invite people'), findsOneWidget);
+ expect(
+ tester.getCenter(find.byTooltip('Invite people')).dx,
+ greaterThan(800),
+ );
+ await tester.pumpWidget(const SizedBox());
+ await controller.flush();
+ controller.dispose();
+ });
for (final rename in [true]) {
testWidgets(
diff --git a/desktop/test/support/super_tab_fixture.dart b/desktop/test/support/super_tab_fixture.dart
index f716d0d17..76ceb7b6b 100644
--- a/desktop/test/support/super_tab_fixture.dart
+++ b/desktop/test/support/super_tab_fixture.dart
@@ -200,6 +200,14 @@ class ConversationServer {
'brief': command['brief'] ?? '',
});
output.addAll({'projectId': id, 'conversationId': leadId});
+ } else if (command['type'] == 'conversation.archive') {
+ (state['conversations'] as List)
+ .cast<Map<String, dynamic>>()
+ .firstWhere(
+ (g) => g['id'] == command['conversationId'],
+ )['archived'] =
+ command['archived'];
+ revision++;
} else if (command['type'] == 'project.delete') {
final projectId = command['projectId'];
final projects =