Move settings + generation to sheets
This commit is contained in:
70
CHDataManagement/Views/Settings/SettingsSheet.swift
Normal file
70
CHDataManagement/Views/Settings/SettingsSheet.swift
Normal file
@@ -0,0 +1,70 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user