Skip to content

Commit 887878f

Browse files
Replace checkboxes with compact Chip toggles for waterfall visibility controls
Switches from three full Checkbox components to Mantine Chip pills, giving a more compact, discoverable UI. Chips are visually prominent enough to be noticed but take significantly less horizontal space than labeled checkboxes. Co-authored-by: Mike Shi <mike@hyperdx.io>
1 parent b0d3cae commit 887878f

2 files changed

Lines changed: 31 additions & 24 deletions

File tree

packages/app/src/components/DBTraceWaterfallChart.tsx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
Anchor,
1818
Box,
1919
Center,
20-
Checkbox,
20+
Chip,
2121
Code,
2222
Divider,
2323
Group,
@@ -1022,28 +1022,35 @@ export function DBTraceWaterfallChartContainer({
10221022
{errorCountString}
10231023
</span>
10241024
</Text>
1025-
<Checkbox
1025+
<Chip
10261026
size="xs"
1027-
label="Show spans"
1027+
variant="outline"
10281028
checked={showSpans}
10291029
onChange={() => setShowSpans(!showSpans)}
1030-
data-testid="show-spans-checkbox"
1031-
/>
1030+
data-testid="show-spans-chip"
1031+
>
1032+
Spans
1033+
</Chip>
10321034
{logTableSource && (
1033-
<Checkbox
1035+
<Chip
10341036
size="xs"
1035-
label="Show logs"
1037+
variant="outline"
10361038
checked={showLogs}
10371039
onChange={() => setShowLogs(!showLogs)}
1038-
data-testid="show-logs-checkbox"
1039-
/>
1040+
data-testid="show-logs-chip"
1041+
>
1042+
Logs
1043+
</Chip>
10401044
)}
1041-
<Checkbox
1045+
<Chip
10421046
size="xs"
1043-
label="Show span events"
1047+
variant="outline"
10441048
checked={showSpanEvents}
10451049
onChange={() => setShowSpanEvents(!showSpanEvents)}
1046-
/>
1050+
data-testid="show-span-events-chip"
1051+
>
1052+
Span events
1053+
</Chip>
10471054
</Group>
10481055
<span>
10491056
<Anchor

packages/app/src/components/__tests__/DBTraceWaterfallChart.test.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -312,50 +312,50 @@ describe('DBTraceWaterfallChartContainer', () => {
312312
).toBeInTheDocument();
313313
});
314314

315-
it('renders Show spans and Show logs checkboxes when log source is present', async () => {
315+
it('renders Spans and Logs chips when log source is present', async () => {
316316
setupQueryMocks({ traceData: mockTraceData, logData: mockLogData });
317317
renderComponent();
318318
await waitForLoading();
319319

320-
expect(screen.getByTestId('show-spans-checkbox')).toBeInTheDocument();
321-
expect(screen.getByTestId('show-logs-checkbox')).toBeInTheDocument();
320+
expect(screen.getByTestId('show-spans-chip')).toBeInTheDocument();
321+
expect(screen.getByTestId('show-logs-chip')).toBeInTheDocument();
322322
});
323323

324-
it('does not render Show logs checkbox when no log source', async () => {
324+
it('does not render Logs chip when no log source', async () => {
325325
setupQueryMocks({ traceData: mockTraceData });
326326
renderComponent(null);
327327
await waitForLoading();
328328

329-
expect(screen.getByTestId('show-spans-checkbox')).toBeInTheDocument();
330-
expect(screen.queryByTestId('show-logs-checkbox')).not.toBeInTheDocument();
329+
expect(screen.getByTestId('show-spans-chip')).toBeInTheDocument();
330+
expect(screen.queryByTestId('show-logs-chip')).not.toBeInTheDocument();
331331
});
332332

333-
it('hides log rows when Show logs is unchecked', async () => {
333+
it('hides log rows when Logs chip is toggled off', async () => {
334334
const user = userEvent.setup();
335335
setupQueryMocks({ traceData: mockTraceData, logData: mockLogData });
336336
renderComponent();
337337
await waitForLoading();
338338

339339
expect(MockTimelineChart.latestProps.rows.length).toBe(2);
340340

341-
const showLogsCheckbox = screen.getByTestId('show-logs-checkbox');
342-
await user.click(showLogsCheckbox);
341+
const showLogsChip = screen.getByTestId('show-logs-chip');
342+
await user.click(showLogsChip);
343343

344344
await waitFor(() => {
345345
expect(MockTimelineChart.latestProps.rows.length).toBe(1);
346346
});
347347
});
348348

349-
it('hides span rows when Show spans is unchecked', async () => {
349+
it('hides span rows when Spans chip is toggled off', async () => {
350350
const user = userEvent.setup();
351351
setupQueryMocks({ traceData: mockTraceData, logData: mockLogData });
352352
renderComponent();
353353
await waitForLoading();
354354

355355
expect(MockTimelineChart.latestProps.rows.length).toBe(2);
356356

357-
const showSpansCheckbox = screen.getByTestId('show-spans-checkbox');
358-
await user.click(showSpansCheckbox);
357+
const showSpansChip = screen.getByTestId('show-spans-chip');
358+
await user.click(showSpansChip);
359359

360360
await waitFor(() => {
361361
expect(MockTimelineChart.latestProps.rows.length).toBe(1);

0 commit comments

Comments
 (0)