refactor(macos): collapse control channel status

This commit is contained in:
Peter Steinberger
2025-12-20 21:17:32 +01:00
parent f34f374179
commit 35a25c3dc2

View File

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