72 lines
2.9 KiB
Swift
72 lines
2.9 KiB
Swift
import SwiftUI
|
|
|
|
// Activity — full-width agent-actions feed (append-only audit / publish report).
|
|
|
|
public struct ActivityView: View {
|
|
@Environment(\.tokens) private var t
|
|
var model: CockpitModel
|
|
|
|
public init(model: CockpitModel) { self.model = model }
|
|
|
|
public var body: some View {
|
|
Scroll {
|
|
VStack(alignment: .leading, spacing: 0) {
|
|
if let shot = model.bumpScreenshot, let img = decodeImage(shot) {
|
|
BumpScreenshotCard(image: img).padding(.bottom, t.s4)
|
|
}
|
|
HStack {
|
|
SectionLabel(text: "Agent actions · live")
|
|
Spacer()
|
|
Text("audit ↗").font(.system(size: 11)).foregroundStyle(t.accent)
|
|
}
|
|
.padding(.bottom, t.s3)
|
|
ForEach(model.actions) { a in
|
|
HStack(alignment: .top, spacing: 10) {
|
|
Text(a.time).font(.system(size: 11, design: .monospaced)).foregroundStyle(t.ink3)
|
|
.frame(width: 46, alignment: .leading)
|
|
Circle().fill(a.ok ? t.ok : t.warn).frame(width: 7, height: 7).padding(.top, 5)
|
|
HStack(spacing: 6) {
|
|
if let s = a.surface {
|
|
Text(s.glyph).font(.system(size: 11, weight: .bold))
|
|
.foregroundStyle(s.isNSFWAnchor ? t.anchorFg : t.ink2)
|
|
}
|
|
Text(a.summary).font(.system(size: 13)).foregroundStyle(t.ink2)
|
|
}
|
|
Spacer(minLength: 0)
|
|
}
|
|
.padding(.vertical, 10)
|
|
Divider().overlay(t.line2)
|
|
}
|
|
}
|
|
.padding(t.s5)
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
.background(t.bg)
|
|
}
|
|
}
|
|
|
|
/// The latest availability-bump overlay screenshot — the visual "here's exactly
|
|
/// what the automation focused on" record captured by the Tryst driver each bump.
|
|
private struct BumpScreenshotCard: View {
|
|
@Environment(\.tokens) private var t
|
|
let image: Image
|
|
|
|
var body: some View {
|
|
Card {
|
|
VStack(alignment: .leading, spacing: t.s2) {
|
|
HStack(spacing: 6) {
|
|
Image(systemName: "cursorarrow.rays").font(.system(size: 12, weight: .bold))
|
|
.foregroundStyle(t.accent)
|
|
SectionLabel(text: "Latest Tryst bump")
|
|
Spacer()
|
|
}
|
|
image
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
.frame(maxWidth: .infinity)
|
|
.clipShape(RoundedRectangle(cornerRadius: t.radiusSm))
|
|
.overlay(RoundedRectangle(cornerRadius: t.radiusSm).strokeBorder(t.line2, lineWidth: 1))
|
|
}
|
|
}
|
|
}
|
|
}
|