Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: trash restore and permanent delete

alihamuh64ccf899bdc7
diff --git a/apps/web/src/common/toasts.js b/apps/web/src/common/toasts.js
index d9c9d5833..5b6d19518 100644
--- a/apps/web/src/common/toasts.js
+++ b/apps/web/src/common/toasts.js
@@ -81,10 +81,20 @@ function showNoteBookDeleted(notebook) {
showToast("success", "Notebook Deleted", actions);
}
+function showTrashItemRestored() {
+ showToast("success", "Item restored");
+}
+
+function showTrashItemPermanentDelete() {
+ showToast("success", "Item permanently deleted");
+}
+
export {
showNotesMovedToast,
showNoteDeleted,
showNoteColored,
showUnpinnedToast,
showNoteBookDeleted,
+ showTrashItemRestored,
+ showTrashItemPermanentDelete,
};
diff --git a/apps/web/src/views/trash.js b/apps/web/src/views/trash.js
index 9856673df..86ccf0c25 100644
--- a/apps/web/src/views/trash.js
+++ b/apps/web/src/views/trash.js
@@ -9,12 +9,19 @@ import { useStore, store } from "../stores/trash-store";
import { toTitleCase } from "../utils/string";
import TrashPlaceholder from "../components/placeholders/trash-placeholder";
import { showToast } from "../utils/toast";
+import {
+ showTrashItemPermanentDelete,
+ showTrashItemRestored,
+} from "../common/toasts";
function menuItems(item, index) {
return [
{
title: "Restore",
- onClick: () => store.restore(item.id, index),
+ onClick: () => {
+ store.restore(item.id, index);
+ showTrashItemRestored();
+ },
},
{
title: "Delete",
@@ -26,7 +33,9 @@ function menuItems(item, index) {
`Are you sure you want to permanently delete this item?`
).then(async (res) => {
if (res) {
- await store.delete(item.id, index);
+ await store
+ .delete(item.id, index)
+ .then(showTrashItemPermanentDelete());
}
});
},