"use client" import type React from "react" import { useState } from "react" import { useAuth } from "@/contexts/auth-context" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Textarea } from "@/components/ui/textarea" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { Switch } from "@/components/ui/switch" import { Badge } from "@/components/ui/badge" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Separator } from "@/components/ui/separator" import { Upload, FileText, Link, CheckCircle, Clock, Info, Lightbulb, Target, Zap, AlertTriangle, FileVideo, X, } from "lucide-react" interface AppSubmissionDialogProps { open: boolean onOpenChange: (open: boolean) => void } export function AppSubmissionDialog({ open, onOpenChange }: AppSubmissionDialogProps) { const { user, canSubmitApp } = useAuth() const [step, setStep] = useState(1) const [isSubmitting, setIsSubmitting] = useState(false) const [isSubmitted, setIsSubmitted] = useState(false) const [formData, setFormData] = useState({ name: "", type: "文字處理", description: "", appUrl: "", demoFile: null as File | null, sourceCodeUrl: "", documentation: "", features: "", technicalDetails: "", requestFeatured: false, agreeTerms: false, }) // 檢查用戶權限 if (!user || !canSubmitApp()) { return ( 權限不足 您目前沒有提交應用的權限

需要開發者權限

只有開發者角色可以提交 AI 應用申請。您目前是{user?.role === "admin" ? "管理員" : "一般用戶"}身份。

如何獲得開發者權限?

  • • 聯繫管理員申請角色升級
  • • 說明您的開發背景和需求
  • • 等待管理員審核和調整
) } const handleInputChange = (field: string, value: string | boolean | File | null) => { setFormData((prev) => ({ ...prev, [field]: value })) } const handleFileChange = (e: React.ChangeEvent) => { const file = e.target.files?.[0] || null handleInputChange("demoFile", file) } const removeFile = () => { handleInputChange("demoFile", null) } const handleNext = () => { if (step < 3) { setStep(step + 1) } } const handlePrevious = () => { if (step > 1) { setStep(step - 1) } } const handleSubmit = async () => { setIsSubmitting(true) // 模擬提交過程 await new Promise((resolve) => setTimeout(resolve, 2000)) setIsSubmitting(false) setIsSubmitted(true) // 3秒後關閉對話框 setTimeout(() => { onOpenChange(false) setIsSubmitted(false) setStep(1) setFormData({ name: "", type: "文字處理", description: "", appUrl: "", demoFile: null, sourceCodeUrl: "", documentation: "", features: "", technicalDetails: "", requestFeatured: false, agreeTerms: false, }) }, 3000) } const isStep1Valid = formData.name && formData.description && formData.appUrl const isStep2Valid = formData.features const isStep3Valid = formData.agreeTerms if (isSubmitted) { return (

提交成功!

您的應用申請已成功提交,我們將在 1-3 個工作日內完成審核。

後續流程

  • • 管理員將審核您的應用
  • • 審核結果將透過電子郵件通知
  • • 通過審核後應用將上線展示

此對話框將自動關閉...

) } return ( 提交 AI 應用申請 分享您的 AI 創新成果,讓更多人體驗您的應用 {/* Progress Indicator */}
{[1, 2, 3].map((stepNumber) => (
= stepNumber ? "bg-blue-600 text-white" : "bg-gray-200 text-gray-600" }`} > {stepNumber}
{stepNumber < 3 && (
stepNumber ? "bg-blue-600" : "bg-gray-200"}`} /> )}
))}
{/* Main Form */}
{step === 1 && ( 基本資訊 請填寫您的 AI 應用基本資訊
handleInputChange("name", e.target.value)} placeholder="輸入您的應用名稱" />