add ability to delete an entry aka mark it missing

make entire row tappable instead of just content

closed #46
This commit is contained in:
Trey t
2022-01-29 12:17:35 -06:00
parent 01fcf70d45
commit 27e2bf2a40
3 changed files with 14 additions and 7 deletions

View File

@@ -63,6 +63,16 @@ struct ContentView: View {
showUpdateEntryAlert = false
})
}
if deleteEnabled {
Button(String(localized: "content_view_delete_entry"), action: {
if let selectedMissingEntry = selectedEntry {
viewModel.update(entry: selectedMissingEntry, toMood: Mood.missing)
}
showUpdateEntryAlert = false
})
}
Button(String(localized: "content_view_fill_in_missing_entry_cancel"), role: .cancel, action: {
selectedEntry = nil
showUpdateEntryAlert = false
@@ -190,18 +200,12 @@ struct ContentView: View {
return $0.forDate! > $1.forDate!
}), id: \.self) { entry in
entryListView(entry: entry)
.contentShape(Rectangle())
.onTapGesture(perform: {
selectedEntry = entry
showUpdateEntryAlert = true
})
}
// if deleteEnabled {
// .onDelete(perform: { offsets in
// withAnimation {
// viewModel.delete(offsets: offsets, inMonth: month, inYear: year)
// }
// })
// }
}
}

View File

@@ -42,6 +42,8 @@ struct SettingsView: View {
if useCloudKit {
cloudKitStatus
}
canDelete
}
Spacer()
}