milestone: publish alpha version (#637)
- document folder - full-text search - blob storage - basic edgeless support Co-authored-by: tzhangchi <terry.zhangchi@outlook.com> Co-authored-by: QiShaoXuan <qishaoxuan777@gmail.com> Co-authored-by: DiamondThree <diamond.shx@gmail.com> Co-authored-by: MingLiang Wang <mingliangwang0o0@gmail.com> Co-authored-by: JimmFly <yangjinfei001@gmail.com> Co-authored-by: Yifeng Wang <doodlewind@toeverything.info> Co-authored-by: Himself65 <himself65@outlook.com> Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com> Co-authored-by: Qi <474021214@qq.com>
This commit is contained in:
296 files changed
+16139
-2072
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useAppState } from '@/providers/app-state-provider/context';
|
||||
import useEnsureWorkspace from '@/hooks/use-ensure-workspace';
|
||||
import { PageLoading } from '@/components/loading';
|
||||
import usePageHelper from '@/hooks/use-page-helper';
|
||||
|
||||
const WorkspaceIndex = () => {
|
||||
const router = useRouter();
|
||||
const { currentWorkspaceId, currentWorkspace } = useAppState();
|
||||
const { createPage } = usePageHelper();
|
||||
const { workspaceLoaded } = useEnsureWorkspace();
|
||||
|
||||
useEffect(() => {
|
||||
const initPage = async () => {
|
||||
if (!workspaceLoaded) {
|
||||
return;
|
||||
}
|
||||
const savedPageId = currentWorkspace?.meta.pageMetas[0]?.id;
|
||||
if (savedPageId) {
|
||||
router.replace(`/workspace/${currentWorkspaceId}/${savedPageId}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const pageId = await createPage();
|
||||
router.replace(`/workspace/${currentWorkspaceId}/${pageId}`);
|
||||
};
|
||||
initPage();
|
||||
}, [
|
||||
currentWorkspace,
|
||||
currentWorkspaceId,
|
||||
createPage,
|
||||
router,
|
||||
workspaceLoaded,
|
||||
]);
|
||||
|
||||
return <PageLoading />;
|
||||
};
|
||||
|
||||
export default WorkspaceIndex;
|
||||
Reference in new issue
Block a user