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) { }).alert(String(localized: "content_view_fill_in_missing_entry"), isPresented: $showUpdateEntryAlert) {
ForEach(Mood.allValues) { mood in ForEach(Mood.allValues) { mood in
Button(mood.strValue, action: { Button(mood.strValue, action: {
if let selectedMissingEntry = selectedEntry { if let selectedEntry = selectedEntry {
viewModel.update(entry: selectedMissingEntry, toMood: mood) viewModel.update(entry: selectedEntry, toMood: mood)
} }
showUpdateEntryAlert = false showUpdateEntryAlert = false
}) })
} }
if deleteEnabled { if let selectedEntry = selectedEntry,
deleteEnabled,
selectedEntry.mood != .missing {
Button(String(localized: "content_view_delete_entry"), action: { Button(String(localized: "content_view_delete_entry"), action: {
if let selectedMissingEntry = selectedEntry { viewModel.update(entry: selectedEntry, toMood: Mood.missing)
viewModel.update(entry: selectedMissingEntry, toMood: Mood.missing)
}
showUpdateEntryAlert = false showUpdateEntryAlert = false
}) })
} }