PWD-3: add context menu to delete passwords (#6)
This commit is contained in:
commit
593f4fbd93
1 changed files with 10 additions and 0 deletions
|
@ -62,6 +62,16 @@ struct ListView: View {
|
||||||
.background(selectedItem == password.id ? .blue : .clear)
|
.background(selectedItem == password.id ? .blue : .clear)
|
||||||
.foregroundColor(selectedItem == password.id ? .white : (colorScheme == .dark ? .white : .black))
|
.foregroundColor(selectedItem == password.id ? .white : (colorScheme == .dark ? .white : .black))
|
||||||
.cornerRadius(8)
|
.cornerRadius(8)
|
||||||
|
.contextMenu {
|
||||||
|
Button {
|
||||||
|
selectedItem = nil
|
||||||
|
viewModel.deletePassword(password)
|
||||||
|
viewModel.passwords = viewModel.getAllPasswords()
|
||||||
|
} label: {
|
||||||
|
Label("Delete", systemImage: "trash")
|
||||||
|
}
|
||||||
|
.keyboardShortcut(.delete)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if isUpdateTextVisible {
|
if isUpdateTextVisible {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue