blob: ae69d063a9ba90a4637861e0dcbd1e922f0d3bf9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
import SwiftUI
struct BatchSweepSummaryView: View {
@Bindable var viewModel: DomainViewModel
let summary: BatchSweepSummary
@State private var showUnchangedDomains = false
private var visibleResults: [BatchLookupResult] {
if showUnchangedDomains {
return summary.results
}
return summary.results.filter(\.hasMeaningfulChange)
}
var body: some View {
NavigationStack {
List {
Section("Overview") {
statRow(label: "Checked", value: "\(summary.totalDomains)")
statRow(label: "Changed", value: "\(summary.changedDomains)")
statRow(label: "Warnings", value: "\(summary.warningDomains)")
statRow(label: "Unchanged", value: "\(summary.unchangedDomains)")
}
Section {
Toggle("Show unchanged domains", isOn: $showUnchangedDomains)
}
Section(visibleResults.isEmpty ? "Changed Domains" : "Results") {
if visibleResults.isEmpty {
Text("No domains with changes or warnings")
.font(.system(.caption, design: .monospaced))
.foregroundStyle(Color(.appTextSecondary))
} else {
ForEach(visibleResults) { result in
if let entry = viewModel.historyEntry(for: result) {
NavigationLink {
HistoryDetailView(viewModel: viewModel, entry: entry)
} label: {
BatchResultRowView(result: result)
}
} else {
BatchResultRowView(result: result)
}
}
}
}
}
.navigationTitle(summary.source == .watchlistRefresh ? "Sweep Summary" : "Batch Summary")
}
}
private func statRow(label: String, value: String) -> some View {
HStack {
Text(label)
.font(.system(.caption, design: .monospaced))
.foregroundStyle(Color(.appTextSecondary))
Spacer()
Text(value)
.font(.system(.callout, design: .monospaced))
.foregroundStyle(.primary)
}
}
}
|