Skip to content

Commit 0663c82

Browse files
klopez4212Terp
andcommitted
fix(mobile): size agent picker to content and clarify workspace controls
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Signed-off-by: kenny lopez <[email protected]>
1 parent 526a668 commit 0663c82

11 files changed

Lines changed: 58 additions & 27 deletions

File tree

‎mobile/ios/NativeControlTests/MeAgentAccessibilityTests.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ struct MeAgentAccessibilityTests {
3535
precondition(agent.configuration?.image != nil)
3636
precondition(agent.isEnabled == !(locked || empty))
3737
precondition(project.accessibilityLabel == "Workspace")
38-
precondition(project.accessibilityValue == "Chats")
38+
precondition(project.accessibilityValue == "No Workspace")
3939
precondition(project.configuration?.image != nil)
4040
precondition(project.isEnabled == !locked)
4141
precondition(project.showsMenuAsPrimaryAction && project.menu != nil)
42-
precondition((project.menu?.children.first as? UIAction)?.title == "Chats")
42+
precondition((project.menu?.children.first as? UIAction)?.title == "No Workspace")
4343
let canSubmit = locked || !empty
4444
precondition(controller.navigationItem.rightBarButtonItem?.isEnabled == canSubmit)
4545
// Invoke the action even when disabled to check its independent gate.

‎mobile/ios/Runner/NativeProfileTextEditor.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,8 @@ private final class NativeProfileTextEditorViewController:
654654
let workspace = UIButton(type: .system)
655655
var workspaceStyle = chatControlConfiguration()
656656
workspaceStyle.baseForegroundColor = .label
657-
workspaceStyle.image = UIImage(systemName: "folder")
658-
workspaceStyle.title = projects.first { $0["id"] == selectedProject }?["name"] ?? (selectedProject == nil ? "Chats" : "Unavailable workspace")
657+
workspaceStyle.image = NativeTabler.image("workspace")
658+
workspaceStyle.title = projects.first { $0["id"] == selectedProject }?["name"] ?? (selectedProject == nil ? "No Workspace" : "Unavailable workspace")
659659
workspaceStyle.imagePlacement = .top
660660
workspaceStyle.imagePadding = 8
661661
workspace.tintColor = .label
@@ -667,7 +667,7 @@ private final class NativeProfileTextEditorViewController:
667667
workspace.accessibilityIdentifier = "new-session-project"
668668
workspace.isEnabled = !fieldsLocked
669669
workspace.showsMenuAsPrimaryAction = true
670-
let choices = [["id": "", "name": "Chats"]] + projects
670+
let choices = [["id": "", "name": "No Workspace"]] + projects
671671
workspace.menu = UIMenu(children: choices.map { project in
672672
let id = project["id"] ?? ""
673673
return UIAction(title: project["name"] ?? "Workspace", state: id == (selectedProject ?? "") ? .on : .off) { [weak self] _ in

‎mobile/ios/Runner/NativeTabler.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ enum NativeTabler {
7575
"doc": 0xeaa4, // file
7676
"plus": 0xeb0b, // plus
7777
"building.2.crop.circle": 0xebf6, // building-community
78+
"workspace": 0xecd7, // cube-3d-sphere
7879
"folder.badge.plus": 0xeaab, // folder-plus
7980
"headphones": 0xeabd, // headphones
8081
"line.3.horizontal.decrease": 0xeaa5, // filter

‎mobile/lib/features/channels/me/me_assistant_list.dart‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ class MeAssistantList extends ConsumerWidget {
2323
@override
2424
Widget build(BuildContext context, WidgetRef ref) {
2525
final profiles = ref.watch(userCacheProvider);
26-
return SizedBox(
27-
height: (MediaQuery.sizeOf(context).height * 0.6).clamp(0.0, 400.0),
26+
return ConstrainedBox(
27+
constraints: BoxConstraints(
28+
maxHeight: MediaQuery.sizeOf(context).height * 0.6,
29+
),
2830
child: choices.isEmpty
29-
? const Center(child: Text('No agents are available.'))
31+
? const Padding(
32+
padding: EdgeInsets.all(Grid.gutter),
33+
child: Text('No agents are available.'),
34+
)
3035
: ListView(
36+
shrinkWrap: true,
3137
padding: const EdgeInsets.fromLTRB(
3238
Grid.gutter,
3339
0,

‎mobile/lib/features/channels/me/me_workspace_picker.dart‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import '../../../shared/widgets/ios_navigation_bar.dart';
2020
final label =
2121
groups?.groups.where((g) => g['id'] == current).firstOrNull?['name']
2222
as String? ??
23-
'Chats';
23+
'No Workspace';
2424
Future<void> choose(String? value) async {
2525
if (busy.value) return;
2626
busy.value = true;
@@ -53,13 +53,13 @@ import '../../../shared/widgets/ios_navigation_bar.dart';
5353
return (
5454
nativeAction: IosNavigationAction(
5555
label: 'Workspace: $label',
56-
icon: BuzzIcons.folder,
56+
icon: BuzzIcons.workspace,
5757
sharesBackground: false,
5858
children: !available
5959
? const []
6060
: [
6161
IosNavigationAction(
62-
label: 'Chats',
62+
label: 'No Workspace',
6363
selected: current == null,
6464
onPressed: () => choose(null),
6565
),
@@ -73,14 +73,14 @@ import '../../../shared/widgets/ios_navigation_bar.dart';
7373
),
7474
action: PopupMenuButton<String>(
7575
tooltip: 'Workspace: $label',
76-
icon: const Icon(BuzzIcons.folder),
76+
icon: const Icon(BuzzIcons.workspace),
7777
enabled: available,
7878
onSelected: (v) => choose(v.isEmpty ? null : v),
7979
itemBuilder: (_) => [
8080
CheckedPopupMenuItem(
8181
value: '',
8282
checked: current == null,
83-
child: const Text('Chats'),
83+
child: const Text('No Workspace'),
8484
),
8585
for (final group in groups?.groups ?? const <Map<String, dynamic>>[])
8686
CheckedPopupMenuItem(

‎mobile/lib/features/channels/me/new_me_chat.dart‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class _NewMeChat extends HookConsumerWidget {
124124
PopupMenuButton<String>(
125125
key: const ValueKey('new-session-project'),
126126
tooltip: 'Workspace',
127-
icon: const Icon(BuzzIcons.folder),
127+
icon: const Icon(BuzzIcons.workspace),
128128
initialValue: project.value ?? '',
129129
enabled:
130130
!busy.value &&
@@ -133,7 +133,10 @@ class _NewMeChat extends HookConsumerWidget {
133133
onSelected: (value) =>
134134
project.value = value.isEmpty ? null : value,
135135
itemBuilder: (_) => [
136-
const PopupMenuItem(value: '', child: Text('Chats')),
136+
const PopupMenuItem(
137+
value: '',
138+
child: Text('No Workspace'),
139+
),
137140
for (final group
138141
in groups.asData?.value.groups ??
139142
<Map<String, dynamic>>[])
@@ -145,7 +148,7 @@ class _NewMeChat extends HookConsumerWidget {
145148
),
146149
Text(
147150
project.value == null
148-
? 'Chats'
151+
? 'No Workspace'
149152
: (groups.asData?.value.groups ??
150153
<Map<String, dynamic>>[])
151154
.where(

‎mobile/lib/features/channels/me/ready_me_chat.dart‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ class _ReadyMeChat extends HookConsumerWidget {
4747
final workspaceLabel =
4848
workspaces.where((g) => g['id'] == workspace.value).firstOrNull?['name']
4949
as String? ??
50-
'Chats';
50+
'No Workspace';
5151
return FrostedScaffold(
5252
appBar: FrostedAppBar(
5353
title: const Text('New chat'),
5454
nativeTitle: 'New chat',
5555
nativeActions: [
5656
IosNavigationAction(
5757
label: 'Workspace: $workspaceLabel',
58-
icon: BuzzIcons.folder,
58+
icon: BuzzIcons.workspace,
5959
sharesBackground: false,
6060
children: locked
6161
? const []
6262
: [
6363
IosNavigationAction(
64-
label: 'Chats',
64+
label: 'No Workspace',
6565
selected: workspace.value == null,
6666
onPressed: () => workspace.value = null,
6767
),
@@ -91,14 +91,14 @@ class _ReadyMeChat extends HookConsumerWidget {
9191
PopupMenuButton<String>(
9292
key: const ValueKey('new-session-project'),
9393
tooltip: 'Workspace: $workspaceLabel',
94-
icon: const Icon(BuzzIcons.folder),
94+
icon: const Icon(BuzzIcons.workspace),
9595
enabled: !locked,
9696
onSelected: (v) => workspace.value = v.isEmpty ? null : v,
9797
itemBuilder: (_) => [
9898
CheckedPopupMenuItem(
9999
value: '',
100100
checked: workspace.value == null,
101-
child: const Text('Chats'),
101+
child: const Text('No Workspace'),
102102
),
103103
for (final group in workspaces)
104104
CheckedPopupMenuItem(

‎mobile/lib/shared/theme/buzz_icons.dart‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import 'package:flutter/widgets.dart';
55
/// Semantic names preserve existing call sites; artwork matches buzz-app.
66
/// Native iOS controls share Tabler artwork except Back and Close navigation.
77
abstract final class BuzzIcons {
8+
/// Tabler `cube-3d-sphere`, matching the workspace control.
9+
static const workspace = IconData(0xecd7, fontFamily: 'BuzzTabler');
10+
811
/// Tabler `filter-2`. Referenced from Dart so release icon pruning retains it.
912
static const filter2 = IconData(0x1014b, fontFamily: 'BuzzTabler');
1013

‎mobile/test/features/channels/me/me_page_test.dart‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:async';
2+
import 'package:buzz/features/channels/me/me_assistant_list.dart';
23
import 'package:buzz/features/channels/compose_bar.dart';
34
import 'package:buzz/shared/me/default_agent.dart';
45
import 'package:shared_preferences/shared_preferences.dart';
@@ -288,7 +289,7 @@ void main() {
288289
expect(find.text('Mobile app'), findsWidgets);
289290
await tester.tap(find.byKey(const ValueKey('new-session-project')));
290291
await tester.pumpAndSettle();
291-
await tester.tap(find.text('Chats').last);
292+
await tester.tap(find.text('No Workspace').last);
292293
await tester.pumpAndSettle();
293294
await tester.tap(find.text('Create chat'));
294295
await tester.pumpAndSettle();
@@ -390,10 +391,20 @@ void main() {
390391
expect(agentAction.label, 'Agent: Owner Name');
391392
expect(agentAction.sharesBackground, isFalse);
392393
final workspaceAction = chatBar.nativeActions!.first;
393-
expect(workspaceAction.label, 'Workspace: Chats');
394-
expect(workspaceAction.icon, BuzzIcons.folder);
394+
expect(workspaceAction.label, 'Workspace: No Workspace');
395+
expect(workspaceAction.icon, BuzzIcons.workspace);
395396
expect(workspaceAction.children.first.selected, isTrue);
396397
expect(workspaceAction.sharesBackground, isFalse);
398+
agentAction.onPressed!();
399+
await tester.pumpAndSettle();
400+
expect(find.byType(BottomSheet), findsOneWidget);
401+
expect(
402+
tester.getSize(find.byType(MeAssistantList)).height,
403+
lessThan(200),
404+
);
405+
await tester.tap(find.text('Owner Name').last);
406+
await tester.pumpAndSettle();
407+
expect(find.byType(BottomSheet), findsNothing);
397408
workspaceAction.children.last.onPressed!();
398409
await tester.pumpAndSettle();
399410
expect(

‎mobile/test/features/channels/me/me_workspace_picker_test.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class _Header extends HookConsumerWidget {
4343

4444
void main() {
4545
testWidgets(
46-
'workspace menu moves a chat into a workspace and back to Chats',
46+
'workspace menu moves a chat into a workspace and back to No Workspace',
4747
(tester) async {
4848
final sync = _Sync();
4949
await tester.pumpWidget(
@@ -66,7 +66,7 @@ void main() {
6666
expect(sync.groups.assignments['chat'], 'work');
6767
await tester.tap(find.byType(PopupMenuButton<String>));
6868
await tester.pumpAndSettle();
69-
await tester.tap(find.text('Chats'));
69+
await tester.tap(find.text('No Workspace'));
7070
await tester.pumpAndSettle();
7171
expect(sync.groups.assignments.containsKey('chat'), isFalse);
7272
expect(sync.groups.assignments['other'], 'work');

0 commit comments

Comments
 (0)