ChWebsiteApp/CHDataManagement/Views/Settings/PathSettingsView.swift
2024-12-17 23:05:45 +01:00

75 lines
2.8 KiB
Swift

import SwiftUI
struct PathSettingsView: View {
@Environment(\.language)
private var language
@EnvironmentObject
private var content: Content
var body: some View {
ScrollView {
VStack(alignment: .leading) {
DetailTitle(
title: "Folder Settings",
text: "Select the folders for the app to work.")
FolderOnDiskPropertyView(
title: "Content Folder",
folder: $content.storage.contentPath,
footer: "The folder where the raw content of the website is stored") { url in
guard content.storage.save(contentPath: url) else {
return
}
#warning("Reload database")
}
FolderOnDiskPropertyView(
title: "Output Folder",
folder: $content.storage.outputPath,
footer: "The folder where the generated website is stored") { url in
content.storage.save(outputPath: url)
}
StringPropertyView(
title: "Pages output folder",
text: $content.settings.paths.pagesOutputFolderPath,
footer: "The path in the output folder where the generated pages are stored")
StringPropertyView(
title: "Tags output folder",
text: $content.settings.paths.tagsOutputFolderPath,
footer: "The path in the output folder where the generated tag pages are stored")
StringPropertyView(
title: "Files output folder",
text: $content.settings.paths.filesOutputFolderPath,
footer: "The path in the output folder where the copied files are stored")
StringPropertyView(
title: "Images output folder",
text: $content.settings.paths.imagesOutputFolderPath,
footer: "The path in the output folder where the generated images are stored")
StringPropertyView(
title: "Videos output folder",
text: $content.settings.paths.videosOutputFolderPath,
footer: "The path in the output folder where the generated videos are stored")
StringPropertyView(
title: "Assets output folder",
text: $content.settings.paths.assetsOutputFolderPath,
footer: "The path in the output folder where assets are stored")
}
.padding()
}
}
}
#Preview {
PathSettingsView()
.environmentObject(Content.mock)
.padding()
}