Generate tag overview, add file action
This commit is contained in:
@ -47,68 +47,71 @@ struct MultiFileSelectionView: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
VStack {
|
||||
Text("Selected files")
|
||||
.font(.title)
|
||||
List {
|
||||
ForEach(newSelection) { file in
|
||||
HStack {
|
||||
Image(systemSymbol: .minusCircleFill)
|
||||
.foregroundStyle(.red)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture { deselect(file: file) }
|
||||
Text(file.id)
|
||||
Spacer()
|
||||
GeometryReader { geo in
|
||||
HStack {
|
||||
VStack {
|
||||
Text("Selected files")
|
||||
.font(.title)
|
||||
List {
|
||||
ForEach(newSelection) { file in
|
||||
HStack {
|
||||
Image(systemSymbol: .minusCircleFill)
|
||||
.foregroundStyle(.red)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture { deselect(file: file) }
|
||||
Text(file.id)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.onMove(perform: moveSelectedFile)
|
||||
}
|
||||
.onMove(perform: moveSelectedFile)
|
||||
}
|
||||
HStack {
|
||||
Button("Cancel") {
|
||||
DispatchQueue.main.async {
|
||||
HStack {
|
||||
Button("Cancel") {
|
||||
DispatchQueue.main.async {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
Button("Save") {
|
||||
selectedFiles = newSelection
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
Button("Save") {
|
||||
selectedFiles = newSelection
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
VStack {
|
||||
Picker("", selection: $selectedFileType) {
|
||||
let all: FileTypeCategory? = nil
|
||||
Text("All").tag(all)
|
||||
ForEach(FileTypeCategory.allCases) { type in
|
||||
Text(type.text).tag(type)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
.padding(.trailing, 7)
|
||||
.disabled(allowedType != nil)
|
||||
TextField("", text: $searchString, prompt: Text("Search"))
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.padding(.horizontal, 8)
|
||||
List(filteredFiles) { file in
|
||||
HStack {
|
||||
if newSelection.contains(file) {
|
||||
Image(systemSymbol: .checkmarkCircleFill)
|
||||
.foregroundStyle(.gray)
|
||||
} else {
|
||||
Image(systemSymbol: .plusCircleFill)
|
||||
.foregroundStyle(.green)
|
||||
}.frame(width: geo.size.width / 2)
|
||||
VStack {
|
||||
Picker("", selection: $selectedFileType) {
|
||||
let all: FileTypeCategory? = nil
|
||||
Text("All").tag(all)
|
||||
ForEach(FileTypeCategory.allCases) { type in
|
||||
Text(type.text).tag(type)
|
||||
}
|
||||
Text(file.id)
|
||||
Spacer()
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture { select(file: file) }
|
||||
}
|
||||
.padding(.trailing, 7)
|
||||
.disabled(allowedType != nil)
|
||||
TextField("", text: $searchString, prompt: Text("Search"))
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.padding(.horizontal, 8)
|
||||
List(filteredFiles) { file in
|
||||
HStack {
|
||||
if newSelection.contains(file) {
|
||||
Image(systemSymbol: .checkmarkCircleFill)
|
||||
.foregroundStyle(.gray)
|
||||
} else {
|
||||
Image(systemSymbol: .plusCircleFill)
|
||||
.foregroundStyle(.green)
|
||||
}
|
||||
Text(file.id)
|
||||
Spacer()
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture { select(file: file) }
|
||||
}
|
||||
}.frame(width: geo.size.width / 2)
|
||||
}
|
||||
.frame(minHeight: 500, idealHeight: 600)
|
||||
}
|
||||
.frame(minHeight: 500, idealHeight: 600)
|
||||
.padding()
|
||||
|
||||
}
|
||||
|
||||
private func deselect(file: FileResource) {
|
||||
|
Reference in New Issue
Block a user