fix
This commit is contained in:
parent
3462256cce
commit
c0fa5c503c
|
|
@ -1,14 +1,8 @@
|
|||
import React, { useState } from 'react'
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { Plus, FolderOpen, Video, Music, Zap, TestTube, Sparkles, Database } from 'lucide-react'
|
||||
import { TauriService } from '../services/tauri'
|
||||
import { useProjectStore } from '../stores/useProjectStore'
|
||||
import { Plus, FolderOpen, Video, Music, Zap, Sparkles, Database } from 'lucide-react'
|
||||
|
||||
const HomePage: React.FC = () => {
|
||||
const [testResult, setTestResult] = useState<string>('')
|
||||
const [isTestingConnection, setIsTestingConnection] = useState(false)
|
||||
const { createProject } = useProjectStore()
|
||||
|
||||
const recentProjects = [
|
||||
{ id: 1, name: '旅行视频剪辑', lastModified: '2 小时前', thumbnail: '/placeholder-video.jpg' },
|
||||
{ id: 2, name: '产品宣传片', lastModified: '1 天前', thumbnail: '/placeholder-video.jpg' },
|
||||
|
|
@ -16,7 +10,6 @@ const HomePage: React.FC = () => {
|
|||
]
|
||||
|
||||
const quickActions = [
|
||||
{ icon: Video, label: '新建视频项目', description: '创建一个新的视频编辑项目', path: '/editor' },
|
||||
{ icon: Sparkles, label: 'AI 视频生成', description: '使用 AI 将图片转换为动态视频', path: '/ai-video' },
|
||||
{ icon: Music, label: '音频处理', description: '处理音频文件,添加效果', path: '/audio' },
|
||||
{ icon: Zap, label: 'AI 自动剪辑', description: '使用 AI 自动生成视频剪辑', path: '/editor' },
|
||||
|
|
@ -24,27 +17,6 @@ const HomePage: React.FC = () => {
|
|||
{ icon: Database, label: 'KV 存储测试', description: '测试 Cloudflare KV 键值存储功能', path: '/kv-test' },
|
||||
]
|
||||
|
||||
const testTauriConnection = async () => {
|
||||
setIsTestingConnection(true)
|
||||
setTestResult('')
|
||||
|
||||
try {
|
||||
const result = await TauriService.greet('MixVideo V2')
|
||||
setTestResult(`✅ 连接成功: ${result}`)
|
||||
} catch (error) {
|
||||
setTestResult(`❌ 连接失败: ${error instanceof Error ? error.message : '未知错误'}`)
|
||||
} finally {
|
||||
setIsTestingConnection(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleCreateProject = async () => {
|
||||
try {
|
||||
await createProject('新项目', '使用 MixVideo V2 创建的项目')
|
||||
} catch (error) {
|
||||
console.error('Failed to create project:', error)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="p-6 space-y-8">
|
||||
|
|
@ -58,26 +30,13 @@ const HomePage: React.FC = () => {
|
|||
</p>
|
||||
<div className="flex items-center space-x-4">
|
||||
<Link
|
||||
to="/editor"
|
||||
to="/projects"
|
||||
className="btn-primary px-8 py-3 text-lg"
|
||||
>
|
||||
<Plus className="mr-2" size={20} />
|
||||
开始新项目
|
||||
</Link>
|
||||
|
||||
<button
|
||||
onClick={handleCreateProject}
|
||||
className="btn-secondary px-6 py-3"
|
||||
>
|
||||
创建项目
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{testResult && (
|
||||
<div className="mt-4 p-3 bg-secondary-100 rounded-lg text-sm">
|
||||
{testResult}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Quick Actions */}
|
||||
|
|
|
|||
Loading…
Reference in New Issue