Skip to content

Commit f6bc39b

Browse files
Abdkhan14Abdullah Khan
andauthored
feat(explore-attr-breakdown): Updating cta visibility logic (getsentry#103696)
- Logic for dismissing was flipped - Only displaying cta for the first chart for multi-chart scenarios, to avoid crowding <img width="1107" height="471" alt="Screenshot 2025-11-19 at 6 18 56 PM" src="https://github.com/user-attachments/assets/71f85334-f15e-43fd-9e05-4c5e71873879" /> Co-authored-by: Abdullah Khan <[email protected]>
1 parent ad6d497 commit f6bc39b

File tree

2 files changed

+45
-39
lines changed

2 files changed

+45
-39
lines changed

static/app/views/explore/components/attributeBreakdowns/attributeComparisonCTA.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {useChartSelection} from './chartSelectionContext';
1818

1919
const PANEL_WIDTH = '400px';
2020
const ILLUSTRATION_HEIGHT = '120px';
21-
const LOCAL_STORAGE_KEY = 'explore:attribute-breakdowns-cta-visible';
21+
const LOCAL_STORAGE_KEY = 'explore:attribute-breakdowns-cta-dismissed';
2222
const CTA_DELAY_MS = 1000;
2323

2424
export function AttributeComparisonCTA({children}: {children: React.ReactNode}) {
@@ -58,7 +58,7 @@ export function AttributeComparisonCTA({children}: {children: React.ReactNode})
5858
icon={<IconClose size="sm" />}
5959
borderless
6060
aria-label={t('Attribute Breakdowns CTA dismissed')}
61-
onClick={() => setIsDismissed(false)}
61+
onClick={() => setIsDismissed(true)}
6262
/>
6363
</Flex>
6464
<Text size="xs" align="left">

static/app/views/explore/spans/charts/index.tsx

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -264,45 +264,51 @@ function Chart({
264264
</Fragment>
265265
);
266266

267+
const widget = (
268+
<Widget
269+
Title={Title}
270+
Actions={Actions}
271+
Visualization={
272+
visualize.visible && (
273+
<ChartVisualization
274+
chartInfo={chartInfo}
275+
chartRef={chartRef}
276+
brush={boxSelectOptions.brush}
277+
onBrushEnd={boxSelectOptions.onBrushEnd}
278+
onBrushStart={boxSelectOptions.onBrushStart}
279+
toolBox={boxSelectOptions.toolBox}
280+
/>
281+
)
282+
}
283+
Footer={
284+
visualize.visible && (
285+
<ConfidenceFooter
286+
extrapolate={extrapolate}
287+
sampleCount={chartInfo.sampleCount}
288+
isLoading={chartInfo.timeseriesResult?.isPending || false}
289+
isSampled={chartInfo.isSampled}
290+
confidence={chartInfo.confidence}
291+
topEvents={
292+
topEvents ? Math.min(topEvents, chartInfo.series.length) : undefined
293+
}
294+
dataScanned={chartInfo.dataScanned}
295+
rawSpanCounts={rawSpanCounts}
296+
userQuery={query.trim()}
297+
/>
298+
)
299+
}
300+
height={chartHeight}
301+
revealActions="always"
302+
/>
303+
);
304+
267305
return (
268306
<ChartWrapper ref={chartWrapperRef}>
269-
<AttributeComparisonCTA>
270-
<Widget
271-
Title={Title}
272-
Actions={Actions}
273-
Visualization={
274-
visualize.visible && (
275-
<ChartVisualization
276-
chartInfo={chartInfo}
277-
chartRef={chartRef}
278-
brush={boxSelectOptions.brush}
279-
onBrushEnd={boxSelectOptions.onBrushEnd}
280-
onBrushStart={boxSelectOptions.onBrushStart}
281-
toolBox={boxSelectOptions.toolBox}
282-
/>
283-
)
284-
}
285-
Footer={
286-
visualize.visible && (
287-
<ConfidenceFooter
288-
extrapolate={extrapolate}
289-
sampleCount={chartInfo.sampleCount}
290-
isLoading={chartInfo.timeseriesResult?.isPending || false}
291-
isSampled={chartInfo.isSampled}
292-
confidence={chartInfo.confidence}
293-
topEvents={
294-
topEvents ? Math.min(topEvents, chartInfo.series.length) : undefined
295-
}
296-
dataScanned={chartInfo.dataScanned}
297-
rawSpanCounts={rawSpanCounts}
298-
userQuery={query.trim()}
299-
/>
300-
)
301-
}
302-
height={chartHeight}
303-
revealActions="always"
304-
/>
305-
</AttributeComparisonCTA>
307+
{index === 0 ? ( // Only show the CTA on the first chart
308+
<AttributeComparisonCTA>{widget}</AttributeComparisonCTA>
309+
) : (
310+
widget
311+
)}
306312
<FloatingTrigger
307313
chartInfo={chartInfo}
308314
setTab={setTab}

0 commit comments

Comments
 (0)