Repository Public
1// ORIX DJ2// File: App/Sources/Features/Studio/StudioView.swift3// Description: The DJ Studio: decks on both sides of the mixer (two or four), with the library browser underneath.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7import ORIXDJCore8import SwiftUI910struct StudioView: View {11 @Environment(AppModel.self) private var model12 @Environment(AppSettings.self) private var settings1314 var body: some View {15 @Bindable var model = model16 let four = model.deckCountShown == 417 VStack(spacing: 8) {18 HStack(spacing: 8) {19 Picker("Decks", selection: Binding(get: { model.deckCountShown }, set: { model.deckCountShown = $0; settings.deckCount = $0 })) {20 Text("2 Decks").tag(2); Text("4 Decks").tag(4)21 }22 .pickerStyle(.segmented).fixedSize().labelsHidden().accessibilityIdentifier("studio-deck-count")23 Picker("Deck layout", selection: Binding(get: { model.deckMode }, set: { model.deckMode = $0; settings.deckMode = $0 })) {24 ForEach(DeckMode.allCases) { Text($0.title).tag($0) }25 }26 .pickerStyle(.segmented).fixedSize().labelsHidden().accessibilityIdentifier("studio-deck-mode")27 Spacer()28 if model.hasRecoverableSession, model.decks.allSatisfy({ $0.track == nil }) {29 Button("Restore Previous Session") { model.recoverSession() }.help("Reload the decks, mixer and effects as they were when ORIX DJ last closed.")30 }31 Button { model.section = .effects } label: { Label("Effects", systemImage: "slider.horizontal.3") }32 Button { model.section = .performance } label: { Label("Perform", systemImage: "play.square.stack") }33 }34 .controlSize(.small)35 HStack(alignment: .top, spacing: 8) {36 VStack(spacing: 8) {37 DeckView(deck: 0, mode: model.deckMode, compact: four)38 if four { DeckView(deck: 2, mode: model.deckMode, compact: true) }39 }40 MixerView(decks: four ? [2, 0, 1, 3] : [0, 1]).frame(width: four ? 300 : 232).frame(maxHeight: .infinity)41 VStack(spacing: 8) {42 DeckView(deck: 1, mode: model.deckMode, compact: four)43 if four { DeckView(deck: 3, mode: model.deckMode, compact: true) }44 }45 }46 .fixedSize(horizontal: false, vertical: true)47 if true {48 LibraryView(compact: true)49 .frame(minHeight: 96, maxHeight: .infinity)50 .background(ORIX.Palette.surface, in: RoundedRectangle(cornerRadius: ORIX.Radius.card, style: .continuous))51 .overlay(RoundedRectangle(cornerRadius: ORIX.Radius.card, style: .continuous).strokeBorder(ORIX.Palette.hairline))52 .clipShape(RoundedRectangle(cornerRadius: ORIX.Radius.card, style: .continuous))53 }54 }55 .padding(10)56 .accessibilityElement(children: .contain).accessibilityIdentifier("studio")57 }58}59