fix(macos): make status lines non-selectable

This commit is contained in:
Peter Steinberger
2025-12-13 13:59:53 +00:00
parent 3ca77c46c7
commit d52ef185b1

View File

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