初始提交: ScriptForge 脚本快速转运行链接服务
Some checks failed
Release / build-and-release (push) Failing after 1m31s
Some checks failed
Release / build-and-release (push) Failing after 1m31s
- Go 后端 (Gin + GORM + SQLite) 提供 API 和纯文本脚本服务 - Vite + React + TypeScript + Tailwind 前端 - 单二进制部署 (Go embed 前端静态文件) - Gitea Actions CI/CD: 打标签自动构建多平台 Release - 支持 bash/zsh/sh/fish/python3/node/ruby/php 8种运行环境 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
71
frontend/src/components/ResultCard.tsx
Normal file
71
frontend/src/components/ResultCard.tsx
Normal file
@@ -0,0 +1,71 @@
|
||||
import { CreateScriptResponse } from '../types'
|
||||
import CommandCard from './CommandCard'
|
||||
|
||||
interface Props {
|
||||
result: CreateScriptResponse
|
||||
onReset: () => void
|
||||
}
|
||||
|
||||
export default function ResultCard({ result, onReset }: Props) {
|
||||
const detailUrl = `${window.location.origin}/s/${result.id}`
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="text-center">
|
||||
<div className="text-4xl mb-2">✅</div>
|
||||
<h2 className="text-xl font-bold">运行链接已生成</h2>
|
||||
</div>
|
||||
|
||||
<CommandCard command={result.command} />
|
||||
|
||||
<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">脚本 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>
|
||||
<span>{result.runtime}</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="flex justify-between text-sm">
|
||||
<span className="text-gray-400">详情页</span>
|
||||
<a
|
||||
href={detailUrl}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="text-blue-400 hover:underline font-mono text-xs"
|
||||
>
|
||||
{detailUrl}
|
||||
</a>
|
||||
</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>
|
||||
<a
|
||||
href={detailUrl}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="px-4 py-2 bg-blue-600 hover:bg-blue-700 rounded-lg text-sm transition-colors"
|
||||
>
|
||||
查看详情
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user