Skip to content

Commit 53aaef3

Browse files
committed
pref: Optimize interface
1 parent 0091f36 commit 53aaef3

8 files changed

Lines changed: 48 additions & 35 deletions

File tree

chat2db-client/src/blocks/Setting/index.less

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
.settingIcon {
88
color: var(--custom-color-icon);
9+
910
&:hover {
1011
color: var(--color-primary);
1112
}
@@ -23,6 +24,7 @@
2324
.title {
2425
font-size: 14px;
2526
margin-bottom: 10px;
27+
2628
i {
2729
margin-left: 10px;
2830
color: var(--color-primary);
@@ -44,7 +46,7 @@
4446
.menus {
4547
width: 200px;
4648
background-color: var(--color-bg-subtle);
47-
padding: 20px 10px 0px 10px;
49+
padding: 20px;
4850
position: sticky;
4951
top: 0;
5052

@@ -55,21 +57,24 @@
5557

5658
.menuItem {
5759
margin: 10px 0px;
58-
padding: 10px 10px 10px 20px;
60+
padding: 10px;
5961
cursor: pointer;
6062
border-radius: 4px;
6163
display: flex;
6264
justify-content: flex-start;
6365
align-items: center;
66+
6467
.prefixIcon {
6568
font-size: 16px;
6669
margin-right: 10px;
6770
}
71+
6872
.rightSlot {
6973
flex: 1;
7074
display: flex;
7175
justify-content: flex-end;
7276
}
77+
7378
.rightSlotAbout {
7479
i {
7580
font-size: 18px;
@@ -93,4 +98,4 @@
9398
font-size: 16px;
9499
padding-bottom: 20px;
95100
}
96-
}
101+
}

chat2db-client/src/blocks/Setting/index.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { IAIState } from '@/models/ai';
1212
import { IAiConfig } from '@/typings';
1313
import styles from './index.less';
1414
import { ILatestVersion } from '@/service/config';
15-
import UpdateDetection,{IUpdateDetectionRef,UpdatedStatusEnum} from '@/blocks/Setting/UpdateDetection';
15+
import UpdateDetection, { IUpdateDetectionRef, UpdatedStatusEnum } from '@/blocks/Setting/UpdateDetection';
1616

1717
interface IProps {
1818
aiConfig: IAiConfig;
@@ -120,14 +120,17 @@ function Setting(props: IProps) {
120120

121121
return (
122122
<>
123-
<div
124-
className={classnames(className, styles.box)}
125-
onClick={() => {
126-
showModal();
127-
}}
128-
>
129-
{props.render ? props.render : <Iconfont className={styles.settingIcon} code="&#xe630;" />}
130-
</div>
123+
<Tooltip placement="right" title={i18n('setting.title.setting')}>
124+
<div
125+
className={classnames(className, styles.box)}
126+
onClick={() => {
127+
showModal();
128+
}}
129+
>
130+
{props.render ? props.render : <Iconfont className={styles.settingIcon} code="&#xe630;" />}
131+
</div>
132+
</Tooltip>
133+
131134
<UpdateDetection
132135
setUpdateDetectionData={setUpdateDetectionData}
133136
updateDetectionData={updateDetectionData}

chat2db-client/src/i18n/en-us/connection.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
'connection.title': 'Connections',
23
'connection.title.connections': 'Connections',
34
'connection.title.createConnection': 'New Connection',
45
'connection.title.editConnection': 'Edit Connection',

chat2db-client/src/i18n/en-us/workspace.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
'workspace.title': 'Workspace',
23
'workspace.cascader.placeholder': 'Select Here',
34
'workspace.ai.input.placeholder': 'Enter your plain text statement here',
45
'workspace.title.saved': 'Saved',

chat2db-client/src/i18n/zh-cn/connection.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
'connection.title': '数据源',
23
'connection.title.connections': '连接',
34
'connection.title.createConnection': '创建数据源',
45
'connection.title.editConnection': '修改数据源',

chat2db-client/src/i18n/zh-cn/workspace.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
'workspace.title': '工作台',
23
'workspace.cascader.placeholder': '请选择',
34
'workspace.ai.input.placeholder': '在这里输入纯文本语句',
45
'workspace.title.saved': '保存记录',

chat2db-client/src/pages/main/index.tsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useState } from 'react';
22
import { useNavigate } from 'react-router-dom';
33
import { connect } from 'umi';
4-
import { Dropdown } from 'antd';
4+
import { Dropdown, Tooltip } from 'antd';
55
import classnames from 'classnames';
66

77
import Iconfont from '@/components/Iconfont';
@@ -35,27 +35,31 @@ const navConfig: INavItem[] = [
3535
iconFontSize: 16,
3636
isLoad: false,
3737
component: <Workspace />,
38+
name: i18n('workspace.title'),
3839
},
3940
{
4041
key: 'dashboard',
4142
icon: '\ue629',
4243
iconFontSize: 24,
4344
isLoad: false,
4445
component: <Dashboard />,
46+
name: i18n('dashboard.title'),
4547
},
4648
{
4749
key: 'connections',
4850
icon: '\ue622',
4951
iconFontSize: 20,
5052
isLoad: false,
5153
component: <Connection />,
54+
name: i18n('connection.title'),
5255
},
5356
{
5457
key: 'github',
5558
icon: '\ue885',
5659
iconFontSize: 26,
5760
isLoad: false,
5861
openBrowser: 'https://github.com/chat2db/Chat2DB/',
62+
name: 'Github',
5963
},
6064
];
6165

@@ -126,6 +130,7 @@ function MainPage(props: IProps) {
126130
iconFontSize: 24,
127131
isLoad: false,
128132
component: <Team />,
133+
name: '团队协作',
129134
});
130135
if (localStorage.getItem('curPage') === 'team') {
131136
setActiveNav(navConfig[3]);
@@ -197,32 +202,27 @@ function MainPage(props: IProps) {
197202
<ul className={styles.navList}>
198203
{navConfig.map((item) => {
199204
return (
200-
<li
201-
key={item.key}
202-
className={classnames({
203-
[styles.activeNav]: item.key == activeNav?.key,
204-
})}
205-
onClick={() => switchingNav(item)}
206-
>
207-
<Iconfont
208-
style={{ '--icon-size': item.iconFontSize + 'px' } as any}
209-
className={styles.icon}
210-
code={item.icon}
211-
/>
212-
</li>
205+
<Tooltip key={item.key} placement="right" title={item.name}>
206+
<li
207+
className={classnames({
208+
[styles.activeNav]: item.key == activeNav?.key,
209+
})}
210+
onClick={() => switchingNav(item)}
211+
>
212+
<Iconfont
213+
style={{ '--icon-size': item.iconFontSize + 'px' } as any}
214+
className={styles.icon}
215+
code={item.icon}
216+
/>
217+
</li>
218+
</Tooltip>
213219
);
214220
})}
215221
</ul>
216222
<div className={styles.footer}>
217-
{/* <Iconfont
218-
code="&#xe67c;"
219-
className={styles.questionIcon}
220-
onClick={() => {
221-
window.open('https://github.com/chat2db/chat2db/wiki');
222-
}}
223-
/> */}
224-
225-
{userInfo?.roleCode !== IRole.DESKTOP ? renderUser() : null}
223+
<Tooltip placement="right" title="个人中心">
224+
{userInfo?.roleCode !== IRole.DESKTOP ? renderUser() : null}
225+
</Tooltip>
226226
<Setting className={styles.setIcon} />
227227
</div>
228228
</div>

chat2db-client/src/typings/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ export interface INavItem {
77
openBrowser?: string;
88
iconFontSize?: number;
99
isLoad: boolean;
10+
name: string;
1011
}

0 commit comments

Comments
 (0)