From cb51940cdbf7827ab5de7a12d67475ea93fc5a4c Mon Sep 17 00:00:00 2001 From: chihlasm Date: Fri, 13 Mar 2026 02:09:35 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20add=20ScriptParameterField=20=E2=80=94?= =?UTF-8?q?=20all=207=20field=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- .../scripts/ScriptParameterField.tsx | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 frontend/src/components/scripts/ScriptParameterField.tsx diff --git a/frontend/src/components/scripts/ScriptParameterField.tsx b/frontend/src/components/scripts/ScriptParameterField.tsx new file mode 100644 index 00000000..5e2bf98a --- /dev/null +++ b/frontend/src/components/scripts/ScriptParameterField.tsx @@ -0,0 +1,151 @@ +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 + + if (param.type === 'text' || param.type === 'multi_text' || param.type === 'number') { + input = ( + + ) + } else if (param.type === 'password') { + input = ( +
+ + +
+ ) + } else if (param.type === 'textarea') { + input = ( +