feat(core): add collection and tag filters to all pages (#5567)

close TOV-69

Added the `filterMode` parameter to the `/all` route.
Abstracted the `PageList` and associated components into more universal ones.
Added the `useTagMetas` hook to get and update  the workspace tags.

https://github.com/toeverything/AFFiNE/assets/102217452/7595944d-a056-40c2-8d89-d8df9e901a4b
This commit is contained in:
JimmFly
2024-01-26 07:42:47 +00:00
parent b867dcbdeb
commit 18068f4ae2
67 changed files with 3303 additions and 998 deletions

View File

@@ -17,13 +17,11 @@ export function registerAffineNavigationCommands({
store,
workspace,
navigationHelper,
pageListMode,
setPageListMode,
}: {
t: ReturnType<typeof useAFFiNEI18N>;
store: ReturnType<typeof createStore>;
navigationHelper: ReturnType<typeof useNavigateHelper>;
pageListMode: PageModeOption;
setPageListMode: React.Dispatch<React.SetStateAction<PageModeOption>>;
workspace: Workspace;
}) {
@@ -43,32 +41,26 @@ export function registerAffineNavigationCommands({
unsubs.push(
registerAffineCommand({
id: 'affine:goto-page-list',
id: 'affine:goto-collection-list',
category: 'affine:navigation',
icon: <ArrowRightBigIcon />,
preconditionStrategy: () => {
return pageListMode !== 'page';
},
label: t['com.affine.cmdk.affine.navigation.goto-page-list'](),
label: 'Go to Collection List',
run() {
navigationHelper.jumpToSubPath(workspace.id, WorkspaceSubPath.ALL);
setPageListMode('page');
navigationHelper.jumpToCollections(workspace.id);
setPageListMode('all');
},
})
);
unsubs.push(
registerAffineCommand({
id: 'affine:goto-edgeless-list',
id: 'affine:goto-tag-list',
category: 'affine:navigation',
icon: <ArrowRightBigIcon />,
preconditionStrategy: () => {
return pageListMode !== 'edgeless';
},
label: t['com.affine.cmdk.affine.navigation.goto-edgeless-list'](),
label: 'Go to Tag List',
run() {
navigationHelper.jumpToSubPath(workspace.id, WorkspaceSubPath.ALL);
setPageListMode('edgeless');
navigationHelper.jumpToTags(workspace.id);
setPageListMode('all');
},
})
);