Skip to content

Commit f534f13

Browse files
Abdkhan14Abdullah Khan
andauthored
feat(explore-suspect-attrs): Updating charts grid (#102417)
Before (makes pagination usage non-intuitive): <img width="1420" height="809" alt="Screenshot 2025-10-30 at 2 35 22 PM" src="https://github.com/user-attachments/assets/9b518de4-3c5e-4836-9c85-d9c2ab4146b9" /> After: <img width="1223" height="799" alt="Screenshot 2025-10-30 at 2 36 13 PM" src="https://github.com/user-attachments/assets/603b2010-07cd-4c70-acc0-80b1ac6af752" /> Added a little box-shadow to make trigger discoverable: <img width="1063" height="348" alt="Screenshot 2025-10-30 at 2 37 12 PM" src="https://github.com/user-attachments/assets/ec3b7119-074d-425e-a2b7-149c5846e213" /> --------- Co-authored-by: Abdullah Khan <[email protected]>
1 parent 2eecdd2 commit f534f13

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

static/app/views/explore/components/suspectTags/chart.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const MAX_BAR_WIDTH = 20;
1616
const HIGH_CARDINALITY_THRESHOLD = 20;
1717
const AXIS_LABEL_FONT_SIZE = 12;
1818
const TOOLTIP_MAX_VALUE_LENGTH = 300;
19+
const MAX_CHART_SERIES_LENGTH = 40;
1920

2021
const SELECTED_SERIES_NAME = 'selected';
2122
const BASELINE_SERIES_NAME = 'baseline';
@@ -76,15 +77,19 @@ function cohortsToSeriesData(
7677

7778
seriesData.sort((a, b) => b.sortValue - a.sortValue);
7879

79-
const selectedSeriesData = seriesData.map(({label, selectedValue}) => ({
80-
label,
81-
value: selectedValue,
82-
}));
80+
const selectedSeriesData = seriesData
81+
.slice(0, MAX_CHART_SERIES_LENGTH)
82+
.map(({label, selectedValue}) => ({
83+
label,
84+
value: selectedValue,
85+
}));
8386

84-
const baselineSeriesData = seriesData.map(({label, baselineValue}) => ({
85-
label,
86-
value: baselineValue,
87-
}));
87+
const baselineSeriesData = seriesData
88+
.slice(0, MAX_CHART_SERIES_LENGTH)
89+
.map(({label, baselineValue}) => ({
90+
label,
91+
value: baselineValue,
92+
}));
8893

8994
return {
9095
[SELECTED_SERIES_NAME]: selectedSeriesData,

static/app/views/explore/components/suspectTags/content.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ import {Chart} from './chart';
2727
import {useChartSelection} from './chartSelectionContext';
2828
import {SortingToggle, type SortingMethod} from './sortingToggle';
2929

30+
const CHARTS_COLUMN_COUNT = 3;
31+
const CHARTS_PER_PAGE = CHARTS_COLUMN_COUNT * 4;
32+
3033
function FeedbackButton() {
3134
const openForm = useFeedbackForm();
3235

@@ -150,7 +153,7 @@ function ContentImpl({
150153
<Fragment>
151154
<ChartsGrid>
152155
{filteredRankedAttributes
153-
.slice(page * 10, (page + 1) * 10)
156+
.slice(page * CHARTS_PER_PAGE, (page + 1) * CHARTS_PER_PAGE)
154157
.map(attribute => (
155158
<Chart
156159
key={attribute.attributeName}
@@ -177,7 +180,8 @@ function ContentImpl({
177180
aria-label={t('Next')}
178181
size="sm"
179182
disabled={
180-
page === Math.ceil(filteredRankedAttributes.length / 10) - 1
183+
page ===
184+
Math.ceil(filteredRankedAttributes.length / CHARTS_PER_PAGE) - 1
181185
}
182186
onClick={() => {
183187
setPage(page + 1);
@@ -253,7 +257,7 @@ const NoAttributesMessage = styled('div')`
253257

254258
const ChartsGrid = styled('div')`
255259
display: grid;
256-
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
260+
grid-template-columns: repeat(${CHARTS_COLUMN_COUNT}, 1fr);
257261
gap: ${space(1)};
258262
`;
259263

static/app/views/explore/components/suspectTags/floatingTrigger.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ const List = styled('ul')`
9494
margin: 0;
9595
padding: 0;
9696
margin-bottom: 0 !important;
97-
box-shadow:
98-
rgba(0, 0, 0, 0.05) 0px 6px 24px 0px,
99-
rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
97+
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
10098
background: ${p => p.theme.backgroundElevated};
10199
color: ${p => p.theme.textColor};
102100
border-radius: ${p => p.theme.borderRadius};

0 commit comments

Comments
 (0)