Mark the lead's messages and answers as the lead's, not the human's

This commit is contained in:
Ian Gulliver
2026-10-20 12:20:51 -07:00
parent 181482e5d0
commit 0f33ad4524
14 changed files with 93 additions and 23 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ private struct PostView: View {
let member = str(p, "member") ?? ""
VStack(alignment: .leading, spacing: 4) {
HStack(spacing: 6) {
Text(member.isEmpty ? ev.actor : member).font(Fonts.font(12, weight: 700))
Text(member.isEmpty ? actorName(ev.actor) : member).font(Fonts.font(12, weight: 700))
if !member.isEmpty {
Text(str(p, "model") ?? "").foregroundStyle(Palette.muted)
}
+3 -3
View File
@@ -1154,7 +1154,7 @@ struct RowView: View {
TrailingBubble {
VStack(alignment: .leading, spacing: 2) {
HStack(spacing: 4) {
Text(actor)
Text(actorName(actor))
WhenText(when: when)
}
.font(Fonts.font(11))
@@ -1384,9 +1384,9 @@ private struct QuestionBubble: View {
return item.state.rawValue
}
if let options = answer.options, !options.isEmpty {
return "\(answer.user) chose: \(options.joined(separator: "; "))"
return "\(actorName(answer.user)) chose: \(options.joined(separator: "; "))"
}
return "\(answer.user) answered: \(firstLine(answer.text ?? ""))"
return "\(actorName(answer.user)) answered: \(firstLine(answer.text ?? ""))"
}
}
+7
View File
@@ -30,6 +30,13 @@ func dict(_ d: JSONDict, _ key: String) -> JSONDict? {
d[key] as? JSONDict
}
func actorName(_ actor: String) -> String {
guard actor.hasSuffix(" (lead)") else {
return actor
}
return "\(actor.dropLast(" (lead)".count))'s lead agent"
}
func jsString(_ v: (any Sendable)??) -> String {
switch v {
case .none, .some(.none):
+1 -1
View File
@@ -617,7 +617,7 @@ private struct Thread: View {
ForEach(item.responses, id: \.id) { r in
let images = r.images.isEmpty ? "" : " (\(r.images.count == 1 ? "1 image" : "\(r.images.count) images"))"
let rest = " \(r._type.rawValue.replacingOccurrences(of: "_", with: " "))\(r.options.map { ": \($0.joined(separator: "; "))" } ?? "")\(r.text.map { " — \($0)" } ?? "")\(images)"
Text("\(Text(r.user).font(Fonts.font(11, weight: 700)))\(rest)")
Text("\(Text(actorName(r.user)).font(Fonts.font(11, weight: 700)))\(rest)")
.textSelection(.enabled)
.fixedSize(horizontal: false, vertical: true)
}