Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Tooltip to action icon of FileManager #561

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default {
copy: 'Copy',
copied: 'Copied',
comingSoon: 'Coming Soon',
download: 'Download',
},
login: {
login: 'Sign in',
Expand Down
1 change: 1 addition & 0 deletions web/src/locales/zh-traditional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default {
copy: '複製',
copied: '複製成功',
comingSoon: '即將推出',
download: '下載',
},
login: {
login: '登入',
Expand Down
1 change: 1 addition & 0 deletions web/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default {
copy: '复制',
copied: '复制成功',
comingSoon: '即将推出',
download: '下载',
},
login: {
login: '登录',
Expand Down
46 changes: 26 additions & 20 deletions web/src/pages/file-manager/action-cell/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
DeleteOutlined,
DownloadOutlined,
EditOutlined,
ToolOutlined,
LinkOutlined,
} from '@ant-design/icons';
import { Button, Space, Tooltip } from 'antd';
import { useHandleDeleteFile } from '../hooks';
Expand All @@ -30,7 +30,7 @@ const ActionCell = ({
}: IProps) => {
const documentId = record.id;
const beingUsed = false;
const { t } = useTranslate('knowledgeDetails');
const { t } = useTranslate('fileManager');
const { handleRemoveFile } = useHandleDeleteFile(
[documentId],
setSelectedRowKeys,
Expand Down Expand Up @@ -58,13 +58,15 @@ const ActionCell = ({

return (
<Space size={0}>
<Button
type="text"
className={styles.iconButton}
onClick={onShowConnectToKnowledgeModal}
>
<ToolOutlined size={20} />
</Button>
<Tooltip title={t('addToKnowledge')}>
<Button
type="text"
className={styles.iconButton}
onClick={onShowConnectToKnowledgeModal}
>
<LinkOutlined size={20} />
</Button>
</Tooltip>

<Tooltip title={t('rename', { keyPrefix: 'common' })}>
<Button
Expand All @@ -76,23 +78,27 @@ const ActionCell = ({
<EditOutlined size={20} />
</Button>
</Tooltip>
<Button
type="text"
disabled={beingUsed}
onClick={handleRemoveFile}
className={styles.iconButton}
>
<DeleteOutlined size={20} />
</Button>
{record.type !== 'folder' && (
<Tooltip title={t('delete', { keyPrefix: 'common' })}>
<Button
type="text"
disabled={beingUsed}
onClick={onDownloadDocument}
onClick={handleRemoveFile}
className={styles.iconButton}
>
<DownloadOutlined size={20} />
<DeleteOutlined size={20} />
</Button>
</Tooltip>
{record.type !== 'folder' && (
<Tooltip title={t('download', { keyPrefix: 'common' })}>
<Button
type="text"
disabled={beingUsed}
onClick={onDownloadDocument}
className={styles.iconButton}
>
<DownloadOutlined size={20} />
</Button>
</Tooltip>
)}
</Space>
);
Expand Down