Skip to content

Commit d607d55

Browse files
committed
个人空间页模板
1 parent 87ab494 commit d607d55

File tree

6 files changed

+98
-8
lines changed

6 files changed

+98
-8
lines changed

src/pages/Modu/Workspace/components/TabHeader.tsx renamed to src/components/common/TabHeader.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ const TabHeader: React.FC<{
2626
centered?: boolean,
2727
size?: SizeType;
2828
sticky?: boolean,
29+
className?: string,
2930
contentNoPpadding?: boolean;
3031
locationUpdate?: boolean,
3132
tabBarRender?: boolean,
3233
defaultActiveKey?: string;
3334
tabBarExtraContent?: Partial<Record<'left' | 'right', React.ReactNode>>
34-
}> = ({ items, centered, size, sticky, contentNoPpadding, locationUpdate, tabBarRender, defaultActiveKey, tabBarExtraContent }) => {
35+
}> = ({ items, centered, size, sticky, className, contentNoPpadding, locationUpdate, tabBarRender, defaultActiveKey, tabBarExtraContent }) => {
3536
const location = useLocation();
3637

3738
// 选择的菜单KEY
@@ -75,7 +76,7 @@ const TabHeader: React.FC<{
7576
renderTabBar={!!tabBarRender ? renderTabBar : undefined}
7677
tabBarExtraContent={tabBarExtraContent}
7778
items={items}
78-
className={ contentNoPpadding ? 'ant-tabs-content-no-padding' : ''}
79+
className={`${className} ${contentNoPpadding ? 'ant-tabs-content-no-padding' : ''}`}
7980
/>
8081
);
8182
};

src/pages/Modu/Workspace/Setting/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
} from 'antd';
3737
import { BrainCircuit, Contact } from 'lucide-react';
3838
import { useEffect, useState } from 'react';
39-
import TabHeader from '../components/TabHeader';
39+
import TabHeader from '@/components/common/TabHeader';
4040
import Providers from './Providers';
4141

4242
const isPublicSpace = (space?: WORKSPACE.WorkspaceEntity) => {

src/pages/Modu/Workspace/Studio/BotEdit/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
import { eventBus } from '@/services';
19-
import TabHeader from '@/pages/Modu/Workspace/components/TabHeader';
19+
import TabHeader from '@/components/common/TabHeader';
2020
import { Avatar, Button, Dropdown, Flex, message, Space, TabsProps, Tag, Tooltip, Typography } from 'antd';
2121
import { BOT } from '@/services/bot/typings';
2222
import { useEffect, useRef, useState } from 'react';

src/pages/Modu/Workspace/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { useIntl, useParams } from '@umijs/max';
2828
import { Avatar, Result, Space, TabsProps, Typography } from 'antd';
2929
import { BookCopy, Bot, BrainCircuit, } from 'lucide-react';
3030
import { useEffect, useState } from 'react';
31-
import TabHeader from './components/TabHeader';
31+
import TabHeader from '@/components/common/TabHeader';
3232
import Providers from './Setting/Providers';
3333
import Studio from './Studio';
3434

src/pages/User/index.tsx

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,98 @@
1414
* limitations under the License.
1515
*/
1616

17+
import TabHeader from "@/components/common/TabHeader";
18+
import { EditOutlined } from "@ant-design/icons";
19+
import { FluentEmoji, FluentEmojiProps, Hero, useControls, useCreateStore } from "@lobehub/ui";
20+
import { Link, useModel, useParams } from "@umijs/max";
21+
import { Avatar, Button, Flex, Result, Space, TabsProps, Typography } from "antd";
22+
1723
const User: React.FC = () => {
18-
return <>User</>;
24+
const { initialState } = useModel('@@initialState');
25+
const param = useParams();
26+
27+
const store = useCreateStore();
28+
const control: FluentEmojiProps = useControls(
29+
{
30+
emoji: '😃',
31+
size: {
32+
max: 128,
33+
min: 16,
34+
step: 1,
35+
value: 64,
36+
},
37+
},
38+
{ store },
39+
);
40+
41+
// tab内容
42+
const items: TabsProps['items'] = [
43+
{
44+
key: 'creations',
45+
label: <Typography.Text>作品</Typography.Text>,
46+
children: <Flex vertical justify="center" align="center" className="h-96"><Hero
47+
description="敬请期待,马上到来!"
48+
actions={[
49+
{
50+
link: '/modu/chat',
51+
text: '先和我聊聊',
52+
type: 'primary',
53+
},
54+
]}
55+
title="<b>. MODU</b> CHAT"
56+
/></Flex>,
57+
},
58+
{
59+
key: 'favorites',
60+
label: <Typography.Text>收藏</Typography.Text>,
61+
children: <Flex vertical justify="center" align="center" className="h-96"><Hero
62+
description="敬请期待,马上到来!"
63+
actions={[
64+
{
65+
link: '/modu/chat',
66+
text: '先和我聊聊',
67+
type: 'primary',
68+
},
69+
]}
70+
title="<b>. MODU</b> CHAT"
71+
/></Flex>,
72+
},
73+
]
74+
75+
return (param.userUid !== initialState?.userMe?.uid
76+
? (<Flex vertical justify="center" align="center" className="h-full w-full">
77+
<Result
78+
status="403"
79+
title="403"
80+
subTitle="暂未开放对其他用户的空间访问"
81+
extra={<Button type="primary"><Link to="/modu/chat">先和我聊聊</Link></Button>}
82+
/>
83+
</Flex>)
84+
: (<>
85+
<Flex className="px-20 py-10" gap={20}>
86+
<Avatar size={64} icon={<FluentEmoji type={'anim'} {...control} />} />
87+
<Flex vertical justify="center" align="flex-start" className="h-16 flex-auto">
88+
<Space align="center" className="h-8">
89+
<Typography.Title level={3} className="!m-0">{initialState?.userMe?.name}</Typography.Title>
90+
<Typography.Text type="secondary">{initialState?.userMe?.email}</Typography.Text>
91+
</Space>
92+
<Flex justify="flex-start" align="center" className="h-8" gap={10}>
93+
<Typography.Text type="secondary">这个用户很懒,什么都没有留下</Typography.Text>
94+
<Button type="text" size="small" icon={<Typography.Text type="secondary"><EditOutlined /></Typography.Text>} />
95+
</Flex>
96+
</Flex>
97+
98+
</Flex>
99+
<Flex className="px-20 py-5">
100+
<TabHeader
101+
className="w-full"
102+
contentNoPpadding
103+
items={items}
104+
defaultActiveKey='creations'
105+
/>
106+
</Flex>
107+
</>
108+
));
19109
};
20110

21111
export default User;

src/wrappers/modu/ModuWrapper.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import {
4646
Flex,
4747
Layout,
4848
Menu,
49-
Popover,
5049
Space,
5150
Tooltip,
5251
Typography,
@@ -74,7 +73,7 @@ const ModuWrapper: React.FC = () => {
7473
const store = useCreateStore();
7574
const control: FluentEmojiProps = useControls(
7675
{
77-
emoji: '👤',
76+
emoji: '😃',
7877
size: {
7978
max: 128,
8079
min: 16,

0 commit comments

Comments
 (0)