import { useState } from 'react' export interface PromptStructure { style?: string timbre?: string structure?: string mood?: string tempo?: string instrumentation?: string effects?: string additional?: string } interface Props { value: PromptStructure onChange: (value: PromptStructure) => void } const FIELDS = [ { key: 'style', label: 'Style / Genre', placeholder: 'e.g., Gabber, Ambient, Orchestral, Phonk...' }, { key: 'timbre', label: 'Timbre / Texture', placeholder: 'e.g., Warm analog synths, gritty distortion, ethereal pads...' }, { key: 'structure', label: 'Structure', placeholder: 'e.g., Intro-Verse-Chorus-Verse-Chorus-Bridge-Chorus-Outro' }, { key: 'mood', label: 'Mood / Energy', placeholder: 'e.g., Dark and aggressive, euphoric, melancholic, triumphant...' }, { key: 'tempo', label: 'Tempo / BPM', placeholder: 'e.g., 180 BPM, slow build to 200 BPM, variable...' }, { key: 'instrumentation', label: 'Instrumentation', placeholder: 'e.g., Heavy kick drums, distorted leads, vocal chops, sub-bass...' }, { key: 'effects', label: 'Effects / Processing', placeholder: 'e.g., Heavy sidechain compression, reverb tails, bitcrush...' }, { key: 'additional', label: 'Additional Notes', placeholder: 'Any other details, references, or specific instructions...' }, ] as const export default function StructuredPromptEditor({ value, onChange }: Props) { const [expanded, setExpanded] = useState>(new Set(['style', 'structure', 'mood'])) const toggleField = (key: string) => { setExpanded(prev => { const next = new Set(prev) if (next.has(key)) { next.delete(key) } else { next.add(key) } return next }) } const updateField = (key: string, text: string) => { onChange({ ...value, [key]: text }) } const filledCount = FIELDS.filter(f => value[f.key as keyof PromptStructure]?.trim()).length return (
{filledCount} of {FIELDS.length} fields filled
{FIELDS.map(({ key, label, placeholder }) => { const isExpanded = expanded.has(key) const hasValue = value[key as keyof PromptStructure]?.trim() return (
{isExpanded && (