26 lines
729 B
Swift
Executable File
26 lines
729 B
Swift
Executable File
import SwiftUI
|
|
|
|
struct StatusBadge: View {
|
|
let run: SyncRun
|
|
|
|
var body: some View {
|
|
Label(text, systemImage: icon)
|
|
.font(.caption.weight(.semibold))
|
|
.padding(.horizontal, 8)
|
|
.padding(.vertical, 4)
|
|
.background(.quaternary, in: Capsule())
|
|
}
|
|
|
|
private var text: String {
|
|
if run.isRunning { return "Running" }
|
|
if run.wasCancelled { return "Cancelled" }
|
|
return run.succeeded ? "Success" : "Failed"
|
|
}
|
|
|
|
private var icon: String {
|
|
if run.isRunning { return "arrow.triangle.2.circlepath" }
|
|
if run.wasCancelled { return "stop.circle" }
|
|
return run.succeeded ? "checkmark.circle.fill" : "xmark.circle.fill"
|
|
}
|
|
}
|