import { useState, FormEvent } from 'react' import { motion } from 'framer-motion' import { DestructionSlider } from './DestructionSlider' import { isValidURL } from '@/lib/utils' interface InputPanelProps { onSubmit: (url: string, level: number) => void isLoading: boolean } export function InputPanel({ onSubmit, isLoading }: InputPanelProps) { const [url, setUrl] = useState('') const [level, setLevel] = useState(3) const [touched, setTouched] = useState(false) const isValid = isValidURL(url) || url.trim().length === 0 const showError = touched && url.trim().length > 0 && !isValidURL(url) const handleSubmit = (e: FormEvent) => { e.preventDefault() setTouched(true) const cleaned = url.trim() if (!cleaned) return const withScheme = cleaned.startsWith('http') ? cleaned : `https://${cleaned}` if (!isValidURL(withScheme)) return onSubmit(withScheme, level) } return (
Input bay / corruption console
{ setUrl(e.target.value) setTouched(false) }} onBlur={() => setTouched(true)} placeholder="https://company.com/looks-legit" className="input-field pr-12" autoComplete="off" autoCorrect="off" autoCapitalize="off" spellCheck={false} /> {url && ( )}
{showError && ( invalid input / scheme missing / format rejected )}

Machine note

Higher levels produce weirder slugs, lower trust, and more visible digital rot.

{isLoading ? 'Corrupting link...' : 'Destroy trust'}
) }