@@ -43,7 +43,8 @@ interface AutofixStartBoxProps {
4343function AutofixStartBox ( { onSend, groupId} : AutofixStartBoxProps ) {
4444 const [ message , setMessage ] = useState ( '' ) ;
4545
46- const send = ( ) => {
46+ const handleSubmit = ( e : React . FormEvent ) => {
47+ e . preventDefault ( ) ;
4748 onSend ( message ) ;
4849 } ;
4950
@@ -63,37 +64,39 @@ function AutofixStartBox({onSend, groupId}: AutofixStartBoxProps) {
6364 < ContentContainer >
6465 < HeaderText > Autofix</ HeaderText >
6566 < p > Work together with Autofix to find the root cause and fix the issue.</ p >
66- < Row >
67- < Input
68- type = "text"
69- value = { message }
70- onChange = { e => setMessage ( e . target . value ) }
71- placeholder = { '(Optional) Share helpful context here...' }
72- />
73- < ButtonWithStars >
74- < StarLarge1 src = { starImage } />
75- < StarLarge2 src = { starImage } />
76- < StarLarge3 src = { starImage } />
77- < Button
78- priority = "primary"
79- onClick = { send }
80- analyticsEventKey = {
81- message
82- ? 'autofix.give_instructions_clicked'
83- : 'autofix.start_fix_clicked'
84- }
85- analyticsEventName = {
86- message
87- ? 'Autofix: Give Instructions Clicked'
88- : 'Autofix: Start Fix Clicked'
89- }
90- analyticsParams = { { group_id : groupId } }
91- aria-label = "Start Autofix"
92- >
93- { t ( 'Start Autofix' ) }
94- </ Button >
95- </ ButtonWithStars >
96- </ Row >
67+ < form onSubmit = { handleSubmit } >
68+ < Row >
69+ < Input
70+ type = "text"
71+ value = { message }
72+ onChange = { e => setMessage ( e . target . value ) }
73+ placeholder = { '(Optional) Share helpful context here...' }
74+ />
75+ < ButtonWithStars >
76+ < StarLarge1 src = { starImage } />
77+ < StarLarge2 src = { starImage } />
78+ < StarLarge3 src = { starImage } />
79+ < Button
80+ type = "submit"
81+ priority = "primary"
82+ analyticsEventKey = {
83+ message
84+ ? 'autofix.give_instructions_clicked'
85+ : 'autofix.start_fix_clicked'
86+ }
87+ analyticsEventName = {
88+ message
89+ ? 'Autofix: Give Instructions Clicked'
90+ : 'Autofix: Start Fix Clicked'
91+ }
92+ analyticsParams = { { group_id : groupId } }
93+ aria-label = "Start Autofix"
94+ >
95+ { t ( 'Start Autofix' ) }
96+ </ Button >
97+ </ ButtonWithStars >
98+ </ Row >
99+ </ form >
97100 </ ContentContainer >
98101 </ StartBox >
99102 ) ;
0 commit comments