import { useState } from 'react' import { Eye, EyeOff } from 'lucide-react' import { Input } from '@/components/ui/Input' import { Textarea } from '@/components/ui/Textarea' import { useScriptGeneratorStore } from '@/store/scriptGeneratorStore' import type { ScriptParameter } from '@/types' interface Props { param: ScriptParameter value: string error: string | undefined disabled: boolean } export function ScriptParameterField({ param, value, error, disabled }: Props) { const setParamValue = useScriptGeneratorStore(s => s.setParamValue) const [showPassword, setShowPassword] = useState(false) const id = `param-${param.key}` const handleChange = (e: React.ChangeEvent) => { setParamValue(param.key, e.target.value) } const handleCheckbox = (e: React.ChangeEvent) => { setParamValue(param.key, e.target.checked ? 'true' : 'false') } let input: React.ReactNode // Track whether the shared Input/Textarea component renders the error internally // (so we skip the manual

at the bottom for these types) let errorRenderedByComponent = false if (param.type === 'text' || param.type === 'multi_text' || param.type === 'number') { errorRenderedByComponent = true input = ( ) } else if (param.type === 'password') { errorRenderedByComponent = true input = (

) } else if (param.type === 'textarea') { errorRenderedByComponent = true input = (