2025-02-05 15:40:09 +01:00

71 lines
2.2 KiB
Swift

import SwiftUI
struct SettingsSheet: View {
private let sidebarWidth: CGFloat = 250
private let contentWidth: CGFloat = 300
@Environment(\.dismiss)
private var dismiss
@Binding
var language: ContentLanguage
@State
var section: SettingsSection = .general
private var title: String {
switch section {
case .general: "General Settings"
case .paths: "Folder Settings"
case .navigationBar: "Navigation Bar Settings"
case .postFeed: "Post Feed Settings"
case .pages: "Pages Settings"
case .tagOverview: "Tag Overview Settings"
case .audioPlayer: "Audio Player Settings"
}
}
private var text: String {
switch section {
case .general: "General settings for the webpage"
case .paths: "Select the folders for the app to work."
case .navigationBar: "Customize the navigation bar for all pages at the top of the website"
case .postFeed: "Change the way the posts are displayed"
case .pages: "Change the way pages are displayed"
case .tagOverview: "Configure the page showing all tags"
case .audioPlayer: "Configure the files and settings for the audio player components"
}
}
var body: some View {
VStack(spacing: 0) {
HStack(alignment: .top) {
DetailTitle(
title: title,
text: text)
Spacer()
Picker("", selection: $language) {
Text("English")
.tag(ContentLanguage.english)
Text("German")
.tag(ContentLanguage.german)
}
.pickerStyle(.segmented)
Button(action: { dismiss() }) {
Text("Close")
}
}
.padding()
.background(Color(NSColor.windowBackgroundColor))
NavigationSplitView {
SettingsListView(section: $section)
.navigationSplitViewColumnWidth(min: sidebarWidth, ideal: sidebarWidth, max: sidebarWidth)
} detail: {
SettingsContentView(section: section)
}
}.frame(width: 550, height: 600)
}
}