import type { ReactNode } from "react"; import { cx } from "../../lib/utils"; import { copyText } from "./shared"; import { useI18n } from "../../lib/i18n"; export interface FieldRowProps { label: ReactNode; value?: unknown; copyable?: boolean; monospace?: boolean; placeholder?: string; sensitive?: boolean; } // Label/value row used across the overview tab. Click to copy when copyable. export function FieldRow({ label, value, copyable, monospace, placeholder, sensitive }: FieldRowProps) { const { t } = useI18n(); const display = (value == null ? "" : String(value)).trim() || placeholder || "--"; const canCopy = !!copyable && !!display && display !== "--" && display !== "---"; const title = sensitive ? "" : display === "--" || display === "---" ? "" : display; async function handleCopy() { if (canCopy) await copyText(display, t("已复制")); } return (