ChWebsiteApp/CHDataManagement/Views/Settings/Posts/PostFeedSettingsView.swift
2025-02-05 15:40:09 +01:00

60 lines
1.9 KiB
Swift

import SwiftUI
struct PostFeedSettingsView: View {
@Environment(\.language)
private var language
@ObservedObject
var postSettings: PostSettings
private var transferImage: (language: ContentLanguage, image: FileResource)? {
postSettings.localized(in: language.next).linkPreview.image.map {
(language.next, $0)
}
}
var body: some View {
ScrollView {
VStack(alignment: .leading) {
IntegerPropertyView(
title: "Content Width",
value: $postSettings.contentWidth,
footer: "The maximum width of the content the post feed (in pixels)")
IntegerPropertyView(
title: "Posts Per Page",
value: $postSettings.postsPerPage,
footer: "The maximum number of posts displayed on a single page")
FilePropertyView(
title: "Default CSS File",
footer: "The CSS file containing the styling of all post pages",
selectedFile: $postSettings.defaultCssFile)
FilePropertyView(
title: "Swiper CSS File",
footer: "The CSS file containing the styling of image galleries in post feeds",
selectedFile: $postSettings.swiperCssFile)
FilePropertyView(
title: "Swiper JavaScript File",
footer: "The JavaScript file to load the image gallery code in post feeds",
selectedFile: $postSettings.swiperJsFile)
LocalizedPostFeedSettingsView(
settings: postSettings.localized(in: language),
transferImage: transferImage)
.id(language)
}
.padding()
}
}
}
#Preview {
PostFeedSettingsView(postSettings: .default)
.padding()
}