import React, { useMemo, useState } from "react"; import { motion } from "framer-motion"; import { Play, Pause, UploadCloud, Sparkles, Music, Settings2, Gauge, Share2, Wand2 } from "lucide-react"; import { ResponsiveContainer, RadialBarChart, RadialBar, PolarAngleAxis } from "recharts"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; import { Label } from "@/components/ui/label"; import { Slider } from "@/components/ui/slider"; import { Switch } from "@/components/ui/switch"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Separator } from "@/components/ui/separator"; // --- Helper comps --- const Stat = ({ label, value, hint }: { label: string; value: string; hint?: string }) => (
{label} {value} {hint ? {hint} : null}
); const ScoreGauge = ({ score = 72, label = "Algorithm Fit" }: { score?: number; label?: string }) => { const data = useMemo(() => [{ name: label, value: score, fill: "hsl(var(--primary))" }], [score, label]); return (
{score}
{label}
); }; export default function PromptComposer() { const [prompt, setPrompt] = useState("Upbeat 115 BPM house track with soulful vocals; short 5s intro; bright mix; optimized for workout playlists."); const [title, setTitle] = useState("Moving On (Pop‑Punk Revival)"); const [tempo, setTempo] = useState(115); const [lufs, setLufs] = useState(-14); const [autoMaster, setAutoMaster] = useState(true); const [generating, setGenerating] = useState(false); const [playing, setPlaying] = useState(false); const score = useMemo(() => { // Fake score from inputs (for mock only) let s = 60 + Math.min(20, Math.max(0, 120 - Math.abs(120 - tempo)) / 2); s += autoMaster ? 8 : 0; s += lufs >= -14 && lufs <= -13 ? 6 : 0; return Math.min(99, Math.round(s)); }, [tempo, lufs, autoMaster]); const recs = useMemo(() => { const list: string[] = []; if (prompt.toLowerCase().includes("intro") === false) list.push("Add a clear hook within first 10s to reduce early skips."); if (lufs < -16) list.push("Raise loudness toward −14 LUFS (Spotify norm)." ); if (tempo < 100) list.push("Consider +10–15 BPM for workout playlists."); list.push("Tag with 3–5 micro‑genres your audience actually searches."); list.push("Add call‑to‑action in description (save/share)." ); return list; }, [prompt, lufs, tempo]); const handleGenerate = async () => { setGenerating(true); await new Promise(r => setTimeout(r, 1200)); // simulate setGenerating(false); }; return (

Prompt Composer — AI‑Aware Music Creation

Compose from Prompt Describe your track. We’ll structure it for generation and platform algorithms.