Add tag overview, improve assets

This commit is contained in:
Christoph Hagen
2024-12-15 21:20:12 +01:00
parent 8a3a0f1797
commit 1e67a99866
59 changed files with 1301 additions and 480 deletions

View File

@ -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")

View File

@ -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
}
}
}
}

View File

@ -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()