dont show delete option if the item is missing

This commit is contained in:
Trey t
2022-02-02 10:12:58 -06:00
parent e6974e5f37
commit a5824ba71a

View File

@@ -63,18 +63,18 @@ struct ContentView: View {
}).alert(String(localized: "content_view_fill_in_missing_entry"), isPresented: $showUpdateEntryAlert) {
ForEach(Mood.allValues) { mood in
Button(mood.strValue, action: {
if let selectedMissingEntry = selectedEntry {
viewModel.update(entry: selectedMissingEntry, toMood: mood)
if let selectedEntry = selectedEntry {
viewModel.update(entry: selectedEntry, toMood: mood)
}
showUpdateEntryAlert = false
})
}
if deleteEnabled {
if let selectedEntry = selectedEntry,
deleteEnabled,
selectedEntry.mood != .missing {
Button(String(localized: "content_view_delete_entry"), action: {
if let selectedMissingEntry = selectedEntry {
viewModel.update(entry: selectedMissingEntry, toMood: Mood.missing)
}
viewModel.update(entry: selectedEntry, toMood: Mood.missing)
showUpdateEntryAlert = false
})
}