Move settings + generation to sheets
This commit is contained in:
115
CHDataManagement/Views/Generation/GenerationContentView.swift
Normal file
115
CHDataManagement/Views/Generation/GenerationContentView.swift
Normal file
@ -0,0 +1,115 @@
|
||||
import SwiftUI
|
||||
|
||||
struct GenerationContentView: View {
|
||||
|
||||
@Environment(\.language)
|
||||
private var language
|
||||
|
||||
@EnvironmentObject
|
||||
private var content: Content
|
||||
|
||||
@Environment(\.dismiss)
|
||||
private var dismiss
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Website Generation")
|
||||
.font(.largeTitle)
|
||||
.bold()
|
||||
Text("Regenerate the website and monitor the output")
|
||||
.foregroundStyle(.secondary)
|
||||
.padding(.bottom, 30)
|
||||
|
||||
HStack {
|
||||
Button {
|
||||
if content.isGeneratingWebsite {
|
||||
content.endCurrentGeneration()
|
||||
} else {
|
||||
content.generateWebsiteInAllLanguages()
|
||||
}
|
||||
} label: {
|
||||
Text(content.isGeneratingWebsite ? "Cancel" : "Generate")
|
||||
}
|
||||
.disabled(content.isGeneratingWebsite != content.shouldGenerateWebsite)
|
||||
if content.isGeneratingWebsite {
|
||||
ProgressView()
|
||||
.progressViewStyle(.circular)
|
||||
.frame(height: 25)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
Text(content.generationStatus)
|
||||
.padding(.vertical, 5)
|
||||
HStack(spacing: 8) {
|
||||
Text("\(content.results.imagesToGenerate.count) images")
|
||||
Text("\(content.results.externalLinks.count) external links")
|
||||
Text("\(content.results.resultCount) items processed")
|
||||
Text("\(content.results.requiredFiles.count) files")
|
||||
}
|
||||
List {
|
||||
Section("Inaccessible files (\(content.results.inaccessibleFiles.count))") {
|
||||
ForEach(content.results.inaccessibleFiles.sorted()) { file in
|
||||
Text(file.id)
|
||||
}
|
||||
}
|
||||
Section("Unparsable files (\(content.results.unparsableFiles.count))") {
|
||||
ForEach(content.results.unparsableFiles.sorted()) { file in
|
||||
Text(file.id)
|
||||
}
|
||||
}
|
||||
Section("Missing files (\(content.results.missingFiles.count))") {
|
||||
ForEach(content.results.missingFiles.sorted(), id: \.self) { file in
|
||||
Text(file)
|
||||
}
|
||||
}
|
||||
Section("Missing tags (\(content.results.missingTags.count))") {
|
||||
ForEach(content.results.missingTags.sorted(), id: \.self) { tag in
|
||||
Text(tag)
|
||||
}
|
||||
}
|
||||
Section("Missing pages (\(content.results.missingPages.count))") {
|
||||
ForEach(content.results.missingPages.sorted(), id: \.self) { page in
|
||||
Text(page)
|
||||
}
|
||||
}
|
||||
Section("Invalid commands (\(content.results.invalidCommands.count))") {
|
||||
ForEach(content.results.invalidCommands.sorted(), id: \.self) { markdown in
|
||||
Text(markdown)
|
||||
}
|
||||
}
|
||||
Section("Invalid blocks (\(content.results.invalidBlocks.count))") {
|
||||
ForEach(content.results.invalidBlocks.sorted(), id: \.self) { markdown in
|
||||
Text(markdown)
|
||||
}
|
||||
}
|
||||
Section("Warnings (\(content.results.warnings.count))") {
|
||||
ForEach(content.results.warnings.sorted(), id: \.self) { warning in
|
||||
Text(warning)
|
||||
}
|
||||
}
|
||||
Section("Unsaved output files (\(content.results.unsavedOutputFiles.count))") {
|
||||
ForEach(content.results.unsavedOutputFiles.sorted(), id: \.self) { file in
|
||||
Text(file)
|
||||
}
|
||||
}
|
||||
Section("Empty pages (\(content.results.emptyPages.count))") {
|
||||
ForEach(content.results.emptyPages.sorted()) { id in
|
||||
Text("\(id.pageId) (\(id.language))")
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(minHeight: 400)
|
||||
HorizontalCenter {
|
||||
Button(action: { dismiss() }) {
|
||||
Text("Close")
|
||||
}
|
||||
}
|
||||
}.padding()
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
GenerationContentView()
|
||||
.environmentObject(Content.mock)
|
||||
.padding()
|
||||
}
|
Reference in New Issue
Block a user