diff --git a/ui/src/components/certificate/CertificateDetail.tsx b/ui/src/components/certificate/CertificateDetail.tsx index 95864003..e3ffc1fd 100644 --- a/ui/src/components/certificate/CertificateDetail.tsx +++ b/ui/src/components/certificate/CertificateDetail.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Button, Form, Input, Tooltip } from "antd"; +import { Button, Form, Input, message, Tooltip } from "antd"; import { CopyToClipboard } from "react-copy-to-clipboard"; import { Clipboard as ClipboardIcon } from "lucide-react"; @@ -13,6 +13,8 @@ type CertificateDetailProps = { const CertificateDetail = ({ data }: CertificateDetailProps) => { const { t } = useTranslation(); + const [messageApi, MessageContextHolder] = message.useMessage(); + const handleDownloadClick = async () => { // TODO: 支持下载多种格式 const zipName = `${data.id}-${data.san}.zip`; @@ -32,12 +34,19 @@ const CertificateDetail = ({ data }: CertificateDetailProps) => { return (
+ {MessageContextHolder} +
- + { + messageApi.success(t("common.copy.done")); + }} + > @@ -49,7 +58,12 @@ const CertificateDetail = ({ data }: CertificateDetailProps) => {
- + { + messageApi.success(t("common.copy.done")); + }} + > diff --git a/ui/src/hooks/index.ts b/ui/src/hooks/index.ts index 427e92cd..b65c3d17 100644 --- a/ui/src/hooks/index.ts +++ b/ui/src/hooks/index.ts @@ -1,3 +1,3 @@ -import useTheme from "./use-theme"; +import useTheme from "./useTheme"; -export { useTheme }; +export { useResponsive, useTheme }; diff --git a/ui/src/hooks/use-theme.ts b/ui/src/hooks/use-theme.ts deleted file mode 100644 index 92c2e90f..00000000 --- a/ui/src/hooks/use-theme.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { useTheme } from "ahooks"; - -export default function () { - const { theme, themeMode, setThemeMode } = useTheme({ localStorageKey: "certimate-ui-theme" }); - return { theme, themeMode, setThemeMode }; -} diff --git a/ui/src/hooks/useTheme.ts b/ui/src/hooks/useTheme.ts new file mode 100644 index 00000000..baa6b2fd --- /dev/null +++ b/ui/src/hooks/useTheme.ts @@ -0,0 +1,5 @@ +import { useTheme } from "ahooks"; + +export default () => { + return useTheme({ localStorageKey: "certimate-ui-theme" }); +}; diff --git a/ui/src/i18n/locales/en/nls.common.json b/ui/src/i18n/locales/en/nls.common.json index bdbe27eb..d3b5c6d3 100644 --- a/ui/src/i18n/locales/en/nls.common.json +++ b/ui/src/i18n/locales/en/nls.common.json @@ -6,6 +6,7 @@ "common.view": "View", "common.edit": "Edit", "common.copy": "Copy", + "common.copy.done": "Copied", "common.download": "Download", "common.delete": "Delete", "common.delete.succeeded.message": "Delete Successful", diff --git a/ui/src/i18n/locales/zh/nls.common.json b/ui/src/i18n/locales/zh/nls.common.json index e78df39e..fc986eda 100644 --- a/ui/src/i18n/locales/zh/nls.common.json +++ b/ui/src/i18n/locales/zh/nls.common.json @@ -6,6 +6,7 @@ "common.view": "查看", "common.edit": "编辑", "common.copy": "复制", + "common.copy.done": "已复制", "common.download": "下载", "common.delete": "刪除", "common.delete.succeeded.message": "删除成功",