mirror of
https://github.com/block/buzz.git
synced 2026-11-03 07:51:22 +00:00
## Summary - Polish mobile Home, Activity, Search, and Settings navigation chrome. - Add progressive Buzz gradients/frost, aligned theme colors, dividers, typography, and section spacing. - Refine Search and Settings motion, including automatic keyboard focus on search activation. <img width="630" height="1368" alt="C78FA3CE-F2B3-45F2-B9F5-7EA7500778CC" src="https://github.com/user-attachments/assets/5935514b-d894-4010-80dd-a938363fee93" /> <img width="630" height="1368" alt="5C058A73-1879-476A-881C-531ACC256D84" src="https://github.com/user-attachments/assets/5266c841-17ee-49e8-9841-b06d84f4195f" /> <img width="630" height="1368" alt="3F50ADB7-9BDA-4A8D-A81E-20560C3B9EA6" src="https://github.com/user-attachments/assets/f615f61e-9e96-4bce-b261-ae5ec54db872" /> <img width="630" height="1368" alt="35ECE741-01F3-4B79-80C5-1DDD447121A7" src="https://github.com/user-attachments/assets/b5145186-9884-44eb-8ebc-f3303831c0a4" /> ## Validation - `flutter analyze` - Focused Home, Activity, Channels, Search, theme, and footer widget tests - Full pre-push checks, including mobile tests, desktop checks, and Tauri checks - On-device iPhone review during the visual polish pass --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Signed-off-by: npub1glqcqfjxdens59scl477pmejh8lht4hqkhx0y4w38jxr6e6w6y2sm29y4e <47c18026466e670a1618fd7de0ef32b9ff75d6e0b5ccf255d13c8c3d674ed115@buzz.block.builderlab.xyz> Signed-off-by: Code Reviewer <037593536284cf40e221c96c931e9877d4166d54f6bb84e5341a86d7fd5d05a4@buzz.block.builderlab.xyz> Signed-off-by: Kenny Lopez <klopez4212@gmail.com> Co-authored-by: npub1glqcqfjxdens59scl477pmejh8lht4hqkhx0y4w38jxr6e6w6y2sm29y4e <47c18026466e670a1618fd7de0ef32b9ff75d6e0b5ccf255d13c8c3d674ed115@buzz.block.builderlab.xyz> Co-authored-by: Code Reviewer <037593536284cf40e221c96c931e9877d4166d54f6bb84e5341a86d7fd5d05a4@buzz.block.builderlab.xyz>
175 lines
5.4 KiB
Dart
175 lines
5.4 KiB
Dart
part of '../activity_page.dart';
|
|
|
|
/// Reminders surface for the Reminders filter — due/pending NIP-ER
|
|
/// reminders that deep-link to their target message.
|
|
class _RemindersList extends ConsumerWidget {
|
|
final ScrollController scrollController;
|
|
final void Function(Reminder reminder) onOpen;
|
|
final Future<void> Function() onRefresh;
|
|
|
|
const _RemindersList({
|
|
required this.scrollController,
|
|
required this.onOpen,
|
|
required this.onRefresh,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final remindersAsync = ref.watch(remindersProvider);
|
|
final reminders = [
|
|
for (final r in remindersAsync.value ?? const <Reminder>[])
|
|
if (r.status == 'pending') r,
|
|
];
|
|
|
|
if (remindersAsync.isLoading && reminders.isEmpty) {
|
|
return const Center(
|
|
child: BuzzLoadingIndicator(
|
|
size: 44,
|
|
semanticLabel: 'Loading reminders',
|
|
),
|
|
);
|
|
}
|
|
if (reminders.isEmpty) {
|
|
return const _EmptySurface(
|
|
icon: LucideIcons.clock,
|
|
message: 'No reminders',
|
|
detail: 'Reminders you set will show up here.',
|
|
);
|
|
}
|
|
|
|
final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
|
return RefreshIndicator(
|
|
onRefresh: onRefresh,
|
|
child: ListView.builder(
|
|
controller: scrollController,
|
|
padding: _activityScrollPadding(context),
|
|
itemCount: reminders.length,
|
|
itemBuilder: (context, index) {
|
|
final reminder = reminders[index];
|
|
final due = reminder.isDue(now);
|
|
final title = reminder.note?.trim().isNotEmpty == true
|
|
? reminder.note!.trim()
|
|
: reminder.target?.preview ?? 'Reminder';
|
|
return ListTile(
|
|
key: ValueKey('reminder-row-${reminder.id}'),
|
|
leading: Icon(
|
|
due ? LucideIcons.bellRing : LucideIcons.clock,
|
|
size: 20,
|
|
color: due
|
|
? context.colors.primary
|
|
: context.colors.onSurfaceVariant,
|
|
),
|
|
title: Text(title, maxLines: 2, overflow: TextOverflow.ellipsis),
|
|
subtitle: reminder.notBefore != null
|
|
? Text(
|
|
due
|
|
? 'Due now'
|
|
: 'Due ${_inboxTimestamp(reminder.notBefore!)}',
|
|
)
|
|
: null,
|
|
onTap: () => onOpen(reminder),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Drafts surface for the Drafts filter — locally saved unsent composer
|
|
/// text that reopens the target composer.
|
|
class _DraftsList extends StatelessWidget {
|
|
final List<ComposeDraft> drafts;
|
|
final ScrollController scrollController;
|
|
final Map<String, Channel> channelById;
|
|
final String? myPubkey;
|
|
final void Function(ComposeDraft draft) onOpen;
|
|
final void Function(ComposeDraft draft) onDelete;
|
|
|
|
const _DraftsList({
|
|
required this.drafts,
|
|
required this.scrollController,
|
|
required this.channelById,
|
|
required this.myPubkey,
|
|
required this.onOpen,
|
|
required this.onDelete,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (drafts.isEmpty) {
|
|
return const _EmptySurface(
|
|
icon: LucideIcons.filePen,
|
|
message: 'No drafts',
|
|
detail: 'Unsent messages you start composing will show up here.',
|
|
);
|
|
}
|
|
|
|
return ListView.builder(
|
|
controller: scrollController,
|
|
padding: _activityScrollPadding(context),
|
|
itemCount: drafts.length,
|
|
itemBuilder: (context, index) {
|
|
final draft = drafts[index];
|
|
final channel = channelById[draft.channelId];
|
|
final destination = channel == null
|
|
? 'Unavailable channel'
|
|
: channel.isDm
|
|
? resolveDmChannelDisplayLabel(channel, currentPubkey: myPubkey)
|
|
: '#${channel.name}';
|
|
return ListTile(
|
|
key: ValueKey('draft-row-${draft.key}'),
|
|
leading: Icon(
|
|
LucideIcons.filePen,
|
|
size: 20,
|
|
color: context.colors.onSurfaceVariant,
|
|
),
|
|
title: Text(draft.text, maxLines: 2, overflow: TextOverflow.ellipsis),
|
|
subtitle: Text(
|
|
draft.threadHeadId != null ? 'Thread in $destination' : destination,
|
|
),
|
|
trailing: IconButton(
|
|
icon: const Icon(LucideIcons.trash2, size: 18),
|
|
tooltip: 'Delete draft',
|
|
onPressed: () => onDelete(draft),
|
|
),
|
|
onTap: () => onOpen(draft),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Inbox list timestamp — desktop's `formatInboxTimestamp`:
|
|
/// time today, "Yesterday", short date this year, dated otherwise.
|
|
String _inboxTimestamp(int unixSeconds, {DateTime? now}) {
|
|
final current = now ?? DateTime.now();
|
|
final date = DateTime.fromMillisecondsSinceEpoch(unixSeconds * 1000);
|
|
final today = DateTime(current.year, current.month, current.day);
|
|
final day = DateTime(date.year, date.month, date.day);
|
|
final dayDiff = today.difference(day).inDays;
|
|
|
|
if (dayDiff == 0) {
|
|
final hour = date.hour % 12 == 0 ? 12 : date.hour % 12;
|
|
final minute = date.minute.toString().padLeft(2, '0');
|
|
return '$hour:$minute ${date.hour < 12 ? 'AM' : 'PM'}';
|
|
}
|
|
if (dayDiff == 1) return 'Yesterday';
|
|
|
|
const months = [
|
|
'Jan',
|
|
'Feb',
|
|
'Mar',
|
|
'Apr',
|
|
'May',
|
|
'Jun',
|
|
'Jul',
|
|
'Aug',
|
|
'Sep',
|
|
'Oct',
|
|
'Nov',
|
|
'Dec',
|
|
];
|
|
final label = '${months[date.month - 1]} ${date.day}';
|
|
return date.year == current.year ? label : '$label, ${date.year}';
|
|
}
|