native macOS codings agent orchestrator prowl.onev.cat
Something went wrong. Try again.
Swift
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495import SwiftUI
extension WorkflowHistoryStatus { static func tint(_ state: String) -> Color { switch state { case "completed": .green case "active", "running": .blue case "needs_attention", "interrupted", "iteration_limit_reached": .orange case "failed": .red default: .secondary } }}
struct WorkflowHistoryStatusIcon: View { let state: String
var body: some View { Image(systemName: WorkflowHistoryStatus.symbol(state)) .foregroundStyle(WorkflowHistoryStatus.tint(state)) .accessibilityLabel(WorkflowHistoryStatus.label(state)) .help(WorkflowHistoryStatus.label(state)) }}
struct WorkflowHistoryIconButton: View { let label: String let symbol: String let action: () -> Void
var body: some View { Button(label, systemImage: symbol, action: action) .labelStyle(.iconOnly) .buttonStyle(.borderless) .controlSize(.small) .help(label) .accessibilityLabel(label) }}
struct WorkflowHistoryDisclosureStyle: DisclosureGroupStyle { func makeBody(configuration: Configuration) -> some View { VStack(alignment: .leading, spacing: 0) { Button { configuration.isExpanded.toggle() } label: { HStack(spacing: 8) { Image(systemName: configuration.isExpanded ? "chevron.down" : "chevron.right") .font(.caption2.weight(.semibold)) .foregroundStyle(.secondary) .frame(width: 10) .accessibilityHidden(true) configuration.label } .padding(.horizontal, 8) .padding(.vertical, 9) .contentShape(.rect) } .buttonStyle(WorkflowHistoryRowButtonStyle(expanded: configuration.isExpanded)) .accessibilityValue(configuration.isExpanded ? "Expanded" : "Collapsed") .accessibilityHint("Expand or collapse step details") .help(configuration.isExpanded ? "Collapse step" : "Expand step") if configuration.isExpanded { configuration.content .padding(.leading, 26) .padding(.trailing, 8) .padding(.vertical, 10) } } }}
private struct WorkflowHistoryRowButtonStyle: ButtonStyle { let expanded: Bool
func makeBody(configuration: Configuration) -> some View { Row(configuration: configuration, expanded: expanded) }
private struct Row: View { let configuration: ButtonStyleConfiguration let expanded: Bool @State private var hovering = false
var body: some View { configuration.label .background( Color.primary.opacity(configuration.isPressed ? 0.12 : hovering ? 0.08 : expanded ? 0.04 : 0), in: RoundedRectangle(cornerRadius: 6) ) .onHover { hovering = $0 } } }}