"use client"; import { useState, useRef } from "react"; import { motion } from "framer-motion"; import { Upload, FileText, X, CheckCircle, AlertCircle, Monitor, Palette, FileImage, ArrowRight, Info } from "lucide-react"; import Link from "next/link"; const categories = [ { id: "digital-art", title: "Digital Art", icon: Monitor, description: "Artwork created using digital tools and software", }, { id: "paintings", title: "Paintings", icon: Palette, description: "Traditional paintings in any medium", }, { id: "poster-making", title: "Poster Making", icon: FileImage, description: "Creative posters with impactful messages", }, ]; export default function SubmitPage() { const [formData, setFormData] = useState({ title: "", description: "", category: "", }); const [file, setFile] = useState(null); const [preview, setPreview] = useState(null); const [fileError, setFileError] = useState(null); const [isDragging, setIsDragging] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false); const [submitSuccess, setSubmitSuccess] = useState(false); const fileInputRef = useRef(null); const handleFileSelect = (selectedFile: File) => { const validTypes = ["image/jpeg", "image/png", "application/pdf"]; const maxSize = 10 * 1024 * 1024; // 10MB setFileError(null); if (!validTypes.includes(selectedFile.type)) { setFileError("Invalid file type. Please upload a JPG, PNG, or PDF file."); return; } if (selectedFile.size > maxSize) { setFileError("File too large. Maximum size is 10MB."); return; } setFile(selectedFile); if (selectedFile.type.startsWith("image/")) { const reader = new FileReader(); reader.onload = (e) => setPreview(e.target?.result as string); reader.readAsDataURL(selectedFile); } else { setPreview(null); } }; const handleDrop = (e: React.DragEvent) => { e.preventDefault(); setIsDragging(false); const droppedFile = e.dataTransfer.files[0]; if (droppedFile) handleFileSelect(droppedFile); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!file || !formData.category) return; setIsSubmitting(true); // TODO: Implement actual submission logic await new Promise(resolve => setTimeout(resolve, 2000)); setIsSubmitting(false); setSubmitSuccess(true); }; const removeFile = () => { setFile(null); setPreview(null); setFileError(null); if (fileInputRef.current) fileInputRef.current.value = ""; }; if (submitSuccess) { return (

Submission Successful!

Your artwork has been submitted for review. You'll receive an email notification once it's approved by our moderators.

View Gallery
); } return (
{/* Header */} SUBMIT ARTWORK

Share Your Masterpiece

Upload your artwork and let the world see your creativity. Make sure to read the rules before submitting.

{/* Info Banner */}
Submission Requirements: JPG, PNG, or PDF files up to 10MB. Minimum resolution 1920x1080. AI-generated artwork will be detected and rejected.
{/* Category Selection */}
{categories.map((category) => ( ))}
{/* File Upload */}
{ e.preventDefault(); setIsDragging(true); }} onDragLeave={() => setIsDragging(false)} onDrop={handleDrop} className={`relative border-2 border-dashed rounded-2xl transition-all ${ isDragging ? "border-lime-400 bg-lime-400/5" : file ? "border-lime-400/50 bg-zinc-900" : "border-zinc-700 bg-zinc-900 hover:border-zinc-600" }`} > e.target.files?.[0] && handleFileSelect(e.target.files[0])} className="hidden" /> {file ? (
{preview ? ( Preview ) : (
)}

{file.name}

{(file.size / 1024 / 1024).toFixed(2)} MB

File ready for upload
) : ( )}
{fileError && (
{fileError}
)}
{/* Title & Description */}
setFormData({ ...formData, title: e.target.value })} className="w-full bg-zinc-900 border border-zinc-800 rounded-xl px-4 py-4 text-white placeholder-zinc-500 focus:outline-none focus:border-lime-400 transition-colors" placeholder="Give your artwork a memorable title" />

{formData.title.length}/100 characters