refactor!: next generation AFFiNE code structure (#1176)

This commit is contained in:
Himself65
2023-03-01 01:40:01 -06:00
committed by GitHub
parent 2dcccc772c
commit e0481d29ad
270 changed files with 8308 additions and 6829 deletions
+26
View File
@@ -0,0 +1,26 @@
import { NextRouter } from 'next/router';
import { useMemo } from 'react';
import { WorkspaceSubPathName } from '../shared';
export function useRouterTitle(router: NextRouter) {
return useMemo(() => {
if (!router.isReady) {
return 'Loading...';
} else {
if (
!router.query.pageId &&
router.pathname.startsWith('/workspace/[workspaceId]/')
) {
const subPath = router.pathname.split('/').at(-1);
if (subPath && subPath in WorkspaceSubPathName) {
return (
WorkspaceSubPathName[subPath as keyof typeof WorkspaceSubPathName] +
' - AFFiNE'
);
}
}
return 'AFFiNE';
}
}, [router]);
}