feat(client): add welcome card (#1606)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1606
This commit is contained in:
sealday 2024-10-16 02:53:42 +08:00
parent e679b0b32e
commit ee7f011b31
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,47 @@
import React from 'react';
import { css } from '@emotion/css';
import { Button, Card, Flex, Space, Typography } from 'antd';
import { Outlet, useMatch, useParams } from 'react-router';
import { PageTab } from '../page-style/PageTab';
import { usePageStyle } from '../page-style/usePageStyle';
const WelcomeCard = () => {
return (
<Card
className={css`
max-width: 800px;
margin: 24px auto;
`}
>
<Typography.Title></Typography.Title>
<Typography.Text>
</Typography.Text>
<Flex
justify="flex-end"
className={css`
margin-top: 48px;
`}
>
<Space>
<Button>使</Button>
<Button type="primary"></Button>
</Space>
</Flex>
</Card>
);
};
export const AdminContent = () => {
const isMatchAdmin = useMatch('/admin');
const params = useParams<any>();
const pageStyle = usePageStyle();
if (isMatchAdmin) {
return <WelcomeCard />;
} else {
return params.name && pageStyle === 'tab' ? <PageTab /> : <Outlet />;
}
};

View File

@ -28,6 +28,7 @@ import { Plugin } from '../../application/Plugin';
import { VariablesProvider } from '../../variables'; import { VariablesProvider } from '../../variables';
import { PageTab } from '../page-style/PageTab'; import { PageTab } from '../page-style/PageTab';
import { usePageStyle } from '../page-style/usePageStyle'; import { usePageStyle } from '../page-style/usePageStyle';
import { AdminContent } from './AdminContent';
import { NoticeArea } from './NoticeArea'; import { NoticeArea } from './NoticeArea';
const useStyles = createStyles(({ css, token }) => { const useStyles = createStyles(({ css, token }) => {
@ -450,7 +451,9 @@ export const InternalAdminLayout = (props: any) => {
{params.name && <Layout.Sider className={styles.sider} theme={'light'} ref={sideMenuRef}></Layout.Sider>} {params.name && <Layout.Sider className={styles.sider} theme={'light'} ref={sideMenuRef}></Layout.Sider>}
<Layout.Content className={styles.main}> <Layout.Content className={styles.main}>
<header className={styles.mainHeader}></header> <header className={styles.mainHeader}></header>
<div className="amplifier-block">{params.name && pageStyle === 'tab' ? <PageTab /> : <Outlet />}</div> <div className="amplifier-block">
<AdminContent />
</div>
</Layout.Content> </Layout.Content>
</Layout> </Layout>
); );