Add tag overview, improve assets
This commit is contained in:
@ -37,11 +37,11 @@ struct FileDetailView: View {
|
||||
}
|
||||
Text("German Description")
|
||||
.font(.headline)
|
||||
TextField("", text: $file.germanDescription)
|
||||
TextField("", text: $file.german)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
Text("English Description")
|
||||
.font(.headline)
|
||||
TextField("", text: $file.englishDescription)
|
||||
TextField("", text: $file.english)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
if file.type.isImage {
|
||||
Text("Image size")
|
||||
|
@ -73,16 +73,30 @@ struct FileListView: View {
|
||||
guard oldValue != newValue else {
|
||||
return
|
||||
}
|
||||
if let selectedFile,
|
||||
newValue.matches(selectedFile.type) {
|
||||
let newFile = filteredFiles.first
|
||||
|
||||
guard let selectedFile else {
|
||||
if let newFile {
|
||||
DispatchQueue.main.async {
|
||||
selectedFile = newFile
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
selectedFile = filteredFiles.first
|
||||
|
||||
if newValue.matches(selectedFile.type) {
|
||||
return
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.selectedFile = newFile
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if selectedFile == nil {
|
||||
selectedFile = content.files.first
|
||||
DispatchQueue.main.async {
|
||||
selectedFile = content.files.first
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,17 +10,32 @@ struct FileSelectionView: View {
|
||||
|
||||
init(selectedFile: Binding<FileResource?>) {
|
||||
self._selectedFile = selectedFile
|
||||
self.newSelection = selectedFile.wrappedValue
|
||||
}
|
||||
|
||||
@State
|
||||
private var newSelection: FileResource?
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
FileListView(selectedFile: $selectedFile)
|
||||
FileListView(selectedFile: $newSelection)
|
||||
.frame(minHeight: 500, idealHeight: 600)
|
||||
HStack {
|
||||
Button("Cancel") {
|
||||
selectedFile = nil
|
||||
dismiss() }
|
||||
Button("Select") { dismiss() }
|
||||
DispatchQueue.main.async {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
Button("Remove") {
|
||||
DispatchQueue.main.async {
|
||||
selectedFile = nil
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
Button("Select") {
|
||||
selectedFile = newSelection
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
|
Reference in New Issue
Block a user