import { X } from 'lucide-react' import { v4 as uuidv4 } from 'uuid' import { maskSecret } from '../../utils/maskSecret' export default function AddKeyModal({ show, t, editingKey, newKey, setNewKey, loading, onClose, onAdd }) { if (!show) { return null } const isEditing = Boolean(editingKey?.key) const displayKey = isEditing ? maskSecret(editingKey?.key || newKey.key) : newKey.key return (

{isEditing ? t('accountManager.modalEditKeyTitle') : t('accountManager.modalAddKeyTitle')}

setNewKey({ ...newKey, key: e.target.value })} autoFocus={!isEditing} readOnly={isEditing} /> {!isEditing && ( )}

{isEditing ? t('accountManager.keyReadonlyHint') : t('accountManager.generateHint')}

setNewKey({ ...newKey, name: e.target.value })} autoFocus={isEditing} />
setNewKey({ ...newKey, remark: e.target.value })} />
) }