@@ -39,10 +39,21 @@ export function ScriptModal({
3939} : ScriptModalProps ) {
4040 const handleSubmit = async ( e : React . FormEvent ) => {
4141 e . preventDefault ( ) ;
42+
43+ if ( ! form . name . trim ( ) ) {
44+ showToast ( "error" , "Validation Error" , "Script name is required" ) ;
45+ return ;
46+ }
47+
48+ if ( ! form . content . trim ( ) ) {
49+ showToast ( "error" , "Validation Error" , "Script content is required" ) ;
50+ return ;
51+ }
52+
4253 const formData = new FormData ( ) ;
43- formData . append ( "name" , form . name ) ;
44- formData . append ( "description" , form . description ) ;
45- formData . append ( "content" , form . content ) ;
54+ formData . append ( "name" , form . name . trim ( ) ) ;
55+ formData . append ( "description" , form . description . trim ( ) ) ;
56+ formData . append ( "content" , form . content . trim ( ) ) ;
4657
4758 Object . entries ( additionalFormData ) . forEach ( ( [ key , value ] ) => {
4859 formData . append ( key , value ) ;
@@ -66,18 +77,24 @@ export function ScriptModal({
6677 < div className = "grid grid-cols-1 md:grid-cols-2 gap-4" >
6778 < div >
6879 < label className = "block text-sm font-medium text-foreground mb-2" >
69- Script Name
80+ Script Name < span className = "text-red-500" > * </ span >
7081 </ label >
7182 < Input
7283 value = { form . name }
7384 onChange = { ( e ) => onFormChange ( { name : e . target . value } ) }
7485 placeholder = "My Script"
7586 required
87+ className = {
88+ ! form . name . trim ( )
89+ ? "border-red-300 focus:border-red-500 focus:ring-red-500"
90+ : ""
91+ }
7692 />
7793 </ div >
7894 < div >
7995 < label className = "block text-sm font-medium text-foreground mb-2" >
80- Description
96+ Description{ " " }
97+ < span className = "text-muted-foreground text-xs" > (optional)</ span >
8198 </ label >
8299 < Input
83100 value = { form . description }
@@ -102,7 +119,7 @@ export function ScriptModal({
102119 < div className = "flex items-center gap-2 mb-4 flex-shrink-0" >
103120 < FileText className = "h-4 w-4 text-primary" />
104121 < h3 className = "text-sm font-medium text-foreground" >
105- Script Content
122+ Script Content < span className = "text-red-500" > * </ span >
106123 </ h3 >
107124 </ div >
108125 < div className = "flex-1 min-h-0" >
0 commit comments