Skip to content

Commit

Permalink
Add section header to 'category change' view
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-128 committed Feb 4, 2025
1 parent 59f92ff commit 0f1343f
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions qBitControl/Components/ChangeCategoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,32 @@ struct ChangeCategoryView: View {
}

if categories.count > 1 {
List {
ForEach(categories, id: \.self) { category in
Button {
if(self.category != category.name) { self.category = category.name }
} label: {
HStack {
Text(category.name)
.foregroundStyle(.foreground)
Spacer()
if(self.category == category.name) {
Image(systemName: "checkmark")
.foregroundColor(.accentColor)
Section(header: Text("Categories")) {
List {
ForEach(categories, id: \.self) { category in
Button {
if(self.category != category.name) { self.category = category.name }
} label: {
HStack {
Text(category.name)
.foregroundStyle(.foreground)
Spacer()
if(self.category == category.name) {
Image(systemName: "checkmark")
.foregroundColor(.accentColor)
}
}
}
}
.onDelete(perform: { offsets in
for index in offsets {
let category = categories[index].name
qBittorrent.removeCategory(category: category, then: {status in print(status)})
}

categories.remove(atOffsets: offsets)
})
}
.onDelete(perform: { offsets in
for index in offsets {
let category = categories[index].name
qBittorrent.removeCategory(category: category, then: {status in print(status)})
}

categories.remove(atOffsets: offsets)
})
}
}
}
Expand Down

0 comments on commit 0f1343f

Please sign in to comment.