Files
scriptforge/frontend/src/components/ResultCard.tsx
zhilv 5414c9c865 feat: 分类/变体体系 + 用户认证 + 管理后台
- 运行时分类体系:Shell/Python/JavaScript/Ruby/PHP 各含变体
- 用户注册/登录(JWT + bcrypt),首个注册用户为管理员
- 管理后台 /admin 动态管理分类和变体
- 脚本市场支持按分类筛选
- CodeMirror 语言模式根据分类名称自动切换
- 结果页展示该分类下所有变体的运行命令
- source 命令变体用于 Shell 类继承环境变量

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 15:02:20 +08:00

68 lines
2.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { CreateScriptResponse } from '../types'
import { Link } from 'react-router-dom'
interface Props {
result: CreateScriptResponse
onReset: () => void
}
export default function ResultCard({ result, onReset }: Props) {
return (
<div className="space-y-6">
<div className="text-center">
<div className="text-4xl mb-2"></div>
<h2 className="text-xl font-bold">
{result.status === 'published' ? '脚本已发布' : '草稿已创建'}
</h2>
</div>
<div className="bg-gray-800/50 border border-gray-700 rounded-lg p-4 space-y-3">
<div className="flex justify-between text-sm">
<span className="text-gray-400"></span>
<span>{result.title}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-400"> ID</span>
<span className="font-mono text-blue-400">{result.id}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-400"></span>
<a href={result.url} target="_blank" rel="noreferrer" className="font-mono text-blue-400 hover:underline break-all text-right max-w-[70%]">
{result.url}
</a>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-400"></span>
<span className={result.status === 'published' ? 'text-green-400' : 'text-gray-400'}>
{result.status === 'published' ? '已发布' : '草稿'}
</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-400"></span>
<span>{new Date(result.expires_at).toLocaleString('zh-CN')}</span>
</div>
<div className="pt-2 border-t border-gray-700">
<div className="text-xs text-gray-500 mb-1"></div>
<div className="font-mono text-xs bg-gray-900 px-3 py-2 rounded break-all select-all">
{result.admin_token}
</div>
</div>
</div>
<div className="flex gap-3 justify-center">
<button
onClick={onReset}
className="px-4 py-2 bg-gray-800 hover:bg-gray-700 rounded-lg text-sm transition-colors"
>
</button>
<Link
to={`/s/${result.id}`}
className="px-4 py-2 bg-blue-600 hover:bg-blue-700 rounded-lg text-sm transition-colors"
>
</Link>
</div>
</div>
)
}