Skip to content

Commit

Permalink
chore: remove favorite page (#2372)
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmFly authored May 15, 2023
1 parent 0695131 commit 0c561da
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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,
};

Expand All @@ -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']();
}
Expand Down
6 changes: 0 additions & 6 deletions apps/web/src/components/pure/quick-search-modal/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import {
DeleteTemporarilyIcon,
FavoriteIcon,
FolderIcon,
SettingsIcon,
} from '@blocksuite/icons';
Expand All @@ -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),
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/components/root-app-sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 0 additions & 14 deletions apps/web/src/hooks/__tests__/use-router-helper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ beforeAll(() => {
createDynamicRouteParser([
'/workspace/[workspaceId]/[pageId]',
'/workspace/[workspaceId]/all',
'/workspace/[workspaceId]/favorite',
'/workspace/[workspaceId]/trash',
'/workspace/[workspaceId]/setting',
'/workspace/[workspaceId]/shared',
Expand Down Expand Up @@ -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 () => {
Expand Down
64 changes: 0 additions & 64 deletions apps/web/src/pages/workspace/[workspaceId]/favorite.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions apps/web/src/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@ export type NextPageWithLayout<P = Record<string, unknown>, IP = P> = NextPage<

export const enum WorkspaceSubPath {
ALL = 'all',
FAVORITE = 'favorite',
SETTING = 'setting',
TRASH = 'trash',
SHARED = 'shared',
}

export const WorkspaceSubPathName = {
[WorkspaceSubPath.ALL]: 'All Pages',
[WorkspaceSubPath.FAVORITE]: 'Favorites',
[WorkspaceSubPath.SETTING]: 'Settings',
[WorkspaceSubPath.TRASH]: 'Trash',
[WorkspaceSubPath.SHARED]: 'Shared',
Expand All @@ -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`,
Expand All @@ -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`,
Expand Down

1 comment on commit 0c561da

@vercel
Copy link

@vercel vercel bot commented on 0c561da May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

affine-storybook – ./packages/component

affine-storybook-toeverything.vercel.app
affine-storybook-git-master-toeverything.vercel.app
affine-storybook.vercel.app
storybook.affine.pro

Please # to comment.