mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 02:42:25 +08:00
feat: add list skeleton in public workspace (#1278)
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
|
import { ListSkeleton } from '@affine/component';
|
||||||
import { useAtomValue, useSetAtom } from 'jotai';
|
import { useAtomValue, useSetAtom } from 'jotai';
|
||||||
|
import dynamic from 'next/dynamic';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import React, { Suspense, useCallback, useEffect } from 'react';
|
import React, { Suspense, useCallback, useEffect } from 'react';
|
||||||
|
|
||||||
@@ -8,11 +10,17 @@ import {
|
|||||||
publicWorkspaceIdAtom,
|
publicWorkspaceIdAtom,
|
||||||
} from '../../atoms/public-workspace';
|
} from '../../atoms/public-workspace';
|
||||||
import { QueryParamError } from '../../components/affine/affine-error-eoundary';
|
import { QueryParamError } from '../../components/affine/affine-error-eoundary';
|
||||||
import { BlockSuitePublicPageList } from '../../components/blocksuite/block-suite-page-list';
|
import { StyledTableContainer } from '../../components/blocksuite/block-suite-page-list/page-list/styles';
|
||||||
import { PageLoading } from '../../components/pure/loading';
|
import { PageLoading } from '../../components/pure/loading';
|
||||||
import { WorkspaceLayout } from '../../layouts';
|
import { WorkspaceLayout } from '../../layouts';
|
||||||
import { NextPageWithLayout } from '../../shared';
|
import { NextPageWithLayout } from '../../shared';
|
||||||
|
|
||||||
|
const BlockSuitePublicPageList = dynamic(
|
||||||
|
async () =>
|
||||||
|
(await import('../../components/blocksuite/block-suite-page-list'))
|
||||||
|
.BlockSuitePublicPageList
|
||||||
|
);
|
||||||
|
|
||||||
const ListPageInner: React.FC<{
|
const ListPageInner: React.FC<{
|
||||||
workspaceId: string;
|
workspaceId: string;
|
||||||
}> = ({ workspaceId }) => {
|
}> = ({ workspaceId }) => {
|
||||||
@@ -64,7 +72,13 @@ const ListPage: NextPageWithLayout = () => {
|
|||||||
throw new QueryParamError('workspaceId', workspaceId);
|
throw new QueryParamError('workspaceId', workspaceId);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<PageLoading />}>
|
<Suspense
|
||||||
|
fallback={
|
||||||
|
<StyledTableContainer>
|
||||||
|
<ListSkeleton />
|
||||||
|
</StyledTableContainer>
|
||||||
|
}
|
||||||
|
>
|
||||||
<ListPageInner workspaceId={workspaceId} />
|
<ListPageInner workspaceId={workspaceId} />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
|
|||||||
13
packages/component/src/components/ListSkeleton.tsx
Normal file
13
packages/component/src/components/ListSkeleton.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { Skeleton } from '@mui/material';
|
||||||
|
import { memo } from 'react';
|
||||||
|
|
||||||
|
export const ListSkeleton = memo(function ListItemSkeleton() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Skeleton animation="wave" height={40} />
|
||||||
|
<Skeleton animation="wave" height={40} />
|
||||||
|
<Skeleton animation="wave" height={40} />
|
||||||
|
<Skeleton animation="wave" height={40} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// export * from './components/BlockSuiteEditor';
|
// export * from './components/BlockSuiteEditor';
|
||||||
|
export * from './components/ListSkeleton';
|
||||||
export * from './styles';
|
export * from './styles';
|
||||||
export * from './ui/breadcrumbs';
|
export * from './ui/breadcrumbs';
|
||||||
export * from './ui/button';
|
export * from './ui/button';
|
||||||
|
|||||||
Reference in New Issue
Block a user