feat: archive filter uses the shared project sheet, with search

- the archive page's horizontal project chips become the same project
  scope row as new-session / scheduled tasks / stats: tapping it opens the
  shared project bottomsheet (all projects, chat, every project with its
  icon, path and checkmark) and filters the archive
- the shared project sheet gains a search field over project name and path,
  so a long project list can be narrowed; it shows "no matching projects"
  when nothing matches
- version 0.6.1+601
- archive test covers filtering through the sheet
This commit is contained in:
blumia committed 2026-11-27 12:14:44 +08:00
1 parent a7e4ed8dd7
commit 83e09e8e25
7 files changed
+156 -109

No files matched your search

+22 -7
View File
@@ -19,6 +19,15 @@ class _FakeTransport implements Transport {
Object? body;
if (r.path == '/api/session') {
body = {'data': archived};
} else if (r.path == '/api/project') {
body = [
{'id': 'p1', 'canonical': '/home/me/alpha', 'vcs': 'git'},
{'id': 'p2', 'canonical': '/home/me/beta', 'vcs': 'git'},
];
} else if (r.path == '/api/config/settings') {
body = {'projects': <dynamic>[]};
} else if (r.path == '/api/fs/home') {
body = {'home': '/home/me'};
} else if (r.method == 'PATCH') {
archived.removeWhere((s) => s['id'] == r.path.split('/').last);
body = {'data': <String, dynamic>{}};
@@ -77,16 +86,20 @@ void main() {
expect(find.text('2 archived sessions'), findsOneWidget);
expect(find.text('Old alpha'), findsOneWidget);
expect(find.text('Old beta'), findsOneWidget);
expect(find.text('All (2)'), findsOneWidget);
expect(find.text('alpha (1)'), findsOneWidget);
expect(find.text('All projects'), findsOneWidget);
// A project chip narrows the list; "All" brings both back.
await tester.tap(find.text('alpha (1)'));
// The shared project sheet narrows the archive; "All projects" brings both
// back.
await tester.tap(find.text('All projects'));
await tester.pumpAndSettle();
await tester.tap(find.text('/home/me/alpha'));
await tester.pumpAndSettle();
expect(find.text('Old alpha'), findsOneWidget);
expect(find.text('Old beta'), findsNothing);
expect(find.text('1 archived session'), findsOneWidget);
await tester.tap(find.text('All (2)'));
await tester.tap(find.text('alpha'));
await tester.pumpAndSettle();
await tester.tap(find.text('All projects'));
await tester.pumpAndSettle();
expect(find.text('Old beta'), findsOneWidget);
@@ -105,7 +118,7 @@ void main() {
expect(app.archivedSessions.map((s) => s.id), ['a1']);
});
testWidgets('a project chip shows only that project', (tester) async {
testWidgets('the project sheet filters the archive', (tester) async {
final app = AppState();
addTearDown(app.dispose);
final transport = _FakeTransport([
@@ -117,7 +130,9 @@ void main() {
await tester.pumpWidget(MaterialApp(home: ArchivedSessionsScreen(app: app)));
await tester.pumpAndSettle();
await tester.tap(find.text('beta (1)'));
await tester.tap(find.text('All projects'));
await tester.pumpAndSettle();
await tester.tap(find.text('/home/me/beta'));
await tester.pumpAndSettle();
expect(find.text('Old beta'), findsOneWidget);
expect(find.text('Old alpha'), findsNothing);