"use client"; import { useState } from "react"; import { Dialog, DialogContent, 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 { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { Checkbox } from "@/components/ui/checkbox"; import { Progress } from "@/components/ui/progress"; import { Download, Folder, FileCode, Package, Check, Loader2, } from "lucide-react"; import { cn } from "@/lib/utils"; interface ExportModalProps { open: boolean; onClose: () => void; platform: "roblox" | "uefn" | "spatial" | "web"; } const exportFormats = { roblox: [ { id: "rbxlx", name: "Roblox Place (.rbxlx)", description: "Full place file with all assets" }, { id: "rbxmx", name: "Roblox Model (.rbxmx)", description: "Model file for importing" }, { id: "lua", name: "Lua Scripts (.lua)", description: "Export scripts only" }, ], uefn: [ { id: "uproject", name: "UEFN Project", description: "Full Unreal project structure" }, { id: "verse", name: "Verse Scripts", description: "Export Verse code only" }, { id: "pak", name: "Package (.pak)", description: "Compiled game package" }, ], spatial: [ { id: "spatial", name: "Spatial Package", description: "Ready for Spatial.io upload" }, { id: "unity", name: "Unity Export", description: "Unity asset format" }, { id: "gltf", name: "glTF Models", description: "3D models only" }, ], web: [ { id: "html", name: "Static HTML", description: "Single HTML file with embedded code" }, { id: "zip", name: "Project ZIP", description: "Full project archive" }, { id: "npm", name: "NPM Package", description: "Ready for npm publish" }, ], }; const platformColors = { roblox: "text-red-400", uefn: "text-purple-400", spatial: "text-emerald-400", web: "text-blue-400", }; export function ExportModal({ open, onClose, platform }: ExportModalProps) { const [selectedFormat, setSelectedFormat] = useState(exportFormats[platform][0].id); const [exportName, setExportName] = useState("my-project"); const [includeAssets, setIncludeAssets] = useState(true); const [minify, setMinify] = useState(false); const [isExporting, setIsExporting] = useState(false); const [exportProgress, setExportProgress] = useState(0); const [exportComplete, setExportComplete] = useState(false); const handleExport = async () => { setIsExporting(true); setExportProgress(0); setExportComplete(false); // Simulate export progress for (let i = 0; i <= 100; i += 10) { await new Promise(resolve => setTimeout(resolve, 200)); setExportProgress(i); } setIsExporting(false); setExportComplete(true); // Trigger download const content = `-- Exported from AeThex Studio\n-- Platform: ${platform}\n-- Format: ${selectedFormat}\n\nprint("Hello from AeThex!")`; const blob = new Blob([content], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `${exportName}.${selectedFormat === 'lua' ? 'lua' : 'zip'}`; a.click(); URL.revokeObjectURL(url); }; const resetAndClose = () => { setExportComplete(false); setExportProgress(0); onClose(); }; return ( Export Project
{/* Platform indicator */}
{platform} Export
{/* Export name */}
setExportName(e.target.value)} placeholder="my-project" className="bg-white/5 border-white/10" />
{/* Format selection */}
{exportFormats[platform].map((format) => (
setSelectedFormat(format.id)} >
{format.name}
{format.description}
))}
{/* Options */}
{/* Progress */} {(isExporting || exportComplete) && (
{exportComplete ? "Export complete!" : "Exporting..."} {exportProgress}%
)}
); }