You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Musubi/App/Sources/ContentView.swift

90 lines
2.8 KiB

import DesignSystem
import MusubiCore
import SwiftUI
struct ContentView: View {
let sourceList: SourceListModel
let outputs: OutputController
var body: some View {
NavigationSplitView {
SourceListView(sourceList: sourceList)
.navigationSplitViewColumnWidth(min: 220, ideal: 260)
} detail: {
ScreensView(outputs: outputs)
}
.navigationTitle("Musubi")
.navigationSubtitle("NDI rein. Bild, Ton und Stimme raus.")
.toolbar {
if outputs.isSleepBlocked {
ToolbarItem(placement: .primaryAction) {
Text("Ruhezustand blockiert")
.font(Theme.Font.caption)
.foregroundStyle(Theme.Color.nezumi)
}
}
}
}
}
private struct SourceListView: View {
let sourceList: SourceListModel
var body: some View {
Group {
switch sourceList.state {
case .unavailable:
EmptyStateView(text: "NDI lässt sich nicht starten. Prüfe die Installation des NDI SDK.")
case .idle, .searching:
if sourceList.sources.isEmpty {
EmptyStateView(text: "Keine NDI-Quellen gefunden. Prüfe, ob das Technik-Netz an en7 hängt.")
} else {
List(sourceList.sources, id: \.ndiName) { source in
SourceRow(source: source)
.draggable(source.ndiName)
}
.scrollContentBackground(.hidden)
}
}
}
.background(Theme.Color.kasumi)
.safeAreaInset(edge: .top, spacing: 0) {
Text("Quellen")
.font(Theme.Font.title)
.foregroundStyle(Theme.Color.washi)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(Theme.Space.card)
}
}
}
private struct SourceRow: View {
let source: Source
var body: some View {
VStack(alignment: .leading, spacing: Theme.Space.unit / 2) {
Text(verbatim: source.label)
.font(Theme.Font.body)
.foregroundStyle(Theme.Color.washi)
Text(verbatim: source.ndiName)
.font(Theme.Font.caption.monospaced())
.foregroundStyle(Theme.Color.nezumi)
}
.padding(.vertical, Theme.Space.unit / 2)
}
}
private struct EmptyStateView: View {
let text: LocalizedStringKey
var body: some View {
Text(text)
.font(Theme.Font.body)
.foregroundStyle(Theme.Color.nezumi)
.multilineTextAlignment(.center)
.padding(Theme.Space.card * 2)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Theme.Color.sumi)
}
}

Powered by TurnKey Linux.