Skip to content

Commit

Permalink
Add 'add category' button
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-128 committed Feb 4, 2025
1 parent 377a36a commit baf9235
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Localization/Localizations/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@
}
}
}
},
"Add Category" : {

},
"Add Feed" : {
"localizations" : {
Expand Down Expand Up @@ -640,6 +643,9 @@
}
}
}
},
"Add New Category" : {

},
"Add Server" : {
"localizations" : {
Expand Down Expand Up @@ -1222,6 +1228,9 @@
}
}
}
},
"Category Name" : {

},
"Check Connection" : {
"localizations" : {
Expand Down
22 changes: 21 additions & 1 deletion qBitControl/Components/ChangeCategoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,31 @@ struct ChangeCategoryView: View {
@State private var categories: [Category] = []

@State var category: String


@State private var showAddCategoryAlert = false
@State private var newCategoryName = ""

var body: some View {
VStack {
Form {
Section(header: Text("Add Category")) {
Button {
showAddCategoryAlert = true
} label: {
Label("Add Category", systemImage: "plus.circle")
}.alert("Add New Category", isPresented: $showAddCategoryAlert, actions: {
TextField("Category Name", text: $newCategoryName)
Button("Add", action: {
// Add category
print(newCategoryName)
newCategoryName = ""
})
Button("Cancel", role: .cancel, action: {
newCategoryName = ""
})
})
}

if categories.count > 1 {
Picker("Categories", selection: $category) {
Text("Uncategorized").tag("")
Expand Down

0 comments on commit baf9235

Please sign in to comment.