import { useEffect } from 'react'
import { useNavigate } from '@tanstack/react-router'
import { FileCode } from 'lucide-react'
import { Button, Card, PageHeader } from '@/components/ui'

/** 兼容旧路由：脚本管理已合并到编辑器 */
export default function Scripts() {
  const navigate = useNavigate()

  useEffect(() => {
    navigate({ to: '/editor' })
  }, [navigate])

  return (
    <div>
      <PageHeader title="脚本管理" description="已合并到脚本编辑器" />
      <Card className="p-8 text-center">
        <FileCode className="mx-auto mb-3 opacity-50" size={32} />
        <p className="mb-4 text-sm text-[var(--text-muted)]">正在跳转到脚本编辑器...</p>
        <Button onClick={() => navigate({ to: '/editor' })}>打开编辑器</Button>
      </Card>
    </div>
  )
}
