"use client"; import { Copy } from "lucide-react"; import { useTranslation } from "react-i18next"; import { toast } from "sonner"; /** 长单号/流水号:单行截断;点击复制全文,悬停可看全文 */ export function WalletCellMonoId({ value, empty = "—", copyHint, }: { value: string | null | undefined; empty?: string; /** 用于 toast / 无障碍:如「流水号」「主站流水号」 */ copyHint?: string; }): React.ReactElement { const { t } = useTranslation("wallet"); if (value == null || value === "") { return {empty}; } const copy = async (e: React.MouseEvent): Promise => { e.stopPropagation(); try { await navigator.clipboard.writeText(value); toast.success( copyHint ? t("copySuccess", { label: copyHint }) : t("copySuccess", { label: "" }).trim(), ); } catch { toast.error(t("copyFailed")); } }; return ( ); }