Files
buzz/mobile/lib/features/activity/activity_page/lists.dart
klopez4212 c8ea4fb4eb feat(mobile): polish Home navigation and Solo workspace (#8393)
## Summary
Polish mobile Home and Solo: group Search/Inbox beside a separate
profile avatar, move Inbox and Settings to bottom-up pages with Close
controls, and place tabs opposite the plus/compose action. Morph plus to
compose clockwise when entering Solo and reverse counterclockwise when
returning Home, with a directional quarter-turn of the icon inside a
level button and a subtle scale pulse, respecting reduced motion. Align
Search’s Close control with Inbox, simplify its placeholder, and
initialize selected filter contrast correctly. Collapse the plus menu
when leaving Home. Center Solo’s native-glass New chat empty state and
keep it stationary behind the keyboard.

Standardize Tabler icons and neutral backgrounds, retain SF Back/Close
on iOS, use native Liquid Glass headers, tab container, and actions
(solid grey selected tab, slightly darker on iOS) on iOS and black
actions on Android, and smooth the expanded menu corners. Repair native
header safe-area/return layout and compose movement after cancellation.

### Related issue
None found for this UI refinement; follows #8337.

### Testing
- Formatting, analysis, full mobile suite: 3,487 passed, 4 skipped; 3
push-configuration tests passed. File-size checks passed.
- Base UI built and installed on Pixel and iPhone in place. Pixel
navigation/New chat cancellation checked. Subsequent glass and rotation
refinements are previewed on iPhone; motion feel awaits human
confirmation.
- Draft pending human confirmation of the final Settings entrance/return
behavior on iPhone.

### Pixel snapshots
| Solo | Expanded actions |
| --- | --- |
| <img
src="https://raw.githubusercontent.com/block/buzz/16dc0f8af971e63d788fee20974997fab925dec9/docs/screenshots/mobile-home-solo/pixel-solo.png"
width="280" alt="Solo empty state with New chat" /> | <img
src="https://raw.githubusercontent.com/block/buzz/16dc0f8af971e63d788fee20974997fab925dec9/docs/screenshots/mobile-home-solo/pixel-actions.png"
width="280" alt="Expanded channel actions with smooth corners" /> |

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-10-16 12:28:02 -04:00

180 lines
5.5 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: BuzzIcons.clock,
message: 'No reminders',
detail: 'Reminders you set will show up here.',
);
}
final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
return BeeRefreshIndicator(
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 ? BuzzIcons.bellRing : BuzzIcons.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 ConsumerWidget {
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, WidgetRef ref) {
final names = ref.watch(identityNameSourcesProvider);
if (drafts.isEmpty) {
return const _EmptySurface(
icon: BuzzIcons.edit,
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,
names: names,
)
: '#${channel.name}';
return ListTile(
key: ValueKey('draft-row-${draft.key}'),
leading: Icon(
BuzzIcons.edit,
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(BuzzIcons.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}';
}