Show loudly in the chat list when a chat is waiting on the operator
The server's chat activity now counts each session's unanswered approvals and questions (awaiting_operator) and pushes it to every connection when it changes. A waiting chat's list row pulses in the error colour with a solid bar on its leading edge, its avatar wears a ringing bell in place of the spinner, and its state line leads with a bold "Waiting for you". Reduced motion holds the pulse and the bell still. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,9 +16,11 @@ class ChatSessionStateLine extends StatelessWidget {
|
||||
required this.running,
|
||||
required this.backgroundTasks,
|
||||
required this.unread,
|
||||
this.awaitingOperator = 0,
|
||||
});
|
||||
final bool active, visible, running, unread;
|
||||
final int backgroundTasks;
|
||||
final int awaitingOperator;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -32,10 +34,28 @@ class ChatSessionStateLine extends StatelessWidget {
|
||||
(Icons.pending_actions, '$backgroundTasks background'),
|
||||
if (unread) (Icons.mark_chat_unread_outlined, 'New'),
|
||||
];
|
||||
final error = Theme.of(context).colorScheme.error;
|
||||
return Wrap(
|
||||
spacing: 10,
|
||||
runSpacing: 4,
|
||||
children: [
|
||||
if (awaitingOperator > 0)
|
||||
Row(
|
||||
key: const Key('chat-row-awaiting-label'),
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.notifications_active, size: 16, color: error),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
awaitingOperator == 1
|
||||
? 'Waiting for you'
|
||||
: 'Waiting for you ($awaitingOperator)',
|
||||
style: TextStyle(color: error, fontWeight: FontWeight.w800),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
for (final (icon, label) in entries)
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -66,10 +86,12 @@ class ChatSessionSubtitle extends StatelessWidget {
|
||||
required this.running,
|
||||
required this.backgroundTasks,
|
||||
required this.unread,
|
||||
this.awaitingOperator = 0,
|
||||
});
|
||||
final String metadata;
|
||||
final String? machineName;
|
||||
final bool closed, active, visible, running, unread;
|
||||
final int awaitingOperator;
|
||||
final int backgroundTasks;
|
||||
@override
|
||||
Widget build(BuildContext context) => Column(
|
||||
@@ -93,7 +115,12 @@ class ChatSessionSubtitle extends StatelessWidget {
|
||||
),
|
||||
style: TextStyle(color: chatMetadataForeground(context)),
|
||||
),
|
||||
if (active || visible || running || backgroundTasks > 0 || unread)
|
||||
if (active ||
|
||||
visible ||
|
||||
running ||
|
||||
backgroundTasks > 0 ||
|
||||
unread ||
|
||||
awaitingOperator > 0)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: ChatSessionStateLine(
|
||||
@@ -102,6 +129,7 @@ class ChatSessionSubtitle extends StatelessWidget {
|
||||
running: running,
|
||||
backgroundTasks: backgroundTasks,
|
||||
unread: unread,
|
||||
awaitingOperator: awaitingOperator,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user