summaryrefslogtreecommitdiff
path: root/DomainDig/TimelineView.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-24 15:04:54 -0500
committerChristian Cleberg <[email protected]>2026-04-24 15:04:54 -0500
commit3f0b7746b1bee4c2f626eb805e3fd13c5f2f5d22 (patch)
tree17c710faf6191ac86ea5b6cab4df240cf2cefef9 /DomainDig/TimelineView.swift
parentd0b3b7a15b59266b4ae4262fdb0364245092c17c (diff)
downloaddomain-dig-3f0b7746b1bee4c2f626eb805e3fd13c5f2f5d22.tar.gz
domain-dig-3f0b7746b1bee4c2f626eb805e3fd13c5f2f5d22.tar.bz2
domain-dig-3f0b7746b1bee4c2f626eb805e3fd13c5f2f5d22.zip
DomainDig v3.8.0 — Smart Monitoring
* Stable domain intervals * Frequent changes decrease intervals * Duplicate states do not trigger alerts * Quiet hours suppress alerts * Quiet hours across midnight work correctly * Sensitivity levels alter behavior as expected
Diffstat (limited to 'DomainDig/TimelineView.swift')
-rw-r--r--DomainDig/TimelineView.swift60
1 files changed, 24 insertions, 36 deletions
diff --git a/DomainDig/TimelineView.swift b/DomainDig/TimelineView.swift
index 404fc1e..b163c76 100644
--- a/DomainDig/TimelineView.swift
+++ b/DomainDig/TimelineView.swift
@@ -12,6 +12,10 @@ struct TimelineView: View {
viewModel.timelineSections(for: domain)
}
+ private var compareButtonDisabled: Bool {
+ viewModel.selectedSnapshots.count != 2 && viewModel.historyEntries(for: domain).count < 2
+ }
+
var body: some View {
List {
ForEach(timelineSections) { section in
@@ -61,10 +65,16 @@ struct TimelineView: View {
}
Button("Compare") {
- presentedDiff = viewModel.generateDiffForSelectedSnapshots()
+ if viewModel.selectedSnapshots.count == 2 {
+ presentedDiff = viewModel.generateDiffForSelectedSnapshots()
+ } else {
+ let entries = viewModel.historyEntries(for: domain)
+ guard entries.count >= 2 else { return }
+ presentedDiff = viewModel.generateDiff(from: entries[1], to: entries[0])
+ }
focusedSectionID = viewModel.currentDiffTargetSectionID
}
- .disabled(viewModel.selectedSnapshots.count != 2)
+ .disabled(compareButtonDisabled)
Menu("Export") {
Button("Export TXT") {
@@ -119,46 +129,24 @@ private struct TimelineRow: View {
HStack(spacing: 8) {
AppStatusBadgeView(model: AppStatusFactory.availability(summary.availability))
- if let primaryIP = summary.primaryIP {
- AppStatusBadgeView(
- model: .init(
- title: primaryIP,
- systemImage: "network",
- foregroundColor: .blue,
- backgroundColor: .blue.opacity(0.16)
- )
- )
- }
- if let tlsStatus = summary.tlsStatus {
- AppStatusBadgeView(
- model: .init(
- title: tlsStatus.capitalized,
- systemImage: "lock.shield",
- foregroundColor: .green,
- backgroundColor: .green.opacity(0.16)
- )
- )
- }
if let riskScore = summary.riskScore {
- AppStatusBadgeView(
- model: .init(
- title: "Risk \(riskScore)",
- systemImage: "exclamationmark.shield",
- foregroundColor: riskScore >= 70 ? .red : .orange,
- backgroundColor: (riskScore >= 70 ? Color.red : .orange).opacity(0.16)
- )
- )
+ Text("Risk \(riskScore)")
+ .lineLimit(1)
+ .minimumScaleFactor(0.85)
}
}
+ .font(appDensity.font(.caption2))
+ .foregroundStyle(.secondary)
HStack(spacing: 8) {
- if let snapshotIndex = summary.snapshotIndex {
- Text("#\(snapshotIndex)")
- }
- Text(summary.timestamp.formatted(.relative(presentation: .named)))
- if summary.changeCount > 0 {
- Text("\(summary.changeCount) changes")
+ if let primaryIP = summary.primaryIP {
+ Text(primaryIP)
+ .lineLimit(1)
+ .truncationMode(.middle)
}
+ Spacer(minLength: 8)
+ Text(summary.timestamp.formatted(date: .abbreviated, time: .shortened))
+ .lineLimit(1)
}
.font(appDensity.font(.caption2))
.foregroundStyle(.secondary)