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:
@@ -17,6 +17,7 @@ import 'session_activity_badge.dart';
|
||||
import 'session_harness_icon.dart';
|
||||
import 'session_pane_menu.dart';
|
||||
import 'session_row_style.dart';
|
||||
import 'chat_awaiting.dart';
|
||||
|
||||
/// One chat in the list, in the app's shared row on both hosts: the harness
|
||||
/// avatar, the title with its recency, one muted line, and the actions menu.
|
||||
@@ -109,8 +110,10 @@ class ChatSessionRow extends StatelessWidget {
|
||||
final unread = unseen && !closed;
|
||||
final text = chatSessionSubtitle(session);
|
||||
final updatedAt = _chatSessionInstant(session['updated_at']);
|
||||
final awaiting = closed ? 0 : chatSessionAwaitingOperator(session);
|
||||
final avatar = ChatSessionAvatar(
|
||||
session: session,
|
||||
awaitingOperator: awaiting,
|
||||
running: session['running'] == true && !unseen,
|
||||
backgroundTasks: session['running'] == true
|
||||
? 0
|
||||
@@ -122,78 +125,82 @@ class ChatSessionRow extends StatelessWidget {
|
||||
color: marker,
|
||||
visible: visible,
|
||||
active: selected,
|
||||
child: AppListRow(
|
||||
key: Key('chat-row-$id'),
|
||||
selected: selected,
|
||||
selectedFill: Colors.transparent,
|
||||
emphasized: unread,
|
||||
divider: divider,
|
||||
onTap: () => onOpen(session),
|
||||
onLongPress: selectionOnly ? null : onLongPress,
|
||||
accent: chatColorShade(context, chatSessionColor(session)),
|
||||
showAccentBorder: false,
|
||||
leading: avatar,
|
||||
// The star rides in the title's own text, so a narrow row ellipsises
|
||||
// them together.
|
||||
title: Text.rich(
|
||||
TextSpan(
|
||||
text: chatSessionTitle(session),
|
||||
children: [
|
||||
if (session['starred'] == true)
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 4),
|
||||
child: _Star(color: accent),
|
||||
child: ChatAwaitingHighlight(
|
||||
waiting: awaiting > 0,
|
||||
child: AppListRow(
|
||||
key: Key('chat-row-$id'),
|
||||
selected: selected,
|
||||
selectedFill: Colors.transparent,
|
||||
emphasized: unread,
|
||||
divider: divider,
|
||||
onTap: () => onOpen(session),
|
||||
onLongPress: selectionOnly ? null : onLongPress,
|
||||
accent: chatColorShade(context, chatSessionColor(session)),
|
||||
showAccentBorder: false,
|
||||
leading: avatar,
|
||||
// The star rides in the title's own text, so a narrow row ellipsises
|
||||
// them together.
|
||||
title: Text.rich(
|
||||
TextSpan(
|
||||
text: chatSessionTitle(session),
|
||||
children: [
|
||||
if (session['starred'] == true)
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 4),
|
||||
child: _Star(color: accent),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
timeWidget: updatedAt == null
|
||||
? null
|
||||
: DefaultTextStyle.merge(
|
||||
style: TextStyle(
|
||||
color: unread ? accent : chatMetadataForeground(context),
|
||||
timeWidget: updatedAt == null
|
||||
? null
|
||||
: DefaultTextStyle.merge(
|
||||
style: TextStyle(
|
||||
color: unread ? accent : chatMetadataForeground(context),
|
||||
),
|
||||
child: RelativeTimeLabel(instant: updatedAt),
|
||||
),
|
||||
// `Closed` leads the line of a closed chat, then the model and folder.
|
||||
subtitle: ChatSessionSubtitle(
|
||||
machineName:
|
||||
ServerContext.nameFor(
|
||||
context,
|
||||
'${session['_server_id'] ?? ''}',
|
||||
) ??
|
||||
session['_server_name'] as String?,
|
||||
metadata: text,
|
||||
closed: closed,
|
||||
active: selected,
|
||||
visible: visible,
|
||||
running: session['running'] == true,
|
||||
backgroundTasks: chatSessionBackgroundTasks(session),
|
||||
awaitingOperator: awaiting,
|
||||
unread: unread,
|
||||
),
|
||||
subtitleTrailing: unread
|
||||
? AppListStatusDot(
|
||||
key: const Key('chat-row-unread'),
|
||||
color: accent,
|
||||
semanticLabel: 'New',
|
||||
size: 10,
|
||||
)
|
||||
: null,
|
||||
menu: selectionOnly
|
||||
? null
|
||||
: SessionActionsButton(
|
||||
key: Key('chat-actions-$id'),
|
||||
session: session,
|
||||
duplicateTitles: duplicateTitles,
|
||||
onSelected: onAction,
|
||||
allowOpenBeside: onOpenBeside != null,
|
||||
allowOpenBelow: onOpenBelow != null,
|
||||
allowFloat: onFloat != null,
|
||||
paneMenu: paneMenu,
|
||||
),
|
||||
child: RelativeTimeLabel(instant: updatedAt),
|
||||
),
|
||||
// `Closed` leads the line of a closed chat, then the model and folder.
|
||||
subtitle: ChatSessionSubtitle(
|
||||
machineName:
|
||||
ServerContext.nameFor(
|
||||
context,
|
||||
'${session['_server_id'] ?? ''}',
|
||||
) ??
|
||||
session['_server_name'] as String?,
|
||||
metadata: text,
|
||||
closed: closed,
|
||||
active: selected,
|
||||
visible: visible,
|
||||
running: session['running'] == true,
|
||||
backgroundTasks: chatSessionBackgroundTasks(session),
|
||||
unread: unread,
|
||||
),
|
||||
subtitleTrailing: unread
|
||||
? AppListStatusDot(
|
||||
key: const Key('chat-row-unread'),
|
||||
color: accent,
|
||||
semanticLabel: 'New',
|
||||
size: 10,
|
||||
)
|
||||
: null,
|
||||
menu: selectionOnly
|
||||
? null
|
||||
: SessionActionsButton(
|
||||
key: Key('chat-actions-$id'),
|
||||
session: session,
|
||||
duplicateTitles: duplicateTitles,
|
||||
onSelected: onAction,
|
||||
allowOpenBeside: onOpenBeside != null,
|
||||
allowOpenBelow: onOpenBelow != null,
|
||||
allowFloat: onFloat != null,
|
||||
paneMenu: paneMenu,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -233,12 +240,14 @@ class ChatSessionAvatar extends StatelessWidget {
|
||||
required this.session,
|
||||
this.running = false,
|
||||
this.backgroundTasks = 0,
|
||||
this.awaitingOperator = 0,
|
||||
this.selected = false,
|
||||
});
|
||||
|
||||
final JsonMap session;
|
||||
final bool running;
|
||||
final int backgroundTasks;
|
||||
final int awaitingOperator;
|
||||
final bool selected;
|
||||
|
||||
@override
|
||||
@@ -266,6 +275,7 @@ class ChatSessionAvatar extends StatelessWidget {
|
||||
badge: chatSessionActivityBadge(
|
||||
running: running,
|
||||
backgroundTasks: backgroundTasks,
|
||||
awaitingOperator: awaitingOperator,
|
||||
),
|
||||
child: SessionHarnessIcon(session: session, color: mark),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user