refactor(macos): collapse control channel status

main
Peter Steinberger 2025-12-20 21:17:32 +01:00
parent f34f374179
commit 35a25c3dc2
1 changed files with 9 additions and 9 deletions

View File

@ -197,15 +197,15 @@ struct GeneralSettings: View {
VStack(alignment: .leading, spacing: 4) { VStack(alignment: .leading, spacing: 4) {
Text("Control channel") Text("Control channel")
.font(.caption.weight(.semibold)) .font(.caption.weight(.semibold))
if !self.isControlStatusDuplicate { if !self.isControlStatusDuplicate || ControlChannel.shared.lastPingMs != nil {
Text(self.controlStatusLine) let status = self.isControlStatusDuplicate ? nil : self.controlStatusLine
.font(.caption) let ping = ControlChannel.shared.lastPingMs.map { "Ping \(Int($0)) ms" }
.foregroundStyle(.secondary) let line = [status, ping].compactMap { $0 }.joined(separator: " · ")
} if !line.isEmpty {
if let ping = ControlChannel.shared.lastPingMs { Text(line)
Text("Last ping: \(Int(ping)) ms") .font(.caption)
.font(.caption) .foregroundStyle(.secondary)
.foregroundStyle(.secondary) }
} }
if let hb = HeartbeatStore.shared.lastEvent { if let hb = HeartbeatStore.shared.lastEvent {
let ageText = age(from: Date(timeIntervalSince1970: hb.ts / 1000)) let ageText = age(from: Date(timeIntervalSince1970: hb.ts / 1000))