refactor(macos): collapse control channel status
parent
f34f374179
commit
35a25c3dc2
|
|
@ -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))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue