Improve tag and images view, save website settings
This commit is contained in:
25
CHDataManagement/Views/Settings/LocalizedSettingsView.swift
Normal file
25
CHDataManagement/Views/Settings/LocalizedSettingsView.swift
Normal file
@ -0,0 +1,25 @@
|
||||
import SwiftUI
|
||||
|
||||
struct LocalizedSettingsView: View {
|
||||
|
||||
@ObservedObject
|
||||
var settings: LocalizedWebsiteData
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Title")
|
||||
.font(.headline)
|
||||
TextField("", text: $settings.title)
|
||||
Text("Description")
|
||||
.font(.headline)
|
||||
TextField("", text: $settings.description)
|
||||
Text("Icon description")
|
||||
.font(.headline)
|
||||
TextField("", text: $settings.iconDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
LocalizedSettingsView(settings: .english)
|
||||
}
|
@ -20,31 +20,65 @@ struct SettingsView: View {
|
||||
@State
|
||||
private var showFileImporter = false
|
||||
|
||||
@State
|
||||
private var showTagPicker = false
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Content Folder")
|
||||
.font(.headline)
|
||||
TextField("Content Folder", text: $contentPath)
|
||||
Button(action: selectContentFolder) {
|
||||
Text("Select folder")
|
||||
}
|
||||
Text("Output Folder")
|
||||
.font(.headline)
|
||||
TextField("Output Folder", text: $outputPath)
|
||||
Button(action: selectOutputFolder) {
|
||||
Text("Select folder")
|
||||
}
|
||||
Text("Feed")
|
||||
.font(.headline)
|
||||
Button(action: generateFeed) {
|
||||
Text("Generate")
|
||||
ScrollView {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Content Folder")
|
||||
.font(.headline)
|
||||
TextField("Content Folder", text: $contentPath)
|
||||
Button(action: selectContentFolder) {
|
||||
Text("Select folder")
|
||||
}
|
||||
Text("Output Folder")
|
||||
.font(.headline)
|
||||
TextField("Output Folder", text: $outputPath)
|
||||
Button(action: selectOutputFolder) {
|
||||
Text("Select folder")
|
||||
}
|
||||
Text("Navigation Bar Items")
|
||||
.font(.headline)
|
||||
FlowHStack {
|
||||
ForEach(content.websiteData.navigationTags, id: \.id) { tag in
|
||||
TagView(tag: .init(
|
||||
en: tag.english.name,
|
||||
de: tag.german.name)
|
||||
)
|
||||
.foregroundStyle(.white)
|
||||
}
|
||||
Button(action: { showTagPicker = true }) {
|
||||
Image(systemSymbol: .squareAndPencilCircleFill)
|
||||
.resizable()
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.frame(height: 22)
|
||||
.foregroundColor(Color.gray)
|
||||
.background(Circle()
|
||||
.fill(Color.white)
|
||||
.padding(1))
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
LocalizedSettingsView(settings: content.websiteData.localized(in: language))
|
||||
Text("Feed")
|
||||
.font(.headline)
|
||||
Button(action: generateFeed) {
|
||||
Text("Generate")
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.padding()
|
||||
.fileImporter(
|
||||
isPresented: $showFileImporter,
|
||||
allowedContentTypes: [.folder],
|
||||
onCompletion: didSelectContentFolder)
|
||||
.sheet(isPresented: $showTagPicker) {
|
||||
TagSelectionView(
|
||||
presented: $showTagPicker,
|
||||
selected: $content.websiteData.navigationTags,
|
||||
tags: $content.tags)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Folder selection
|
||||
@ -140,4 +174,5 @@ struct SettingsView: View {
|
||||
|
||||
#Preview {
|
||||
SettingsView()
|
||||
.environmentObject(Content.mock)
|
||||
}
|
||||
|
Reference in New Issue
Block a user