Add contextual profile delete
Without confirmation alert though.
This commit is contained in:
parent
35ec73570e
commit
137bacb542
|
@ -91,7 +91,8 @@ extension OrganizerView {
|
|||
} label: {
|
||||
profileLabel(forHeader: header)
|
||||
}.contextMenu {
|
||||
profileMenu(forHeader: header)
|
||||
duplicateButton(forHeader: header)
|
||||
deleteButton(forHeader: header)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,14 +103,23 @@ extension OrganizerView {
|
|||
)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func profileMenu(forHeader header: Profile.Header) -> some View {
|
||||
private func duplicateButton(forHeader header: Profile.Header) -> some View {
|
||||
ProfileView.DuplicateButton(
|
||||
header: header,
|
||||
setAsCurrent: false
|
||||
)
|
||||
}
|
||||
|
||||
private func deleteButton(forHeader header: Profile.Header) -> some View {
|
||||
DestructiveButton {
|
||||
withAnimation {
|
||||
profileManager.removeProfiles(withIds: [header.id])
|
||||
}
|
||||
} label: {
|
||||
Label(L10n.Global.Strings.delete, systemImage: themeDeleteImage)
|
||||
}
|
||||
}
|
||||
|
||||
private var sortedHeaders: [Profile.Header] {
|
||||
profileManager.headers
|
||||
.sorted {
|
||||
|
|
Loading…
Reference in New Issue