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