feat(core): support sidebar page item dnd (#5132)

Added the ability to drag page items from the `all pages` view to the sidebar, including `favourites,` `collection` and `trash`. Page items in `favourites` and `collection` can also be dragged between each other. However, linked subpages cannot be dragged.

Additionally, an operation menu and ‘add’ button have been provided for the sidebar’s page items, enabling the addition of a subpage, renaming, deletion or removal from the sidebar.

On the code front, the `useSidebarDrag` hooks have been implemented for consolidating drag events. The functions `getDragItemId` and `getDropItemId` have been created, and they accept type and ID to obtain itemId.

https://github.com/toeverything/AFFiNE/assets/102217452/d06bac18-3c28-41c9-a7d4-72de955d7b11
This commit is contained in:
JimmFly
2023-12-12 16:04:57 +00:00
parent b782b3fb1b
commit f4a52c031f
34 changed files with 1191 additions and 328 deletions

View File

@@ -541,6 +541,7 @@
"com.affine.collection-bar.action.tooltip.unpin": "Unpin",
"com.affine.collection.addPage.alreadyExists": "Page already exists",
"com.affine.collection.addPage.success": "Added successfully",
"com.affine.collection.removePage.success": "Removed successfully",
"com.affine.collection.addPages": "Add Pages",
"com.affine.collection.addPages.tips": "<0>Add pages:</0> You can freely select pages and add them to the collection.",
"com.affine.collection.addRules": "Add Rules",
@@ -920,6 +921,8 @@
"com.affine.toastMessage.removedFavorites": "Removed from Favourites",
"com.affine.toastMessage.restored": "{{title}} restored",
"com.affine.toastMessage.successfullyDeleted": "Successfully deleted",
"com.affine.toastMessage.rename": "Successfully renamed",
"com.affine.toastMessage.addLinkedPage": "Successfully added linked page",
"com.affine.today": "Today",
"com.affine.trashOperation.delete": "Delete",
"com.affine.trashOperation.delete.description": "Once deleted, you can't undo this action. Do you confirm?",
@@ -1007,5 +1010,6 @@
"com.affine.history.empty-prompt.description": "This document is such a spring chicken, it hasn't sprouted a single historical sprig yet!",
"com.affine.history.confirm-restore-modal.restore": "Restore",
"com.affine.history.confirm-restore-modal.hint": "You are about to restore the current version of the page to the latest version available. This action will overwrite any changes made prior to the latest version.",
"com.affine.share-page.header.present": "Present"
"com.affine.share-page.header.present": "Present",
"com.affine.page-operation.add-linked-page": "Add linked page"
}