diff --git a/packages/client/src/components/message/placeholder.tsx b/packages/client/src/components/message/placeholder.tsx new file mode 100644 index 00000000..c74a08f8 --- /dev/null +++ b/packages/client/src/components/message/placeholder.tsx @@ -0,0 +1,16 @@ +import { Skeleton } from '@douyinfe/semi-ui'; + +export const Placeholder = () => { + return ( + + {Array.from({ length: 6 }).fill( + + )} + > + } + loading={true} + > + ); +}; diff --git a/packages/client/src/layouts/router-header/placeholder.tsx b/packages/client/src/layouts/router-header/placeholder.tsx new file mode 100644 index 00000000..0d1b3e3c --- /dev/null +++ b/packages/client/src/layouts/router-header/placeholder.tsx @@ -0,0 +1,16 @@ +import { Skeleton } from '@douyinfe/semi-ui'; + +export const Placeholder = () => { + return ( + + {Array.from({ length: 8 }).fill( + + )} + > + } + loading={true} + > + ); +}; diff --git a/packages/client/src/layouts/router-header/recent.tsx b/packages/client/src/layouts/router-header/recent.tsx new file mode 100644 index 00000000..3495ae44 --- /dev/null +++ b/packages/client/src/layouts/router-header/recent.tsx @@ -0,0 +1,90 @@ +import React from 'react'; +import Link from 'next/link'; +import { Typography, Space, Dropdown, Tabs, TabPane } from '@douyinfe/semi-ui'; +import { IconChevronDown } from '@douyinfe/semi-icons'; +import { useRecentDocuments } from 'data/document'; +import { Empty } from 'components/empty'; +import { DataRender } from 'components/data-render'; +import { LocaleTime } from 'components/locale-time'; +import { DocumentStar } from 'components/document/star'; +import { IconDocumentFill } from 'components/icons/IconDocumentFill'; +import { Placeholder } from './placeholder'; +import styles from './index.module.scss'; + +const { Text } = Typography; + +export const Recent = () => { + const { data: recentDocs, loading, error } = useRecentDocuments(); + + return ( + + + + } + error={error} + normalContent={() => { + return ( + + {recentDocs.length ? ( + recentDocs.map((doc) => { + return ( + + + + + + + + {doc.title} + + + + 创建者: + {doc.createUser && doc.createUser.name} •{' '} + + + + + + + + + + + ); + }) + ) : ( + + )} + + ); + }} + /> + + + + } + > + + + 最近 + + + + + ); +}; diff --git a/packages/client/src/layouts/router-header/wiki.tsx b/packages/client/src/layouts/router-header/wiki.tsx new file mode 100644 index 00000000..44825be7 --- /dev/null +++ b/packages/client/src/layouts/router-header/wiki.tsx @@ -0,0 +1,159 @@ +import React from 'react'; +import { useRouter } from 'next/router'; +import Link from 'next/link'; +import { Avatar, Typography, Space, Dropdown } from '@douyinfe/semi-ui'; +import { IconChevronDown } from '@douyinfe/semi-icons'; +import { useStaredWikis, useWikiDetail } from 'data/wiki'; +import { Empty } from 'components/empty'; +import { DataRender } from 'components/data-render'; +import { WikiStar } from 'components/wiki/star'; +import { Placeholder } from './placeholder'; +import styles from './index.module.scss'; + +const { Text } = Typography; + +export const Wiki = () => { + const { query } = useRouter(); + const { data: starWikis, loading, error, refresh: refreshStarWikis } = useStaredWikis(); + const { data: currentWiki } = useWikiDetail(query.wikiId); + + return ( + + {currentWiki && ( + <> + + + 当前 + + + + + + + + {currentWiki.name.charAt(0)} + + + + {currentWiki.name} + + + + + + + + + + > + )} + + + 已收藏 + + + } + error={error} + normalContent={() => { + return ( + + {starWikis.length ? ( + starWikis.map((wiki) => { + return ( + + + + + + {wiki.name.charAt(0)} + + + + {wiki.name} + + + + + + + + + + ); + }) + ) : ( + + )} + + ); + }} + /> + + + + + 查看所有知识库 + + + + + } + > + + + 知识库 + + + + + ); +};