mirror of
https://github.com/block/buzz.git
synced 2026-10-30 22:11:36 +00:00
## Summary Preview buzz-app's Tabler icon style in the mobile app, replacing app-drawn Lucide glyphs across channels, messages, activity, search, and settings. A shared `BuzzIcons` mapping uses the bundled Tabler 3.46.0 outline font, matching buzz-app's version, with its MIT license and source documented. Native UIKit controls retain SF Symbols. The former 300/500 navigation glyphs use Tabler's standard outline; existing selection colors and labels remain. ### Related issue No matching Tabler mobile migration issue or PR found. Related native iOS controls: #8055. ### Testing - Pre-push mobile analysis, formatting, file-size checks, and the full mobile test suite passed. - 194 focused widget tests passed, including channels, home, search, settings, and message content. - Light and dark community-settings renders inspected. - Signed iPhone Release build succeeded; installed and launched as Buzz Tabler on a physical iPhone. - Full `just ci` attempted; stopped during Rust clippy compilation because the Mac ran low on disk space. Full repository validation is not claimed. Signed-off-by: kenny lopez <klopez4212@gmail.com>
182 lines
6.5 KiB
Dart
182 lines
6.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:buzz/shared/theme/buzz_icons.dart';
|
|
|
|
import '../../shared/identity_names/identity_names.dart';
|
|
import '../../shared/theme/theme.dart';
|
|
import '../../shared/widgets/avatar_image.dart';
|
|
import '../../shared/profile/user_cache_provider.dart';
|
|
import 'note_card.dart';
|
|
import 'pulse_models.dart';
|
|
|
|
class AgentActivityCard extends HookConsumerWidget {
|
|
final AgentNoteGroup group;
|
|
final Map<String, PulseReactionState> reactions;
|
|
final VoidCallback? onReactionChanged;
|
|
|
|
const AgentActivityCard({
|
|
super.key,
|
|
required this.group,
|
|
required this.reactions,
|
|
required this.names,
|
|
this.onReactionChanged,
|
|
});
|
|
|
|
/// The Pulse timeline's identity labels.
|
|
final IdentityNames names;
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final expanded = useState(group.notes.length == 1);
|
|
final profile =
|
|
ref.watch(userCacheProvider.select((cache) => cache[group.pubkey])) ??
|
|
ref.read(userCacheProvider.notifier).get(group.pubkey);
|
|
final name = names.labelFor(group.pubkey);
|
|
|
|
return Column(
|
|
children: [
|
|
InkWell(
|
|
onTap: group.notes.length > 1
|
|
? () => expanded.value = !expanded.value
|
|
: null,
|
|
borderRadius: BorderRadius.circular(Radii.md),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: Grid.twelve),
|
|
child: Row(
|
|
children: [
|
|
Stack(
|
|
children: [
|
|
AvatarImage(
|
|
imageUrl: profile?.avatarUrl,
|
|
radius: 18,
|
|
backgroundColor: context.colors.primaryContainer,
|
|
fallback: const Icon(BuzzIcons.bot, size: 18),
|
|
isAgent: true,
|
|
),
|
|
Positioned(
|
|
right: 0,
|
|
bottom: 0,
|
|
child: Container(
|
|
width: 10,
|
|
height: 10,
|
|
decoration: BoxDecoration(
|
|
color: context.appColors.success,
|
|
shape: BoxShape.circle,
|
|
border: Border.all(
|
|
color: context.colors.surface,
|
|
width: 1.5,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(width: Grid.xs),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Flexible(
|
|
child: Text(
|
|
name,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: context.textTheme.labelLarge?.copyWith(
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: Grid.half),
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: Grid.half,
|
|
vertical: 2,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: context.colors.primary.withValues(
|
|
alpha: 0.12,
|
|
),
|
|
borderRadius: BorderRadius.circular(Radii.sm),
|
|
),
|
|
child: Text(
|
|
'BOT',
|
|
style: context.textTheme.labelSmall?.copyWith(
|
|
color: context.colors.primary,
|
|
fontWeight: FontWeight.w800,
|
|
fontSize: 10,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Text(
|
|
'${group.notes.length} update${group.notes.length == 1 ? '' : 's'} · ${formatPulseRelativeTime(group.latestAt)}',
|
|
style: context.textTheme.labelSmall?.copyWith(
|
|
color: context.colors.onSurfaceVariant,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (group.notes.length > 1)
|
|
Icon(
|
|
expanded.value
|
|
? BuzzIcons.chevronUp
|
|
: BuzzIcons.chevronDown,
|
|
size: 18,
|
|
color: context.colors.onSurfaceVariant,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
if (expanded.value)
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: Grid.xl),
|
|
child: Column(
|
|
children: [
|
|
for (final note in group.notes) ...[
|
|
NoteCard(
|
|
note: note,
|
|
reaction:
|
|
reactions[note.id] ??
|
|
const PulseReactionState(
|
|
count: 0,
|
|
reactedByCurrentUser: false,
|
|
),
|
|
isAgent: true,
|
|
names: names,
|
|
onReactionChanged: onReactionChanged,
|
|
),
|
|
if (note != group.notes.last)
|
|
Divider(
|
|
height: 1,
|
|
thickness: 1,
|
|
color: context.colors.outlineVariant.withValues(
|
|
alpha: 0.4,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
)
|
|
else
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: Grid.xl, bottom: Grid.xxs),
|
|
child: Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
group.notes.first.content,
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: context.textTheme.bodyMedium,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|