Show HTML pages in a task view beside the transcript

This commit is contained in:
Ian Gulliver
2026-10-21 17:52:04 -07:00
parent af9c750298
commit 585c8ba5f8
16 changed files with 600 additions and 102 deletions
+14 -2
View File
@@ -506,8 +506,20 @@ private struct Attachments: View {
private func content(_ a: Attachment) -> some View {
switch a.kind {
case .file:
let lines = a.startLine.map { ":\($0)\(a.endLine.map { "-\($0)" } ?? "")" } ?? ""
code("\(a.path ?? "")\(lines)").textSelection(.enabled)
let path = a.path ?? ""
let root = (store.findTask(taskId)?.worktreePath ?? "") + "/"
let rel = path.hasPrefix(root) ? String(path.dropFirst(root.count)) : path
if isPage(rel) && !rel.hasPrefix("/") {
Button(path) {
store.openFile(taskId, rel)
}
.buttonStyle(.plain)
.foregroundStyle(Palette.accent)
.help("Show the page beside the transcript")
} else {
let lines = a.startLine.map { ":\($0)\(a.endLine.map { "-\($0)" } ?? "")" } ?? ""
code("\(path)\(lines)").textSelection(.enabled)
}
case .diff:
Text("diff \(code(a.ref ?? ""))").textSelection(.enabled)
case .image: