Add navigation settings, fix page generation

This commit is contained in:
Christoph Hagen
2025-01-02 11:56:51 +01:00
parent 922ba4ebe7
commit 4d4275e072
43 changed files with 921 additions and 581 deletions

View File

@ -0,0 +1,27 @@
import SwiftUI
struct TextFieldPropertyView: View {
let title: LocalizedStringKey
@Binding
var text: String
let prompt: String?
let footer: LocalizedStringKey
init(title: LocalizedStringKey, text: Binding<String>, prompt: String? = nil, footer: LocalizedStringKey) {
self.title = title
self._text = text
self.prompt = prompt
self.footer = footer
}
var body: some View {
GenericPropertyView(title: title, footer: footer) {
DescriptionField(text: $text)
.textFieldStyle(.roundedBorder)
}
}
}

View File

@ -60,6 +60,11 @@ struct GenerationContentView: View {
Text("\(content.results.requiredFiles.count) files")
}
List {
Section("Empty pages") {
ForEach(content.results.emptyPages.sorted()) { id in
Text("\(id.pageId) (\(id.language))")
}
}
Section("Inaccessible files") {
ForEach(content.results.inaccessibleFiles.sorted()) { file in
Text(file.id)

View File

@ -0,0 +1,16 @@
import SwiftUI
struct LocalizedNavigationBarSettingsView: View {
@ObservedObject
var settings: LocalizedNavigationSettings
var body: some View {
VStack(alignment: .leading) {
StringPropertyView(
title: "Root URL",
text: $settings.rootUrl,
footer: "The url leading to the root page for the language")
}
}
}

View File

@ -7,30 +7,20 @@ struct LocalizedPostFeedSettingsView: View {
var body: some View {
VStack(alignment: .leading) {
Text("Title")
.font(.headline)
TextField("", text: $settings.title)
.textFieldStyle(.roundedBorder)
.frame(maxWidth: 400)
Text("The title of all post feed pages.")
.foregroundStyle(.secondary)
.padding(.bottom)
StringPropertyView(
title: "Title",
text: $settings.title,
footer: "The title of all post feed pages.")
Text("URL prefix")
.font(.headline)
TextField("", text: $settings.feedUrlPrefix)
.textFieldStyle(.roundedBorder)
.frame(maxWidth: 400)
Text("The prefix to generate the urls for all post feed pages.")
.foregroundStyle(.secondary)
.padding(.bottom)
StringPropertyView(
title: "URL prefix",
text: $settings.feedUrlPrefix,
footer: "The prefix to generate the urls for all post feed pages.")
Text("Description")
.font(.headline)
DescriptionField(text: $settings.description)
Text("The description of all post feed pages.")
.foregroundStyle(.secondary)
.padding(.bottom)
TextFieldPropertyView(
title: "Description",
text: $settings.description,
footer: "The description of all post feed pages.")
}
}
}

View File

@ -35,19 +35,21 @@ struct NavigationBarSettingsView: View {
.buttonStyle(.plain)
}
ForEach(content.settings.navigationItems) { tag in
ForEach(content.settings.navigation.navigationItems) { tag in
TagView(text: tag.title(in: language))
.foregroundStyle(.white)
}
Text("Select the tags to show in the navigation bar. The number should be even.")
.foregroundStyle(.secondary)
LocalizedNavigationBarSettingsView(settings: content.settings.navigation.localized(in: language))
}
.padding()
}
.sheet(isPresented: $showItemPicker) {
ItemSelectionView(
isPresented: $showItemPicker,
selectedItems: $content.settings.navigationItems)
selectedItems: $content.settings.navigation.navigationItems)
}
}
}