mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 12:06:35 +08:00
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:
@@ -42,6 +42,22 @@ export function useNavigateHelper() {
|
||||
},
|
||||
[navigate]
|
||||
);
|
||||
const jumpToCollections = useCallback(
|
||||
(workspaceId: string, logic: RouteLogic = RouteLogic.PUSH) => {
|
||||
return navigate(`/workspace/${workspaceId}/all?filterMode=collections`, {
|
||||
replace: logic === RouteLogic.REPLACE,
|
||||
});
|
||||
},
|
||||
[navigate]
|
||||
);
|
||||
const jumpToTags = useCallback(
|
||||
(workspaceId: string, logic: RouteLogic = RouteLogic.PUSH) => {
|
||||
return navigate(`/workspace/${workspaceId}/all?filterMode=tags`, {
|
||||
replace: logic === RouteLogic.REPLACE,
|
||||
});
|
||||
},
|
||||
[navigate]
|
||||
);
|
||||
const jumpToCollection = useCallback(
|
||||
(
|
||||
workspaceId: string,
|
||||
@@ -144,6 +160,8 @@ export function useNavigateHelper() {
|
||||
jumpToExpired,
|
||||
jumpToSignIn,
|
||||
jumpToCollection,
|
||||
jumpToCollections,
|
||||
jumpToTags,
|
||||
}),
|
||||
[
|
||||
jumpToPage,
|
||||
@@ -156,6 +174,8 @@ export function useNavigateHelper() {
|
||||
jumpToExpired,
|
||||
jumpToSignIn,
|
||||
jumpToCollection,
|
||||
jumpToCollections,
|
||||
jumpToTags,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { waitForCurrentWorkspaceAtom } from '@affine/core/modules/workspace';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { useAtom, useAtomValue, useStore } from 'jotai';
|
||||
import { useAtomValue, useSetAtom, useStore } from 'jotai';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
@@ -26,7 +26,7 @@ export function useRegisterWorkspaceCommands() {
|
||||
const languageHelper = useLanguageHelper();
|
||||
const pageHelper = usePageHelper(currentWorkspace.blockSuiteWorkspace);
|
||||
const navigationHelper = useNavigateHelper();
|
||||
const [pageListMode, setPageListMode] = useAtom(allPageModeSelectAtom);
|
||||
const setPageListMode = useSetAtom(allPageModeSelectAtom);
|
||||
const [editor] = useActiveBlocksuiteEditor();
|
||||
|
||||
// register AffineUpdatesCommands
|
||||
@@ -48,7 +48,6 @@ export function useRegisterWorkspaceCommands() {
|
||||
t,
|
||||
workspace: currentWorkspace.blockSuiteWorkspace,
|
||||
navigationHelper,
|
||||
pageListMode,
|
||||
setPageListMode,
|
||||
});
|
||||
|
||||
@@ -60,7 +59,6 @@ export function useRegisterWorkspaceCommands() {
|
||||
t,
|
||||
currentWorkspace.blockSuiteWorkspace,
|
||||
navigationHelper,
|
||||
pageListMode,
|
||||
setPageListMode,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user