Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

chore: hide pinboard (#2149)

Whitewater2b05a1254b5e
diff --git a/apps/web/src/components/affine/operation-menu-items/MoveTo.tsx b/apps/web/src/components/affine/operation-menu-items/MoveTo.tsx
index c088c4aa4e..5e71c070f1 100644
--- a/apps/web/src/components/affine/operation-menu-items/MoveTo.tsx
+++ b/apps/web/src/components/affine/operation-menu-items/MoveTo.tsx
@@ -17,6 +17,9 @@ export type MoveToProps = CommonMenuItemProps<{
blockSuiteWorkspace: BlockSuiteWorkspace;
};
+/**
+ * @deprecated
+ */
export const MoveTo = ({
metas,
currentMeta,
diff --git a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx
index 818671d5fc..4946587160 100644
--- a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx
+++ b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/OperationCell.tsx
@@ -24,7 +24,6 @@ import type { BlockSuiteWorkspace } from '../../../../shared';
import { toast } from '../../../../utils';
import {
DisablePublicSharing,
- MoveTo,
MoveToTrash,
} from '../../../affine/operation-menu-items';
@@ -84,13 +83,6 @@ export const OperationCell: React.FC<OperationCellProps> = ({
{t('Open in new tab')}
</MenuItem>
)}
- {!pageMeta.isRootPinboard && (
- <MoveTo
- metas={metas}
- currentMeta={pageMeta}
- blockSuiteWorkspace={blockSuiteWorkspace}
- />
- )}
{!pageMeta.isRootPinboard && (
<MoveToTrash
testId="move-to-trash"
diff --git a/apps/web/src/components/blocksuite/workspace-header/header-right-items/EditorOptionMenu.tsx b/apps/web/src/components/blocksuite/workspace-header/header-right-items/EditorOptionMenu.tsx
index 8261ff1266..a3733aed04 100644
--- a/apps/web/src/components/blocksuite/workspace-header/header-right-items/EditorOptionMenu.tsx
+++ b/apps/web/src/components/blocksuite/workspace-header/header-right-items/EditorOptionMenu.tsx
@@ -21,11 +21,7 @@ import { useBlockSuiteMetaHelper } from '../../../../hooks/affine/use-block-suit
import { useCurrentPageId } from '../../../../hooks/current/use-current-page-id';
import { useCurrentWorkspace } from '../../../../hooks/current/use-current-workspace';
import { toast } from '../../../../utils';
-import {
- Export,
- MoveTo,
- MoveToTrash,
-} from '../../../affine/operation-menu-items';
+import { Export, MoveToTrash } from '../../../affine/operation-menu-items';
export const EditorOptionMenu = () => {
const { t } = useTranslation();
@@ -39,7 +35,6 @@ export const EditorOptionMenu = () => {
const pageMeta = useBlockSuitePageMeta(blockSuiteWorkspace).find(
meta => meta.id === pageId
);
- const allMetas = useBlockSuitePageMeta(blockSuiteWorkspace);
const [record, set] = useAtom(workspacePreferredModeAtom);
const mode = record[pageId] ?? 'page';
assertExists(pageMeta);
@@ -81,13 +76,6 @@ export const EditorOptionMenu = () => {
{mode === 'page' ? t('Edgeless') : t('Page')}
</MenuItem>
<Export />
- {!pageMeta.isRootPinboard && (
- <MoveTo
- metas={allMetas}
- currentMeta={pageMeta}
- blockSuiteWorkspace={blockSuiteWorkspace}
- />
- )}
{!pageMeta.isRootPinboard && (
<MoveToTrash
testId="editor-option-menu-delete"
diff --git a/apps/web/src/components/pure/workspace-slider-bar/Pinboard.tsx b/apps/web/src/components/pure/workspace-slider-bar/Pinboard.tsx
index 4c370804bf..43fc8ae967 100644
--- a/apps/web/src/components/pure/workspace-slider-bar/Pinboard.tsx
+++ b/apps/web/src/components/pure/workspace-slider-bar/Pinboard.tsx
@@ -14,6 +14,9 @@ export type PinboardProps = {
openPage: (pageId: string) => void;
};
+/**
+ * @deprecated
+ */
export const Pinboard = ({ blockSuiteWorkspace, openPage }: PinboardProps) => {
const allMetas = useBlockSuitePageMeta(blockSuiteWorkspace);
const handlePinboardClick = useCallback(
diff --git a/apps/web/src/components/pure/workspace-slider-bar/index.tsx b/apps/web/src/components/pure/workspace-slider-bar/index.tsx
index 300b3ceb98..4c8d04eb4f 100644
--- a/apps/web/src/components/pure/workspace-slider-bar/index.tsx
+++ b/apps/web/src/components/pure/workspace-slider-bar/index.tsx
@@ -23,7 +23,6 @@ import {
import type { AllWorkspace } from '../../../shared';
import { ChangeLog } from './changeLog';
import Favorite from './favorite';
-import { Pinboard } from './Pinboard';
import { RouteNavigation } from './RouteNavigation';
import { StyledListItem } from './shared-styles';
import {
@@ -200,12 +199,6 @@ export const WorkSpaceSliderBar: React.FC<WorkSpaceSliderBarProps> = ({
currentWorkspace={currentWorkspace}
/>
)}
- {blockSuiteWorkspace && (
- <Pinboard
- blockSuiteWorkspace={blockSuiteWorkspace}
- openPage={openPage}
- />
- )}
</StyledScrollWrapper>
<div style={{ height: 16 }}></div>
{config.enableLegacyCloud &&
diff --git a/tests/libs/page-logic.ts b/tests/libs/page-logic.ts
index c215af28b0..c9dc75e74b 100644
--- a/tests/libs/page-logic.ts
+++ b/tests/libs/page-logic.ts
@@ -23,6 +23,9 @@ export async function clickPageMoreActions(page: Page) {
.click();
}
+/**
+ * @deprecated
+ */
export async function createPinboardPage(
page: Page,
parentId: string,
diff --git a/tests/parallels/pin-board.spec.ts b/tests/parallels/pin-board.spec.ts
deleted file mode 100644
index 2f82399e1d..0000000000
--- a/tests/parallels/pin-board.spec.ts
+++ /dev/null
@@ -1,248 +0,0 @@
-import { test } from '@affine-test/kit/playwright';
-import type { Page } from '@playwright/test';
-import { expect } from '@playwright/test';
-
-import { initHomePageWithPinboard } from '../libs/load-page';
-import { createPinboardPage } from '../libs/page-logic';
-import { getMetas } from '../libs/utils';
-
-async function openPinboardPageOperationMenu(page: Page, id: string) {
- const node = await page
- .getByTestId('sidebar-pinboard-container')
- .getByTestId(`pinboard-${id}`);
- await node.hover();
- await node.getByTestId('pinboard-operation-button').click();
-}
-
-async function checkIsChildInsertToParentInEditor(page: Page, pageId: string) {
- await page
- .getByTestId('sidebar-pinboard-container')
- .getByTestId(`pinboard-${pageId}`)
- .click();
- await page.waitForTimeout(200);
- const referenceLink = await page.locator('.affine-reference');
- expect(referenceLink).not.toBeNull();
-}
-
-test('Have initial root pinboard page when first in', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- expect(rootPinboardMeta).not.toBeUndefined();
-});
-
-test('Root pinboard page have no operation of "trash" ,"rename" and "move to"', async ({
- page,
-}) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await openPinboardPageOperationMenu(page, rootPinboardMeta?.id ?? '');
- expect(
- await page
- .locator(`[data-testid="pinboard-operation-move-to-trash"]`)
- .count()
- ).toEqual(0);
- expect(
- await page.locator(`[data-testid="pinboard-operation-rename"]`).count()
- ).toEqual(0);
- expect(
- await page.locator(`[data-testid="pinboard-operation-move-to"]`).count()
- ).toEqual(0);
-});
-
-test('Click Pinboard in sidebar should open root pinboard page', async ({
- page,
-}) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await page.getByTestId(`pinboard-${rootPinboardMeta?.id}`).click();
- await page.waitForTimeout(200);
- expect(await page.locator('affine-editor-container')).not.toBeNull();
-});
-
-test('Add pinboard by header operation menu', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');
- const meta = (await getMetas(page)).find(m => m.title === 'test1');
- expect(meta).not.toBeUndefined();
- expect(
- await page
- .getByTestId('[data-testid="sidebar-pinboard-container"]')
- .getByTestId(`pinboard-${meta?.id}`)
- ).not.toBeNull();
- await checkIsChildInsertToParentInEditor(page, rootPinboardMeta?.id ?? '');
-});
-
-test('Add pinboard by sidebar operation menu', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
-
- await openPinboardPageOperationMenu(page, rootPinboardMeta?.id ?? '');
- await page.getByTestId('pinboard-operation-add').click();
- const newPageMeta = (await getMetas(page)).find(
- m => m.id !== rootPinboardMeta?.id
- );
- expect(
- await page
- .getByTestId('sidebar-pinboard-container')
- .getByTestId(`pinboard-${newPageMeta?.id}`)
- ).not.toBeNull();
- await checkIsChildInsertToParentInEditor(page, rootPinboardMeta?.id ?? '');
-});
-
-test('Move pinboard to another in sidebar', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test2');
- const childMeta = (await getMetas(page)).find(m => m.title === 'test1');
- const childMeta2 = (await getMetas(page)).find(m => m.title === 'test2');
- await openPinboardPageOperationMenu(page, childMeta?.id ?? '');
- await page.getByTestId('pinboard-operation-move-to').click();
- await page
- .getByTestId('pinboard-menu')
- .getByTestId(`pinboard-${childMeta2?.id}`)
- .click();
- expect(
- (await getMetas(page)).find(m => m.title === 'test2')?.subpageIds.length
- ).toBe(1);
-});
-
-test('Should no show pinboard self in move to menu', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test2');
- const childMeta = (await getMetas(page)).find(m => m.title === 'test1');
-
- await page.getByTestId('all-pages').click();
- await page
- .getByTestId(`page-list-item-${childMeta?.id}`)
- .getByTestId('page-list-operation-button')
- .click();
- await page.getByTestId('move-to-menu-item').click();
-
- expect(
- await page
- .getByTestId('pinboard-menu')
- .locator(`[data-testid="pinboard-${childMeta?.id}"]`)
- .count()
- ).toEqual(0);
-});
-test('Move pinboard to another in page list', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test2');
- const childMeta = (await getMetas(page)).find(m => m.title === 'test1');
- const childMeta2 = (await getMetas(page)).find(m => m.title === 'test2');
-
- await page.getByTestId('all-pages').click();
- await page
- .getByTestId(`page-list-item-${childMeta?.id}`)
- .getByTestId('page-list-operation-button')
- .click();
- await page.getByTestId('move-to-menu-item').click();
- await page
- .getByTestId('pinboard-menu')
- .getByTestId(`pinboard-${childMeta2?.id}`)
- .click();
- expect(
- (await getMetas(page)).find(m => m.title === 'test2')?.subpageIds.length
- ).toBe(1);
-});
-
-test('Remove from pinboard', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');
- const childMeta = (await getMetas(page)).find(m => m.title === 'test1');
-
- await openPinboardPageOperationMenu(page, childMeta?.id ?? '');
-
- await page.getByTestId('pinboard-operation-move-to').click();
- await page.getByTestId('remove-from-pinboard-button').click();
- await page.waitForTimeout(1000);
- expect(
- await page.locator(`[data-testid="pinboard-${childMeta?.id}"]`).count()
- ).toEqual(0);
-});
-
-test('search pinboard', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test2');
- const childMeta = (await getMetas(page)).find(m => m.title === 'test1');
-
- await openPinboardPageOperationMenu(page, childMeta?.id ?? '');
-
- await page.getByTestId('pinboard-operation-move-to').click();
-
- await page.fill('[data-testid="pinboard-menu-search"]', '111');
- expect(await page.locator('[alt="no result"]').count()).toEqual(1);
-
- await page.fill('[data-testid="pinboard-menu-search"]', 'test2');
- expect(
- await page.locator('[data-testid="pinboard-search-result"]').count()
- ).toEqual(1);
-});
-
-test('Rename pinboard', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');
- const childMeta = (await getMetas(page)).find(m => m.title === 'test1');
-
- await openPinboardPageOperationMenu(page, childMeta?.id ?? '');
-
- await page.getByTestId('pinboard-operation-rename').click();
- await page.fill(`[data-testid="pinboard-input-${childMeta?.id}"]`, 'test2');
-
- const title = (await page
- .locator('.affine-default-page-block-title')
- .textContent()) as string;
-
- expect(title).toEqual('test2');
-});
-
-test('Move pinboard to trash', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');
- const childMeta = (await getMetas(page)).find(m => m.title === 'test1');
- await createPinboardPage(page, childMeta?.id ?? '', 'test2');
- const grandChildMeta = (await getMetas(page)).find(m => m.title === 'test2');
-
- await openPinboardPageOperationMenu(page, childMeta?.id ?? '');
-
- await page.getByTestId('pinboard-operation-move-to-trash').click();
- (await page.waitForSelector('[data-testid="move-to-trash-confirm"]')).click();
- await page.waitForTimeout(1000);
-
- expect(
- await page
- .getByTestId('sidebar-pinboard-container')
- .locator(`[data-testid="pinboard-${childMeta?.id}"]`)
- .count()
- ).toEqual(0);
-
- expect(
- await page
- .getByTestId('sidebar-pinboard-container')
- .locator(`[data-testid="pinboard-${grandChildMeta?.id}"]`)
- .count()
- ).toEqual(0);
-});
-
-// FIXME
-test.skip('Copy link', async ({ page }) => {
- const rootPinboardMeta = await initHomePageWithPinboard(page);
- await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');
- const childMeta = (await getMetas(page)).find(m => m.title === 'test1');
-
- await openPinboardPageOperationMenu(page, childMeta?.id ?? '');
-
- await page.getByTestId('copy-link').click();
-
- await page.evaluate(() => {
- const input = document.createElement('input');
- input.id = 'paste-input';
- document.body.appendChild(input);
- input.focus();
- });
- await page.keyboard.press(`Meta+v`, { delay: 50 });
- await page.keyboard.press(`Control+v`, { delay: 50 });
- const copiedValue = await page
- .locator('#paste-input')
- .evaluate((input: HTMLInputElement) => input.value);
- expect(copiedValue).toEqual(page.url());
-});
diff --git a/tests/parallels/quick-search.spec.ts b/tests/parallels/quick-search.spec.ts
index 60aef23f5c..35274b71e0 100644
--- a/tests/parallels/quick-search.spec.ts
+++ b/tests/parallels/quick-search.spec.ts
@@ -204,7 +204,7 @@ test('After appearing once, it will not appear a second time', async ({
await expect(quickSearchTips).not.toBeVisible();
});
-test('Show navigation path if page is a subpage', async ({ page }) => {
+test.skip('Show navigation path if page is a subpage', async ({ page }) => {
const rootPinboardMeta = await initHomePageWithPinboard(page);
await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');
await openQuickSearchByShortcut(page);
@@ -218,7 +218,7 @@ test('Not show navigation path if page is not a subpage or current page is not i
await openQuickSearchByShortcut(page);
expect(await page.getByTestId('navigation-path').count()).toBe(0);
});
-test('Navigation path item click will jump to page, but not current active item', async ({
+test.skip('Navigation path item click will jump to page, but not current active item', async ({
page,
}) => {
const rootPinboardMeta = await initHomePageWithPinboard(page);
@@ -233,7 +233,7 @@ test('Navigation path item click will jump to page, but not current active item'
await page.locator('[data-testid="navigation-path-link"]').nth(0).click();
expect(page.url()).not.toBe(oldUrl);
});
-test('Navigation path expand', async ({ page }) => {
+test.skip('Navigation path expand', async ({ page }) => {
//
const rootPinboardMeta = await initHomePageWithPinboard(page);
await createPinboardPage(page, rootPinboardMeta?.id ?? '', 'test1');