Skip to content

Commit

Permalink
fix(autofix): Allow keyboard submit on autofix start (getsentry#81092)
Browse files Browse the repository at this point in the history
Before you had to click the button to start Autofix. Now you can
directly submit by hitting enter if you're giving starting context.
  • Loading branch information
roaga authored Nov 20, 2024
1 parent 4b1562c commit f6258c1
Showing 1 changed file with 35 additions and 32 deletions.
67 changes: 35 additions & 32 deletions static/app/views/issueDetails/streamline/solutionsHubDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ interface AutofixStartBoxProps {
function AutofixStartBox({onSend, groupId}: AutofixStartBoxProps) {
const [message, setMessage] = useState('');

const send = () => {
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
onSend(message);
};

Expand All @@ -63,37 +64,39 @@ function AutofixStartBox({onSend, groupId}: AutofixStartBoxProps) {
<ContentContainer>
<HeaderText>Autofix</HeaderText>
<p>Work together with Autofix to find the root cause and fix the issue.</p>
<Row>
<Input
type="text"
value={message}
onChange={e => setMessage(e.target.value)}
placeholder={'(Optional) Share helpful context here...'}
/>
<ButtonWithStars>
<StarLarge1 src={starImage} />
<StarLarge2 src={starImage} />
<StarLarge3 src={starImage} />
<Button
priority="primary"
onClick={send}
analyticsEventKey={
message
? 'autofix.give_instructions_clicked'
: 'autofix.start_fix_clicked'
}
analyticsEventName={
message
? 'Autofix: Give Instructions Clicked'
: 'Autofix: Start Fix Clicked'
}
analyticsParams={{group_id: groupId}}
aria-label="Start Autofix"
>
{t('Start Autofix')}
</Button>
</ButtonWithStars>
</Row>
<form onSubmit={handleSubmit}>
<Row>
<Input
type="text"
value={message}
onChange={e => setMessage(e.target.value)}
placeholder={'(Optional) Share helpful context here...'}
/>
<ButtonWithStars>
<StarLarge1 src={starImage} />
<StarLarge2 src={starImage} />
<StarLarge3 src={starImage} />
<Button
type="submit"
priority="primary"
analyticsEventKey={
message
? 'autofix.give_instructions_clicked'
: 'autofix.start_fix_clicked'
}
analyticsEventName={
message
? 'Autofix: Give Instructions Clicked'
: 'Autofix: Start Fix Clicked'
}
analyticsParams={{group_id: groupId}}
aria-label="Start Autofix"
>
{t('Start Autofix')}
</Button>
</ButtonWithStars>
</Row>
</form>
</ContentContainer>
</StartBox>
);
Expand Down

0 comments on commit f6258c1

Please sign in to comment.