import { useEffect, useRef } from 'react'; import { FileInput } from '~/components/FileInput'; export interface ImportSecretModalProps { clientName?: React.ReactNode; children: React.ReactNode; show: boolean; onClose: () => void; onImport: (file: File) => void | Promise; } export function ImportSecretModal({ clientName, children, show, onClose, onImport }: ImportSecretModalProps) { const handleFileReceived = (files: File[]) => { const promise = onImport(files[0]); if (promise instanceof Promise) { promise.catch((err) => { console.error('could not import: ', err); }); } return promise; }; const refModel = useRef(null); useEffect(() => { if (show) { refModel.current?.showModal(); } else { refModel.current?.close(); } }, [show]); return (
onClose()}>

从文件导入密钥

拖放或点我选择含有密钥的数据库文件
选择你的{clientName && <>「{clientName}」}客户端平台以查看对应说明:
{children}
); }