fix: add publick worksapce

This commit is contained in:
DiamondThree
2023-01-11 20:25:52 +08:00
parent e2a9c6c552
commit ca9f66ce99
3 changed files with 83 additions and 0 deletions
@@ -0,0 +1,34 @@
import { ReactElement, useState } from 'react';
import { useAppState } from '@/providers/app-state-provider';
import type { NextPageWithLayout } from '../..//_app';
import dynamic from 'next/dynamic';
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);
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;
@@ -0,0 +1,25 @@
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';
const All = () => {
const { pageList } = useAppState();
const { t } = useTranslation();
return (
<>
<PageListHeader icon={<AllPagesIcon />}>{t('All pages')}</PageListHeader>
<PageList
pageList={pageList.filter(p => !p.trash)}
showFavoriteTag={true}
/>
</>
);
};
All.getLayout = function getLayout(page: ReactElement) {
return <div>{page}</div>;
};
export default All;