Move required files to settings
This commit is contained in:
@ -5,6 +5,18 @@ struct GeneralSettingsDetailView: View {
|
||||
@ObservedObject
|
||||
var generalSettings: GeneralSettings
|
||||
|
||||
@State
|
||||
private var showFileSelectionSheet = false
|
||||
|
||||
private var requiredFilesText: String {
|
||||
let count = generalSettings.requiredFiles.count
|
||||
switch count {
|
||||
case 0: return "No files"
|
||||
case 1: return "1 file"
|
||||
default: return "\(count) files"
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(alignment: .leading) {
|
||||
@ -19,7 +31,7 @@ struct GeneralSettingsDetailView: View {
|
||||
footer: "The maximum width of a link preview image")
|
||||
|
||||
IntegerPropertyView(
|
||||
title: "Link Preview Image Height",
|
||||
title: "Linfk Preview Image Height",
|
||||
value: $generalSettings.linkPreviewImageHeight,
|
||||
footer: "The maximum height of a link preview image")
|
||||
|
||||
@ -47,8 +59,29 @@ struct GeneralSettingsDetailView: View {
|
||||
title: "Push Notification Access Token",
|
||||
text: $generalSettings.pushNotificationAccessToken,
|
||||
footer: "The access token to use for sending push notifications")
|
||||
|
||||
GenericPropertyView(
|
||||
title: "Required files",
|
||||
footer: "The additional files required by the page") {
|
||||
HStack {
|
||||
Image(systemSymbol: .squareAndPencilCircleFill)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(height: 20)
|
||||
Text(requiredFilesText)
|
||||
Spacer()
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
showFileSelectionSheet = true
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.sheet(isPresented: $showFileSelectionSheet) {
|
||||
MultiFileSelectionView(selectedFiles: $generalSettings.requiredFiles, insertSorted: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user