Skip to content

Commit f2ef0a3

Browse files
authored
fix(autofix): Fix deleted lines rendering and make solution editing visible (#89952)
1. Deleted lines in the overlay popup were unindented and way too big in font size 2. Making solution editing controls visible for clarity <img width="808" alt="Screenshot 2025-04-18 at 2 09 43 PM" src="https://github.com/user-attachments/assets/c31d5b05-b4c0-416f-8547-ebc4d3516af4" /> <img width="822" alt="Screenshot 2025-04-18 at 2 20 24 PM" src="https://github.com/user-attachments/assets/008d0e1b-ea9c-4915-954e-ebf23b3513fd" />
1 parent 5c94dca commit f2ef0a3

File tree

3 files changed

+45
-47
lines changed

3 files changed

+45
-47
lines changed

static/app/components/events/autofix/autofixDiff.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,8 @@ const RemovedLine = styled('div')`
896896
background-color: ${DIFF_COLORS.removedRow};
897897
color: ${p => p.theme.textColor};
898898
padding: ${space(0.25)} ${space(0.5)};
899+
white-space: pre-wrap;
900+
font-size: ${p => p.theme.fontSizeSmall};
899901
`;
900902

901903
const StyledTextArea = styled(TextArea)`

static/app/components/events/autofix/autofixSolution.spec.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,9 @@ describe('AutofixSolution', () => {
301301
const timelineItem = screen.getByTestId('autofix-solution-timeline-item-0');
302302
expect(timelineItem).toBeInTheDocument();
303303

304-
// Hover over the timeline item to reveal buttons
305-
await userEvent.hover(timelineItem);
306-
307304
// Find and click the toggle button for deselecting the item
308305
const toggleButton = within(timelineItem).getByRole('button', {
309-
name: 'Deselect item',
306+
name: 'Remove from plan',
310307
});
311308
expect(toggleButton).toBeInTheDocument();
312309
await userEvent.click(toggleButton);
@@ -478,11 +475,10 @@ describe('AutofixSolution', () => {
478475
) as HTMLElement;
479476
expect(timelineItem).not.toBeNull();
480477

481-
// Hover over the timeline item
482-
await userEvent.hover(timelineItem);
483-
484-
// Find the delete button - there should be only one button within the hovered item
485-
const deleteButton = within(timelineItem).getByRole('button');
478+
// Find the delete button using the updated aria-label
479+
const deleteButton = within(timelineItem).getByRole('button', {
480+
name: 'Remove from plan',
481+
});
486482
expect(deleteButton).toBeInTheDocument();
487483

488484
// Click the delete button

static/app/components/events/autofix/autofixSolution.tsx

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {Alert} from 'sentry/components/core/alert';
1111
import {Button} from 'sentry/components/core/button';
1212
import {ButtonBar} from 'sentry/components/core/button/buttonBar';
1313
import {Input} from 'sentry/components/core/input';
14+
import {Tooltip} from 'sentry/components/core/tooltip';
1415
import {AutofixHighlightWrapper} from 'sentry/components/events/autofix/autofixHighlightWrapper';
1516
import AutofixThumbsUpDownButtons from 'sentry/components/events/autofix/autofixThumbsUpDownButtons';
1617
import {
@@ -301,25 +302,33 @@ function SolutionEventList({
301302
/>
302303
)}
303304
<SelectionButtonWrapper>
304-
<SelectionButton
305-
onClick={e => {
306-
e.stopPropagation();
307-
if (isHumanAction) {
308-
onDeleteItem(index);
309-
} else {
310-
handleToggleActive(index);
311-
}
312-
}}
313-
aria-label={isSelected ? t('Deselect item') : t('Select item')}
305+
<Tooltip
306+
title={isSelected ? t('Remove from plan') : t('Add to plan')}
307+
disabled={isHumanAction}
314308
>
315-
{isHumanAction ? (
316-
<IconDelete size="xs" color="red400" />
317-
) : isSelected ? (
318-
<IconClose size="xs" color="red400" />
319-
) : (
320-
<IconAdd size="xs" color="green400" />
321-
)}
322-
</SelectionButton>
309+
<SelectionButton
310+
onClick={e => {
311+
e.stopPropagation();
312+
if (isHumanAction) {
313+
onDeleteItem(index);
314+
} else {
315+
handleToggleActive(index);
316+
}
317+
}}
318+
aria-label={isSelected ? t('Remove from plan') : t('Add to plan')}
319+
actionType={
320+
isHumanAction ? 'delete' : isSelected ? 'close' : 'add'
321+
}
322+
>
323+
{isHumanAction ? (
324+
<IconDelete size="xs" />
325+
) : isSelected ? (
326+
<IconClose size="xs" />
327+
) : (
328+
<IconAdd size="xs" />
329+
)}
330+
</SelectionButton>
331+
</Tooltip>
323332
</SelectionButtonWrapper>
324333
</IconWrapper>
325334
</StyledTimelineHeader>
@@ -792,60 +801,51 @@ const StyledTimelineHeader = styled('div')<{isSelected: boolean; isActive?: bool
792801
`;
793802

794803
const IconWrapper = styled('div')`
795-
position: relative;
796804
display: flex;
797805
align-items: center;
798806
justify-content: center;
799807
flex-shrink: 0;
808+
gap: ${space(1)};
800809
`;
801810

802811
const SelectionButtonWrapper = styled('div')`
803-
position: absolute;
804812
background: none;
805813
border: none;
806814
display: flex;
807815
align-items: center;
808-
justify-content: flex-end;
816+
justify-content: center;
809817
height: 100%;
810-
right: 0;
811818
`;
812819

813-
const SelectionButton = styled('button')`
820+
type SelectionButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
821+
actionType: 'delete' | 'close' | 'add';
822+
};
823+
824+
const SelectionButton = styled('button')<SelectionButtonProps>`
814825
background: none;
815826
border: none;
816827
display: flex;
817828
align-items: center;
818829
justify-content: center;
819830
cursor: pointer;
820831
color: ${p => p.theme.subText};
821-
opacity: 0;
822832
transition:
823-
opacity 0.2s ease,
824833
color 0.2s ease,
825834
background-color 0.2s ease;
826835
border-radius: 5px;
827836
padding: 4px;
828837
829-
${StyledTimelineHeader}:hover & {
830-
opacity: 1;
831-
}
832-
833838
&:hover {
834-
color: ${p => p.theme.gray500};
835-
background-color: ${p => p.theme.background};
839+
color: ${p =>
840+
p.actionType === 'delete' || p.actionType === 'close'
841+
? p.theme.red400
842+
: p.theme.green400};
836843
}
837844
`;
838845

839846
const StyledIconChevron = styled(IconChevron)`
840847
color: ${p => p.theme.subText};
841848
flex-shrink: 0;
842-
opacity: 1;
843-
transition: opacity 0.2s ease;
844-
margin-right: ${space(0.25)};
845-
846-
${StyledTimelineHeader}:hover & {
847-
opacity: 0;
848-
}
849849
`;
850850

851851
const InstructionsInputWrapper = styled('form')`

0 commit comments

Comments
 (0)