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:
@@ -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)
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ struct SettingsView: View {
|
||||
if useCloudKit {
|
||||
cloudKitStatus
|
||||
}
|
||||
|
||||
canDelete
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
"content_view_tab_stats" = "Stats";
|
||||
"content_view_fill_in_missing_entry" = "Fill in missing entry";
|
||||
"content_view_fill_in_missing_entry_cancel" = "Cancel";
|
||||
"content_view_delete_entry" = "Delete this entry";
|
||||
"content_view_header_title" = "Past %d days";
|
||||
"content_view_empty_title" = "You aint done shit";
|
||||
"content_view_empty_body" = "Fucking vote or something?!?!? How the fuck was yesterday?";
|
||||
|
||||
Reference in New Issue
Block a user