broken changes

This commit is contained in:
Mark Gregory
2026-11-05 21:27:41 +00:00
parent 78c4411fa6
commit d348aa76ca
5 changed files with 27 additions and 29 deletions
+11 -4
View File
@@ -513,10 +513,15 @@ private struct LibraryCommands {
var play: () -> Void
var next: () -> Void
var video: () -> Void
var settings: () -> Void
}
private struct StudioSettingsAction { var open: () -> Void }
private struct StudioSettingsActionKey: FocusedValueKey { typealias Value = StudioSettingsAction }
private struct LibraryCommandsKey: FocusedValueKey { typealias Value = LibraryCommands }
private extension FocusedValues {
var studioSettings: StudioSettingsAction? {
get { self[StudioSettingsActionKey.self] }
set { self[StudioSettingsActionKey.self] = newValue }
}
var libraryCommands: LibraryCommands? {
get { self[LibraryCommandsKey.self] }
set { self[LibraryCommandsKey.self] = newValue }
@@ -526,6 +531,7 @@ private extension FocusedValues {
@StateObject private var model = AppModel(storageURL:ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] == nil ? nil : FileManager.default.temporaryDirectory.appendingPathComponent("KJMix-TestHost-"+String(ProcessInfo.processInfo.processIdentifier)))
@AppStorage("studioAppearance") private var appearance = "system"
@FocusedValue(\.libraryCommands) private var actions
@FocusedValue(\.studioSettings) private var settingsAction
@FocusedValue(\.nameReinterpretation) private var nameActions
var body: some Scene {
Window("KJMix Pro", id: "main") {
@@ -540,7 +546,7 @@ private extension FocusedValues {
Button("New Venue…") { model.creating = .venue }.keyboardShortcut("n", modifiers: [.command, .option])
}
CommandGroup(replacing:.appSettings) {
Button("Settings…") { actions?.settings() }.keyboardShortcut(",").disabled(actions == nil)
Button("Settings…") { settingsAction?.open() }.keyboardShortcut(",").disabled(settingsAction == nil)
}
CommandMenu("Library") {
Button("Song Info…") { actions?.songInfo() }.keyboardShortcut("i").disabled(actions?.canEdit != true)
@@ -775,7 +781,7 @@ struct LibraryView: View {
private var workspaceLayout: some View {
TabView(selection:$workspaceTab) {
libraryWorkspace.tabItem { Label("Karaoke",systemImage:"music.mic") }.tag("Karaoke")
DJConsole(model:model,system:model.dj,expanded:true)
DJConsole(system:model.dj)
.tabItem { Label("DJ Studio",systemImage:"opticaldisc") }.tag("DJ Studio")
}.accessibilityIdentifier("workspace.tabs")
}
@@ -784,7 +790,8 @@ struct LibraryView: View {
.background(StudioTheme.frame)
.tint(.accentColor)
.focusedSceneValue(\.nameReinterpretation,NameReinterpretationCommands(perform:{beginReinterpretation()},enabled:workspaceTab == "Karaoke" && ["Library","Singer Songs"].contains(source) && (selectedSong != nil || !tableSelection.isEmpty)))
.focusedSceneValue(\.libraryCommands,workspaceTab == "Karaoke" ? LibraryCommands(importMusic:{importing = true},songInfo:{editingSong = selectedSong},canEdit:selectedSong != nil,play:playSelected,next:playNext,video:{openWindow(id:"lyrics")},settings:{studioSettingsModal = true}) : nil)
.focusedSceneValue(\.studioSettings,StudioSettingsAction(open:{studioSettingsModal = true}))
.focusedSceneValue(\.libraryCommands,workspaceTab == "Karaoke" ? LibraryCommands(importMusic:{importing = true},songInfo:{editingSong = selectedSong},canEdit:selectedSong != nil,play:playSelected,next:playNext,video:{openWindow(id:"lyrics")}) : nil)
.sheet(isPresented:$studioSettingsModal) { StudioSettingsDialog(model:model,scope:workspaceTab == "DJ Studio" ? "DJ" : "Karaoke") }
.navigationTitle(workspaceTab == "DJ Studio" ? "DJ Studio" : source == "Singer Songs" ? (model.singers.first { $0.id == model.selectedSinger }?.name ?? "Singer") : source)
.navigationSubtitle(model.currentVenueName)