Skip to content
Merged
142 changes: 29 additions & 113 deletions mobile/lib/features/activity/activity_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';

import '../../shared/theme/theme.dart';
import '../../shared/widgets/filter_chip_bar.dart';
import '../../shared/widgets/frosted_app_bar.dart';
import '../../shared/widgets/frosted_scaffold.dart';
import '../channels/channel.dart';
Expand Down Expand Up @@ -43,15 +44,36 @@ class ActivityPage extends HookConsumerWidget {

body = Column(
children: [
_FilterBar(
FilterChipBar<_Filter>(
selected: filter.value,
onSelected: (f) => filter.value = f,
counts: _FilterCounts(
mentions: feed.mentions.length,
needsAction: feed.needsAction.length,
activity: feed.activity.length,
agents: feed.agentActivity.length,
),
items: [
const FilterChipItem(id: _Filter.all, label: 'All'),
FilterChipItem(
id: _Filter.mentions,
label: 'Mentions',
icon: LucideIcons.atSign,
count: feed.mentions.length,
),
FilterChipItem(
id: _Filter.needsAction,
label: 'Action',
icon: LucideIcons.circleAlert,
count: feed.needsAction.length,
),
FilterChipItem(
id: _Filter.activity,
label: 'Activity',
icon: LucideIcons.activity,
count: feed.activity.length,
),
FilterChipItem(
id: _Filter.agents,
label: 'Agents',
icon: LucideIcons.bot,
count: feed.agentActivity.length,
),
],
),
Expanded(
child: items.isEmpty
Expand Down Expand Up @@ -123,112 +145,6 @@ class ActivityPage extends HookConsumerWidget {
}
}

// ---------------------------------------------------------------------------
// Filter bar
// ---------------------------------------------------------------------------

class _FilterCounts {
final int mentions;
final int needsAction;
final int activity;
final int agents;

const _FilterCounts({
required this.mentions,
required this.needsAction,
required this.activity,
required this.agents,
});
}

class _FilterBar extends StatelessWidget {
final _Filter selected;
final ValueChanged<_Filter> onSelected;
final _FilterCounts counts;

const _FilterBar({
required this.selected,
required this.onSelected,
required this.counts,
});

@override
Widget build(BuildContext context) {
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.symmetric(
horizontal: Grid.xs,
vertical: Grid.xxs,
),
child: Row(
children: [
_chip(context, _Filter.all, 'All', null, null),
const SizedBox(width: Grid.xxs),
_chip(
context,
_Filter.mentions,
'Mentions',
LucideIcons.atSign,
counts.mentions,
),
const SizedBox(width: Grid.xxs),
_chip(
context,
_Filter.needsAction,
'Action',
LucideIcons.circleAlert,
counts.needsAction,
),
const SizedBox(width: Grid.xxs),
_chip(
context,
_Filter.activity,
'Activity',
LucideIcons.activity,
counts.activity,
),
const SizedBox(width: Grid.xxs),
_chip(
context,
_Filter.agents,
'Agents',
LucideIcons.bot,
counts.agents,
),
],
),
);
}

Widget _chip(
BuildContext context,
_Filter filter,
String label,
IconData? icon,
int? count,
) {
final isSelected = selected == filter;
final text = count != null ? '$label ($count)' : label;
return FilterChip(
selected: isSelected,
showCheckmark: false,
label: icon != null
? Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(icon, size: 14),
const SizedBox(width: Grid.half),
Text(text, style: context.textTheme.labelSmall),
],
)
: Text(text, style: context.textTheme.labelSmall),
onSelected: (_) => onSelected(filter),
visualDensity: VisualDensity.compact,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
}
}

// ---------------------------------------------------------------------------
// Feed item tile
// ---------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions mobile/lib/features/channels/channels_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ class ChannelsPage extends HookConsumerWidget {
],
),
floatingActionButton: FloatingActionButton(
heroTag: 'channels-fab',
onPressed: openQuickActions,
tooltip: 'Create or start conversation',
shape: const CircleBorder(),
Expand Down
1 change: 1 addition & 0 deletions mobile/lib/features/forum/forum_posts_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ForumPostsView extends HookConsumerWidget {
backgroundColor: Colors.transparent,
floatingActionButton: canPost && !isComposing.value
? FloatingActionButton(
heroTag: 'forum-fab',
onPressed: () => isComposing.value = true,
tooltip: 'New post',
shape: const CircleBorder(),
Expand Down
4 changes: 2 additions & 2 deletions mobile/lib/features/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class HomePage extends HookConsumerWidget {
label: 'Home',
),
NavigationDestination(
icon: Icon(LucideIcons.radio),
selectedIcon: Icon(LucideIcons.radio),
icon: Icon(LucideIcons.activity),
selectedIcon: Icon(LucideIcons.activity),
label: 'Pulse',
),
NavigationDestination(
Expand Down
Loading