Skip to content

Commit a5f2d39

Browse files
authored
Merge pull request #8977 from streetwriters/web/archive-drag-drop
web: allow archiving when notes drag-n-dropped on nav item
2 parents e5395bf + c295e1c commit a5f2d39

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

apps/web/src/common/drop-handler.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ export async function handleDrop(
3030
item:
3131
| ItemReference
3232
| Context
33-
| { type: "trash" | "notebooks" | "favorites" | undefined }
33+
| { type: "trash" | "notebooks" | "favorites" | "archive" | undefined }
3434
) {
3535
if (!item.type) return;
3636

3737
const noteIds = getDragData(dataTransfer, "note");
3838
const notebookIds = getDragData(dataTransfer, "notebook");
39-
const { setColor, favorite, delete: trashNotes } = useNoteStore.getState();
39+
const {
40+
setColor,
41+
favorite,
42+
delete: trashNotes,
43+
archive
44+
} = useNoteStore.getState();
4045
switch (item.type) {
4146
case "notebook":
4247
if (noteIds.length > 0) {
@@ -83,5 +88,8 @@ export async function handleDrop(
8388
await useNoteStore.getState().refresh();
8489
}
8590
break;
91+
case "archive":
92+
archive(true, ...noteIds);
93+
break;
8694
}
8795
}

apps/web/src/components/navigation-menu/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ function RouteItem({
506506
? "trash"
507507
: item.path === "/favorites"
508508
? "favorites"
509+
: item.path == "/archive"
510+
? "archive"
509511
: undefined
510512
});
511513
}}

0 commit comments

Comments
 (0)