diff --git a/packages/frontend/core/src/mobile/components/navigation/nodes/collection/index.tsx b/packages/frontend/core/src/mobile/components/navigation/nodes/collection/index.tsx index b15bd6b407..44b5a2d3d0 100644 --- a/packages/frontend/core/src/mobile/components/navigation/nodes/collection/index.tsx +++ b/packages/frontend/core/src/mobile/components/navigation/nodes/collection/index.tsx @@ -4,7 +4,6 @@ import { type Collection, CollectionService, } from '@affine/core/modules/collection'; -import { WorkspaceDialogService } from '@affine/core/modules/dialogs'; import { GlobalContextService } from '@affine/core/modules/global-context'; import { NavigationPanelService } from '@affine/core/modules/navigation-panel'; import { ShareDocsListService } from '@affine/core/modules/share-doc'; @@ -34,12 +33,10 @@ export const NavigationPanelCollectionNode = ({ parentPath: string[]; }) => { const t = useI18n(); - const { globalContextService, collectionService, workspaceDialogService } = - useServices({ - GlobalContextService, - CollectionService, - WorkspaceDialogService, - }); + const { globalContextService, collectionService } = useServices({ + GlobalContextService, + CollectionService, + }); const navigationPanelService = useService(NavigationPanelService); const active = useLiveData(globalContextService.globalContext.collectionId.$) === @@ -63,15 +60,6 @@ export const NavigationPanelCollectionNode = ({ setCollapsed(false); }, [setCollapsed]); - const handleEditCollection = useCallback(() => { - if (!collection) { - return; - } - workspaceDialogService.open('collection-editor', { - collectionId: collection.id, - }); - }, [collection, workspaceDialogService]); - const handleAddDocToCollection = useNavigationPanelCollectionAddDoc( collectionId, handleOpenCollapsed @@ -81,16 +69,10 @@ export const NavigationPanelCollectionNode = ({ ), - [ - additionalOperations, - collectionId, - handleAddDocToCollection, - handleEditCollection, - ] + [additionalOperations, collectionId, handleAddDocToCollection] ); if (!collection) { diff --git a/packages/frontend/core/src/mobile/components/navigation/nodes/collection/operations.tsx b/packages/frontend/core/src/mobile/components/navigation/nodes/collection/operations.tsx index 8d2c3c9ec0..7b522f2a2c 100644 --- a/packages/frontend/core/src/mobile/components/navigation/nodes/collection/operations.tsx +++ b/packages/frontend/core/src/mobile/components/navigation/nodes/collection/operations.tsx @@ -16,7 +16,6 @@ import { useI18n } from '@affine/i18n'; import { track } from '@affine/track'; import { DeleteIcon, - FilterIcon, OpenInNewIcon, PlusIcon, SplitViewIcon, @@ -63,8 +62,7 @@ export const useNavigationPanelCollectionAddDoc = ( export const useNavigationPanelCollectionNodeOperations = ( collectionId: string, - handleAddDocToCollection: () => void, - onOpenEdit: () => void + handleAddDocToCollection: () => void ) => { const t = useI18n(); const { @@ -110,10 +108,6 @@ export const useNavigationPanelCollectionNodeOperations = ( }); }, [collectionId, collectionService]); - const handleShowEdit = useCallback(() => { - onOpenEdit(); - }, [onOpenEdit]); - const handleRename = useCallback( (name: string) => { const collection = collectionService.collection$(collectionId).value; @@ -138,7 +132,6 @@ export const useNavigationPanelCollectionNodeOperations = ( handleDeleteCollection, handleOpenInNewTab, handleOpenInSplitView, - handleShowEdit, handleToggleFavoriteCollection, handleRename, }), @@ -149,7 +142,6 @@ export const useNavigationPanelCollectionNodeOperations = ( handleOpenInNewTab, handleOpenInSplitView, handleRename, - handleShowEdit, handleToggleFavoriteCollection, ] ); @@ -157,8 +149,7 @@ export const useNavigationPanelCollectionNodeOperations = ( export const useNavigationPanelCollectionNodeOperationsMenu = ( collectionId: string, - handleAddDocToCollection: () => void, - onOpenEdit: () => void + handleAddDocToCollection: () => void ): NodeOperation[] => { const t = useI18n(); @@ -168,13 +159,11 @@ export const useNavigationPanelCollectionNodeOperationsMenu = ( handleDeleteCollection, handleOpenInNewTab, handleOpenInSplitView, - handleShowEdit, handleToggleFavoriteCollection, handleRename, } = useNavigationPanelCollectionNodeOperations( collectionId, - handleAddDocToCollection, - onOpenEdit + handleAddDocToCollection ); return useMemo( @@ -202,14 +191,6 @@ export const useNavigationPanelCollectionNodeOperationsMenu = ( index: 11, view: , }, - { - index: 99, - view: ( - } onClick={handleShowEdit}> - {t['com.affine.collection.menu.edit']()} - - ), - }, { index: 99, view: ( @@ -278,7 +259,6 @@ export const useNavigationPanelCollectionNodeOperationsMenu = ( handleOpenInNewTab, handleOpenInSplitView, handleRename, - handleShowEdit, handleToggleFavoriteCollection, t, ] @@ -288,18 +268,15 @@ export const useNavigationPanelCollectionNodeOperationsMenu = ( export const NavigationPanelCollectionNodeMenu = ({ collectionId, handleAddDocToCollection, - onOpenEdit, additionalOperations, }: { collectionId: string; handleAddDocToCollection: () => void; - onOpenEdit: () => void; additionalOperations?: NodeOperation[]; }) => { const operations = useNavigationPanelCollectionNodeOperationsMenu( collectionId, - handleAddDocToCollection, - onOpenEdit + handleAddDocToCollection ); const allOperations = useMemo( () => [...(additionalOperations ?? []), ...operations], diff --git a/packages/frontend/core/src/mobile/components/navigation/virtual-scroller/index.tsx b/packages/frontend/core/src/mobile/components/navigation/virtual-scroller/index.tsx index b8bff42f3e..9195b4e597 100644 --- a/packages/frontend/core/src/mobile/components/navigation/virtual-scroller/index.tsx +++ b/packages/frontend/core/src/mobile/components/navigation/virtual-scroller/index.tsx @@ -2,7 +2,6 @@ import { MenuItem, SafeArea, usePromptModal } from '@affine/component'; import { usePageHelper } from '@affine/core/blocksuite/block-suite-page-list/utils'; import { NavigationPanelTreeRoot } from '@affine/core/desktop/components/navigation-panel'; import { CollectionService } from '@affine/core/modules/collection'; -import { WorkspaceDialogService } from '@affine/core/modules/dialogs'; import { FavoriteService } from '@affine/core/modules/favorite'; import { NavigationPanelService } from '@affine/core/modules/navigation-panel'; import { OrganizeService } from '@affine/core/modules/organize'; @@ -236,28 +235,15 @@ const CollectionRow = ({ entry: MobileShellNavigationEntry; toggle: () => void; }) => { - const { collectionService, workspaceDialogService } = useServices({ - CollectionService, - WorkspaceDialogService, - }); const expand = useCallback(() => { if (!row.expanded) toggle(); }, [row.expanded, toggle]); const handleAdd = useNavigationPanelCollectionAddDoc(entry.id, expand); - const handleEdit = useCallback(() => { - const collection = collectionService.collection$(entry.id).value; - if (collection) { - workspaceDialogService.open('collection-editor', { - collectionId: entry.id, - }); - } - }, [collectionService, entry.id, workspaceDialogService]); const menuTarget = useMemo( () => ( ), - [entry.id, handleAdd, handleEdit, row.relationId] + [entry.id, handleAdd, row.relationId] ); return ( { + const name = 'Test Collection'; + const section = await expandCollapsibleSection(page, 'collections'); + await section.getByTestId('navigation-panel-bar-add-collection-button').tap(); + await page.getByTestId('prompt-modal-input').fill(name); + await page.getByTestId('prompt-modal-confirm').tap(); + await pageBack(page); + + const collection = section.locator( + `[data-role="navigation-panel-collection"][aria-label="${name}"]` + ); + await expect(collection).toBeVisible(); + + const menu = await openNavigationPanelNodeMenu(page, collection); + await expect(menu.getByText('Delete')).toBeVisible(); + await expect(menu.getByText('Edit collection')).toHaveCount(0); +});