Add contextual profile delete

Without confirmation alert though.
This commit is contained in:
Davide De Rosa 2022-05-15 22:22:19 +02:00
parent 35ec73570e
commit 137bacb542
1 changed files with 13 additions and 3 deletions

View File

@ -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 {