Skip to content

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

web: allow archiving when notes drag-n-dropped on nav item Signed-off-by: 01zulfi <[email protected]>

01zulfic295e1c9bee9
diff --git a/apps/web/src/common/drop-handler.ts b/apps/web/src/common/drop-handler.ts
index 89048061f..183c8ab0a 100644
--- a/apps/web/src/common/drop-handler.ts
+++ b/apps/web/src/common/drop-handler.ts
@@ -30,13 +30,18 @@ export async function handleDrop(
item:
| ItemReference
| Context
- | { type: "trash" | "notebooks" | "favorites" | undefined }
+ | { type: "trash" | "notebooks" | "favorites" | "archive" | undefined }
) {
if (!item.type) return;
const noteIds = getDragData(dataTransfer, "note");
const notebookIds = getDragData(dataTransfer, "notebook");
- const { setColor, favorite, delete: trashNotes } = useNoteStore.getState();
+ const {
+ setColor,
+ favorite,
+ delete: trashNotes,
+ archive
+ } = useNoteStore.getState();
switch (item.type) {
case "notebook":
if (noteIds.length > 0) {
@@ -83,5 +88,8 @@ export async function handleDrop(
await useNoteStore.getState().refresh();
}
break;
+ case "archive":
+ archive(true, ...noteIds);
+ break;
}
}
diff --git a/apps/web/src/components/navigation-menu/index.tsx b/apps/web/src/components/navigation-menu/index.tsx
index 6f8c67637..5a7476e6e 100644
--- a/apps/web/src/components/navigation-menu/index.tsx
+++ b/apps/web/src/components/navigation-menu/index.tsx
@@ -506,6 +506,8 @@ function RouteItem({
? "trash"
: item.path === "/favorites"
? "favorites"
+ : item.path == "/archive"
+ ? "archive"
: undefined
});
}}