import SwiftUI struct ContentView: View { @EnvironmentObject private var app: AppModel var body: some View { VStack(spacing: 0) { NavigationSplitView { List(AppModel.Section.allCases, selection: $app.section) { item in Label(item.rawValue, systemImage: item.icon).tag(item) } .listStyle(.sidebar) .navigationTitle("Tonuino Manager") .safeAreaInset(edge: .bottom) { HStack(spacing: 8) { Circle().fill(app.library.rootURL == nil ? Color.secondary : Color.green).frame(width: 8, height: 8) Text(app.library.activeProfile.map { "Lokal · \($0.name)" } ?? (app.library.rootURL?.lastPathComponent ?? "Keine Bibliothek ausgewählt")) .lineLimit(1).foregroundStyle(.secondary) } .font(.caption).padding() } } detail: { switch app.section { case .library: LibraryView() case .cards: CardsView() case .tonuino: TonuinoSettingsView() case .settings: SettingsView() } } .frame(maxWidth: .infinity, maxHeight: .infinity) HStack { Spacer(minLength: 0) Text(app.status) .font(.caption) .foregroundStyle(.secondary) .lineLimit(1) .truncationMode(.tail) .frame(maxWidth: 520, alignment: .trailing) } .padding(.horizontal, 14) .padding(.vertical, 6) .frame(maxWidth: .infinity) .background(.regularMaterial) .overlay(alignment: .top) { Rectangle().fill(.primary.opacity(0.08)).frame(height: 1) } } .alert("Fehler", isPresented: $app.showError) { Button("OK", role: .cancel) { } } message: { Text(app.errorMessage ?? "Unbekannter Fehler") } } }