Merge branch 'feat/datacenter-dev' of github.com:toeverything/AFFiNE into feat/datacenter-dev

This commit is contained in:
QiShaoXuan
2023-01-11 21:23:56 +08:00
9 changed files with 290 additions and 19 deletions

View File

@@ -0,0 +1,42 @@
import { ReactElement, useState } from 'react';
import { useAppState } from '@/providers/app-state-provider';
import type { NextPageWithLayout } from '../..//_app';
import dynamic from 'next/dynamic';
import { useRouter } from 'next/router';
const DynamicBlocksuite = dynamic(() => import('@/components/editor'), {
ssr: false,
});
const Page: NextPageWithLayout = () => {
const [workspace, setWorkspace] = useState(null);
const [page, setPage] = useState(null);
const { dataCenter } = useAppState();
console.log('dataCenter: ', dataCenter);
const router = useRouter();
console.log(router.query.workspaceId);
dataCenter
.loadPublicWorkspace(router.query.workspaceId as string)
.then(data => {
console.log(data);
});
return (
<>
{workspace && page && (
<DynamicBlocksuite
page={page}
workspace={workspace}
setEditor={() => {
console.log('test');
}}
/>
)}
</>
);
};
Page.getLayout = function getLayout(page: ReactElement) {
return <div>{page}</div>;
};
export default Page;

View File

@@ -0,0 +1,34 @@
import { PageList } from '@/components/page-list';
import { AllPagesIcon } from '@blocksuite/icons';
import { PageListHeader } from '@/components/header';
import { ReactElement } from 'react';
import { useTranslation } from '@affine/i18n';
import { useAppState } from '@/providers/app-state-provider';
import { useRouter } from 'next/router';
const All = () => {
const { pageList } = useAppState();
const { t } = useTranslation();
const { dataCenter } = useAppState();
const router = useRouter();
console.log(router.query.workspaceId);
dataCenter
.loadPublicWorkspace(router.query.workspaceId as string)
.then(data => {
console.log(data);
});
return (
<>
<PageList
pageList={pageList.filter(p => !p.trash)}
showFavoriteTag={true}
/>
</>
);
};
All.getLayout = function getLayout(page: ReactElement) {
return <div>{page}</div>;
};
export default All;