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.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
chore: remove favorite page (#2372)
JimmFly0c561da061b3
diff --git a/apps/web/src/components/blocksuite/block-suite-page-list/index.tsx b/apps/web/src/components/blocksuite/block-suite-page-list/index.tsxindex 1ff0b25917..4e0500fa45 100644--- a/apps/web/src/components/blocksuite/block-suite-page-list/index.tsx+++ b/apps/web/src/components/blocksuite/block-suite-page-list/index.tsx@@ -19,7 +19,7 @@ import { pageListEmptyStyle } from './index.css';export type BlockSuitePageListProps = {blockSuiteWorkspace: BlockSuiteWorkspace;- listType: 'all' | 'trash' | 'favorite' | 'shared' | 'public';+ listType: 'all' | 'trash' | 'shared' | 'public';isPublic?: true;onOpenPage: (pageId: string, newTab?: boolean) => void;};@@ -31,7 +31,6 @@ const filter = {const parentMeta = allMetas.find(m => m.subpageIds?.includes(pageMeta.id));return !parentMeta?.trash && pageMeta.trash;},- favorite: (pageMeta: PageMeta) => pageMeta.favorite && !pageMeta.trash,shared: (pageMeta: PageMeta) => pageMeta.isPublic && !pageMeta.trash,};@@ -52,9 +51,6 @@ const PageListEmpty = (props: {if (listType === 'all') {return t['emptyAllPages']();}- if (listType === 'favorite') {- return t['emptyFavorite']();- }if (listType === 'trash') {return t['emptyTrash']();}diff --git a/apps/web/src/components/pure/quick-search-modal/config.ts b/apps/web/src/components/pure/quick-search-modal/config.tsindex a71969b43b..cca556d661 100644--- a/apps/web/src/components/pure/quick-search-modal/config.ts+++ b/apps/web/src/components/pure/quick-search-modal/config.ts@@ -1,7 +1,6 @@import { useAFFiNEI18N } from '@affine/i18n/hooks';import {DeleteTemporarilyIcon,- FavoriteIcon,FolderIcon,SettingsIcon,} from '@blocksuite/icons';@@ -24,11 +23,6 @@ export const useSwitchToConfig = (href: pathGenerator.all(workspaceId),icon: FolderIcon,},- {- title: t['Favorites'](),- href: pathGenerator.favorite(workspaceId),- icon: FavoriteIcon,- },{title: t['Workspace Settings'](),href: pathGenerator.setting(workspaceId),diff --git a/apps/web/src/components/root-app-sidebar/index.tsx b/apps/web/src/components/root-app-sidebar/index.tsxindex 6ef03d917a..6e99b88fd4 100644--- a/apps/web/src/components/root-app-sidebar/index.tsx+++ b/apps/web/src/components/root-app-sidebar/index.tsx@@ -40,7 +40,6 @@ export type RootAppSidebarProps = {currentPath: string;paths: {all: (workspaceId: string) => string;- favorite: (workspaceId: string) => string;trash: (workspaceId: string) => string;setting: (workspaceId: string) => string;shared: (workspaceId: string) => string;diff --git a/apps/web/src/hooks/__tests__/use-router-helper.spec.ts b/apps/web/src/hooks/__tests__/use-router-helper.spec.tsindex 5f8e5f0acf..b457351dca 100644--- a/apps/web/src/hooks/__tests__/use-router-helper.spec.ts+++ b/apps/web/src/hooks/__tests__/use-router-helper.spec.ts@@ -15,7 +15,6 @@ beforeAll(() => {createDynamicRouteParser(['/workspace/[workspaceId]/[pageId]','/workspace/[workspaceId]/all',- '/workspace/[workspaceId]/favorite','/workspace/[workspaceId]/trash','/workspace/[workspaceId]/setting','/workspace/[workspaceId]/shared',@@ -54,19 +53,6 @@ describe('useRouterHelper', () => {// routerHook.result.current.back()// routerHook.rerender()// expect(routerHook.result.current.pathname).toBe('/')-- await hook.jumpToSubPath(- 'workspace1',- WorkspaceSubPath.FAVORITE,- RouteLogic.REPLACE- );- routerHook.rerender();- expect(routerHook.result.current.pathname).toBe(- '/workspace/[workspaceId]/favorite'- );- expect(routerHook.result.current.asPath).toBe(- '/workspace/workspace1/favorite'- );});test('should jump to the expected page', async () => {diff --git a/apps/web/src/pages/workspace/[workspaceId]/favorite.tsx b/apps/web/src/pages/workspace/[workspaceId]/favorite.tsxdeleted file mode 100644index 2efcf7ae2b..0000000000--- a/apps/web/src/pages/workspace/[workspaceId]/favorite.tsx+++ /dev/null@@ -1,64 +0,0 @@-import { useAFFiNEI18N } from '@affine/i18n/hooks';-import { FavoriteIcon } from '@blocksuite/icons';-import { assertExists } from '@blocksuite/store';-import Head from 'next/head';-import { useRouter } from 'next/router';-import React, { useCallback } from 'react';--import { BlockSuitePageList } from '../../../components/blocksuite/block-suite-page-list';-import { PageLoading } from '../../../components/pure/loading';-import { WorkspaceTitle } from '../../../components/pure/workspace-title';-import { useCurrentWorkspace } from '../../../hooks/current/use-current-workspace';-import { useRouterHelper } from '../../../hooks/use-router-helper';-import { WorkspaceLayout } from '../../../layouts/workspace-layout';-import type { NextPageWithLayout } from '../../../shared';--const FavouritePage: NextPageWithLayout = () => {- const router = useRouter();- const { jumpToPage } = useRouterHelper(router);- const [currentWorkspace] = useCurrentWorkspace();- const t = useAFFiNEI18N();- const onClickPage = useCallback(- (pageId: string, newTab?: boolean) => {- assertExists(currentWorkspace);- if (newTab) {- window.open(`/workspace/${currentWorkspace?.id}/${pageId}`, '_blank');- } else {- jumpToPage(currentWorkspace.id, pageId);- }- },- [currentWorkspace, jumpToPage]- );- if (currentWorkspace === null) {- return <PageLoading />;- }- const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace;- assertExists(blockSuiteWorkspace);- return (- <>- <Head>- <title>{t['Favorites']()} - AFFiNE</title>- </Head>- <WorkspaceTitle- workspace={currentWorkspace}- currentPage={null}- isPreview={false}- isPublic={false}- icon={<FavoriteIcon />}- >- {t['Favorites']()}- </WorkspaceTitle>- <BlockSuitePageList- blockSuiteWorkspace={blockSuiteWorkspace}- onOpenPage={onClickPage}- listType="favorite"- />- </>- );-};--export default FavouritePage;--FavouritePage.getLayout = page => {- return <WorkspaceLayout>{page}</WorkspaceLayout>;-};diff --git a/apps/web/src/shared/index.ts b/apps/web/src/shared/index.tsindex e6b0a8fdb6..4a5c669ae7 100644--- a/apps/web/src/shared/index.ts+++ b/apps/web/src/shared/index.ts@@ -26,7 +26,6 @@ export type NextPageWithLayout<P = Record<string, unknown>, IP = P> = NextPage<export const enum WorkspaceSubPath {ALL = 'all',- FAVORITE = 'favorite',SETTING = 'setting',TRASH = 'trash',SHARED = 'shared',@@ -34,7 +33,6 @@ export const enum WorkspaceSubPath {export const WorkspaceSubPathName = {[WorkspaceSubPath.ALL]: 'All Pages',- [WorkspaceSubPath.FAVORITE]: 'Favorites',[WorkspaceSubPath.SETTING]: 'Settings',[WorkspaceSubPath.TRASH]: 'Trash',[WorkspaceSubPath.SHARED]: 'Shared',@@ -44,7 +42,6 @@ export const WorkspaceSubPathName = {export const pathGenerator = {all: workspaceId => `/workspace/${workspaceId}/all`,- favorite: workspaceId => `/workspace/${workspaceId}/favorite`,trash: workspaceId => `/workspace/${workspaceId}/trash`,setting: workspaceId => `/workspace/${workspaceId}/setting`,shared: workspaceId => `/workspace/${workspaceId}/shared`,@@ -54,7 +51,6 @@ export const pathGenerator = {export const publicPathGenerator = {all: workspaceId => `/public-workspace/${workspaceId}/all`,- favorite: workspaceId => `/public-workspace/${workspaceId}/favorite`,trash: workspaceId => `/public-workspace/${workspaceId}/trash`,setting: workspaceId => `/public-workspace/${workspaceId}/setting`,shared: workspaceId => `/public-workspace/${workspaceId}/shared`,