Quieter transcript metadata: day dividers, time-only rows, muted meta rows
- Date once per calendar day: a muted centred divider above each day's
first timed row (chatDayDividers); rows show only their time ("10:16"),
with the full date and time kept in the tooltip and semantics. The user's
time shares the delivery line; a harness notice's time trails its line.
- Activity line and turn chips are secondary: bodyMedium, regular weight,
onSurfaceVariant (error colour kept for failures), a small chevron_right
that turns down while its details are open (replaces expand_less).
- Copy / Read aloud: 18 px muted icons; on pointer devices shown only while
the reply is hovered or an action is focused (also without the gutter);
touch keeps them visible with a full tap target. The time leads the
footer so hidden actions leave no gap.
- Settled questions: the question on one line, the operator's answer in
full on its own line beneath it.
- Meta rows (activity, chips, notices, compaction line) start at the reply
text's leading edge; turn chips sit in their own column under the answer.
- Scroll fixture: ?timestamps=1 spreads messages over two days.
Row keys are unchanged; the divider joins a row without replacing it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import '../../../core/api_gateway.dart';
|
||||
import 'chat_transcript.dart';
|
||||
|
||||
/// When a transcript row was recorded, in epoch milliseconds, or null when it
|
||||
/// carries no valid time (cards, grouped chips, local rows).
|
||||
///
|
||||
/// An agent turn records its first message's time on the row; a user turn, a
|
||||
/// notice or a report carries it on its `message`; a run of grouped notices
|
||||
/// takes its first notice's.
|
||||
int? chatRowCreatedAt(JsonMap row) {
|
||||
final own = chatMessageCreatedAt(row);
|
||||
if (own != null) return own;
|
||||
final message = row['message'];
|
||||
if (message is Map) {
|
||||
return chatMessageCreatedAt(Map<String, dynamic>.from(message));
|
||||
}
|
||||
final messages = row['messages'];
|
||||
if (messages is List) {
|
||||
for (final message in messages) {
|
||||
if (message is! Map) continue;
|
||||
final time = chatMessageCreatedAt(Map<String, dynamic>.from(message));
|
||||
if (time != null) return time;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// The local calendar day of epoch milliseconds [createdAt].
|
||||
DateTime chatLocalDay(int createdAt) {
|
||||
final local = DateTime.fromMillisecondsSinceEpoch(
|
||||
createdAt,
|
||||
isUtc: true,
|
||||
).toLocal();
|
||||
return DateTime(local.year, local.month, local.day);
|
||||
}
|
||||
|
||||
/// For each of [rows], the local day a date divider above it names, or null.
|
||||
///
|
||||
/// The first timed row of each calendar day gets its day, so a transcript
|
||||
/// shows the date once per day and each row only its time. Rows without a
|
||||
/// time never start a day and never break one.
|
||||
List<DateTime?> chatDayDividers(List<JsonMap> rows) {
|
||||
DateTime? current;
|
||||
return [
|
||||
for (final row in rows)
|
||||
switch (chatRowCreatedAt(row)) {
|
||||
null => null,
|
||||
final time when chatLocalDay(time) == current => null,
|
||||
final time => current = chatLocalDay(time),
|
||||
},
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user