Replace static NAS status label with live sync status indicator
Swap dot + "NAS Connected/Offline" for an icon + text that reflects the actual engine/coordinator state: Running → ↻ arrow.triangle.2.circlepath (orange) Checking → 🔍 magnifyingglass (gray) Paused → ⏸ pause.fill (orange) Offline → wifi.slash (red) Stopped → ■ stop.fill (gray) Animates crossfade between states. Nothing else changed. Co-Authored-By: Kutesir <kutesir@provoc.ug> Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
@@ -528,27 +528,41 @@ struct BackupView: View {
|
|||||||
}
|
}
|
||||||
.frame(height: 16)
|
.frame(height: 16)
|
||||||
|
|
||||||
if statusService.snapshot.connectionState != .unknown {
|
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
Circle()
|
Image(systemName: syncStatusIcon)
|
||||||
.fill(nasConnectionStatusColor)
|
.font(.system(size: 9, weight: .medium))
|
||||||
.frame(width: 5, height: 5)
|
.foregroundStyle(syncStatusColor)
|
||||||
Text(nasConnectionStatusLabel)
|
Text(syncStatusLabel)
|
||||||
.font(.system(size: 9, weight: .regular))
|
.font(.system(size: 9, weight: .medium))
|
||||||
.foregroundStyle(nasConnectionStatusColor)
|
.foregroundStyle(syncStatusColor)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
.animation(.easeInOut(duration: 0.2), value: syncStatusLabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var nasConnectionStatusColor: Color {
|
private var syncStatusIcon: String {
|
||||||
statusService.snapshot.connectionState == .offline
|
if engine.job.status == .preparing { return "magnifyingglass" }
|
||||||
? AppTheme.destructive
|
if engine.job.status.isActive { return "arrow.triangle.2.circlepath" }
|
||||||
: Color(red: 1.0, green: 0.58, blue: 0.0)
|
if engine.job.status == .paused { return "pause.fill" }
|
||||||
|
if statusService.isRefreshing || coordinator.phase == .checking { return "magnifyingglass" }
|
||||||
|
if statusService.snapshot.connectionState == .offline { return "wifi.slash" }
|
||||||
|
return "stop.fill"
|
||||||
}
|
}
|
||||||
|
|
||||||
private var nasConnectionStatusLabel: String {
|
private var syncStatusColor: Color {
|
||||||
statusService.snapshot.connectionState == .offline ? "NAS Offline" : "NAS Connected"
|
if engine.job.status.isActive { return Color(red: 1.0, green: 0.58, blue: 0.0) }
|
||||||
|
if engine.job.status == .paused { return Color(red: 1.0, green: 0.58, blue: 0.0) }
|
||||||
|
if statusService.snapshot.connectionState == .offline { return AppTheme.destructive }
|
||||||
|
return AppTheme.inkQuaternary
|
||||||
|
}
|
||||||
|
|
||||||
|
private var syncStatusLabel: String {
|
||||||
|
if engine.job.status == .preparing { return "Checking" }
|
||||||
|
if engine.job.status.isActive { return "Running" }
|
||||||
|
if engine.job.status == .paused { return "Paused" }
|
||||||
|
if statusService.isRefreshing || coordinator.phase == .checking { return "Checking" }
|
||||||
|
if statusService.snapshot.connectionState == .offline { return "Offline" }
|
||||||
|
return "Stopped"
|
||||||
}
|
}
|
||||||
|
|
||||||
private func compactStat(_ value: String, label: String, color: Color) -> some View {
|
private func compactStat(_ value: String, label: String, color: Color) -> some View {
|
||||||
|
|||||||
Reference in New Issue
Block a user