feat: opt web ux

This commit is contained in:
2026-04-02 22:10:24 +08:00
parent 143b1e8c4b
commit 35511eb877
16 changed files with 1251 additions and 383 deletions

View File

@@ -6,7 +6,6 @@ import Modal from '../components/Modal';
type ImportResult = {
project: { id: string; name: string };
apiKey: string;
stats: { modules: number; endpoints: number };
};
@@ -18,7 +17,6 @@ export default function ImportDialog({ onClose }: { onClose: () => void }) {
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
const [result, setResult] = useState<ImportResult | null>(null);
const [copied, setCopied] = useState(false);
const [dragging, setDragging] = useState(false);
const fileInputRef = useRef<HTMLInputElement>(null);
const navigate = useNavigate();
@@ -60,14 +58,6 @@ export default function ImportDialog({ onClose }: { onClose: () => void }) {
}
};
const copyKey = () => {
if (result?.apiKey) {
navigator.clipboard.writeText(result.apiKey);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
}
};
return (
<Modal open onClose={onClose} size="md">
{!result ? (
@@ -149,19 +139,6 @@ export default function ImportDialog({ onClose }: { onClose: () => void }) {
</div>
</div>
<div className="p-4 rounded-lg bg-warning-muted border border-warning/20">
<div className="flex items-center justify-between mb-2">
<div className="flex items-center gap-2">
<svg className="w-4 h-4 text-warning" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}><path d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z" /></svg>
<p className="text-[13px] font-medium text-warning">API Key save it now</p>
</div>
<button onClick={copyKey} className="text-[11px] font-medium text-warning hover:underline">
{copied ? 'Copied!' : 'Copy'}
</button>
</div>
<code className="text-xs break-all text-text-primary font-mono bg-bg-primary/30 rounded p-2 block">{result.apiKey}</code>
</div>
<div className="flex justify-end">
<button onClick={() => navigate(`/projects/${result.project.id}`)} className="btn-primary">Go to Project</button>
</div>