import { useState } from 'react'; import { Upload, Plus, Trash2 } from 'lucide-react'; import { adminApi } from '../api'; export function ImageUpload({ value, onChange, label = 'Image' }) { const [uploading, setUploading] = useState(false); const handleUpload = async (e) => { const file = e.target.files?.[0]; if (!file) return; setUploading(true); try { const { url } = await adminApi.upload(file); onChange(url); } catch (err) { alert(err.message); } finally { setUploading(false); } }; return (
{value && (
{value.match(/\.(mp4|webm)$/i) ? (
)} onChange(e.target.value)} placeholder="Paste URL or upload a file below" />
); } export function Field({ label, value, onChange, multiline = false, type = 'text' }) { return (
{multiline ? (