import { Button, Input, Modal, message } from 'antd'; import { CopyOutlined, DownloadOutlined } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; import { ClipboardManager, FileManager } from '@/utils'; interface TextModalProps { open: boolean; onClose: () => void; title: string; content: string; fileName?: string; } export default function TextModal({ open, onClose, title, content, fileName = '' }: TextModalProps) { const { t } = useTranslation(); const [messageApi, messageContextHolder] = message.useMessage(); async function copy() { const ok = await ClipboardManager.copyText(content || ''); if (ok) { messageApi.success(t('copied')); onClose(); } } function download() { if (!fileName) return; FileManager.downloadTextFile(content, fileName); } return ( <> {messageContextHolder} {fileName && ( )} )} > ); }