mirror of
https://github.com/openclaw/casa.git
synced 2026-07-01 20:54:20 -04:00
Fix scene selection state
This commit is contained in:
@@ -73,7 +73,7 @@ struct ApiDocsView: View {
|
||||
Text("Scene Filter")
|
||||
.font(.headline)
|
||||
Picker("Scene", selection: $selectedSceneId) {
|
||||
Text("All scenes").tag(Optional<UUID>.none)
|
||||
Text("All scenes").tag(Optional(SceneSelection.allScenesId))
|
||||
ForEach(scenes, id: \.uniqueIdentifier) { scene in
|
||||
Text(scene.name).tag(Optional(scene.uniqueIdentifier))
|
||||
}
|
||||
@@ -89,7 +89,7 @@ struct ApiDocsView: View {
|
||||
}
|
||||
|
||||
private var selectedScene: HMActionSet? {
|
||||
guard let selectedSceneId else { return nil }
|
||||
guard let selectedSceneId, selectedSceneId != SceneSelection.allScenesId else { return nil }
|
||||
return scenes.first { $0.uniqueIdentifier == selectedSceneId }
|
||||
}
|
||||
|
||||
|
||||
@@ -58,3 +58,7 @@ struct CasaScene {
|
||||
let type: String
|
||||
let isExecuting: Bool
|
||||
}
|
||||
|
||||
enum SceneSelection {
|
||||
static let allScenesId = UUID(uuidString: "00000000-0000-0000-0000-000000000001")!
|
||||
}
|
||||
|
||||
@@ -128,7 +128,6 @@ private enum MainSelection: Hashable {
|
||||
|
||||
|
||||
private struct SidebarView: View {
|
||||
static let allScenesId = UUID(uuidString: "00000000-0000-0000-0000-000000000001")!
|
||||
@EnvironmentObject private var model: CasaAppModel
|
||||
@ObservedObject private var settings = CasaSettings.shared
|
||||
let accessories: [HMAccessory]
|
||||
@@ -183,10 +182,10 @@ private struct SidebarView: View {
|
||||
|
||||
Section("Scenes") {
|
||||
Button {
|
||||
sceneSelection = SidebarView.allScenesId
|
||||
sceneSelection = SceneSelection.allScenesId
|
||||
accessorySelection = nil
|
||||
} label: {
|
||||
sidebarRow(title: "All scenes", isSelected: sceneSelection == SidebarView.allScenesId)
|
||||
sidebarRow(title: "All scenes", isSelected: sceneSelection == SceneSelection.allScenesId)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user