fix(macos): make status lines non-selectable
parent
3ca77c46c7
commit
d52ef185b1
|
|
@ -21,11 +21,17 @@ struct MenuContent: View {
|
|||
VStack(alignment: .leading, spacing: 8) {
|
||||
Toggle(isOn: self.activeBinding) {
|
||||
let label = self.state.connectionMode == .remote ? "Remote Clawdis Active" : "Clawdis Active"
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(label)
|
||||
self.statusLine(label: self.healthStatus.label, color: self.healthStatus.color)
|
||||
}
|
||||
}
|
||||
Toggle(isOn: self.heartbeatsBinding) {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text("Send Heartbeats")
|
||||
self.statusLine(label: self.heartbeatStatus.label, color: self.heartbeatStatus.color)
|
||||
}
|
||||
}
|
||||
self.statusRow
|
||||
Toggle(isOn: self.heartbeatsBinding) { Text("Send Heartbeats") }
|
||||
self.heartbeatStatusRow
|
||||
Toggle(isOn: self.voiceWakeBinding) { Text("Voice Wake") }
|
||||
.disabled(!voiceWakeSupported)
|
||||
.opacity(voiceWakeSupported ? 1 : 0.5)
|
||||
|
|
@ -198,8 +204,7 @@ struct MenuContent: View {
|
|||
NotificationCenter.default.post(name: .clawdisSelectSettingsTab, object: tab)
|
||||
}
|
||||
|
||||
private var statusRow: some View {
|
||||
let (label, color): (String, Color) = {
|
||||
private var healthStatus: (label: String, color: Color) {
|
||||
if let activity = self.activityStore.current {
|
||||
let color: Color = activity.role == .main ? .accentColor : .gray
|
||||
let roleLabel = activity.role == .main ? "Main" : "Other"
|
||||
|
|
@ -228,27 +233,9 @@ struct MenuContent: View {
|
|||
case .unknown:
|
||||
return ("Health pending", .secondary)
|
||||
}
|
||||
}()
|
||||
|
||||
return Button(
|
||||
action: {},
|
||||
label: {
|
||||
HStack(spacing: 8) {
|
||||
Circle()
|
||||
.fill(color)
|
||||
.frame(width: 8, height: 8)
|
||||
Text(label)
|
||||
.font(.caption.weight(.semibold))
|
||||
.foregroundStyle(.primary)
|
||||
}
|
||||
.padding(.vertical, 4)
|
||||
})
|
||||
.buttonStyle(.plain)
|
||||
.disabled(true)
|
||||
}
|
||||
|
||||
private var heartbeatStatusRow: some View {
|
||||
let (label, color): (String, Color) = {
|
||||
private var heartbeatStatus: (label: String, color: Color) {
|
||||
if case .degraded = self.controlChannel.state {
|
||||
return ("Control channel disconnected", .red)
|
||||
} else if let evt = self.heartbeatStore.lastEvent {
|
||||
|
|
@ -268,23 +255,19 @@ struct MenuContent: View {
|
|||
} else {
|
||||
return ("No heartbeat yet", .secondary)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return Button(
|
||||
action: {},
|
||||
label: {
|
||||
HStack(spacing: 8) {
|
||||
@ViewBuilder
|
||||
private func statusLine(label: String, color: Color) -> some View {
|
||||
HStack(spacing: 6) {
|
||||
Circle()
|
||||
.fill(color)
|
||||
.frame(width: 8, height: 8)
|
||||
.frame(width: 6, height: 6)
|
||||
Text(label)
|
||||
.font(.caption.weight(.semibold))
|
||||
.foregroundStyle(.primary)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.padding(.vertical, 2)
|
||||
})
|
||||
.buttonStyle(.plain)
|
||||
.disabled(true)
|
||||
.padding(.top, 2)
|
||||
}
|
||||
|
||||
private var activeBinding: Binding<Bool> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue