Skip to content

Commit 9efa13f

Browse files
feat(playground-ui): remove CombinedButtons in favor of ButtonsGroup (#16035)
## Summary - Replace both `CombinedButtons` callers — observability (`trace-timeline-tools.tsx`) and experiment (`experiment-trace-timeline-tools.tsx`) trace timeline span-type filters — with `ButtonsGroup spacing="close"`. - Delete `packages/playground-ui/src/ds/components/CombinedButtons/` and remove the export from the package index. ### Why `CombinedButtons` and `ButtonsGroup` were near-duplicate primitives. The segmented look from `CombinedButtons` is achievable with `ButtonsGroup spacing="close"`, just with per-button borders + 2px gap rather than a single outer shell with internal dividers. Consolidating to one primitive removes API drift. ### Migration ```tsx // Before <CombinedButtons> <Button>Agent</Button> <Button>Model</Button> </CombinedButtons> // After <ButtonsGroup spacing="close"> <Button>Agent</Button> <Button>Model</Button> </ButtonsGroup> ``` ## Test plan - [ ] Visit `/agents/<id>/traces?traceId=<id>` → trace timeline filter (Agent / Model / etc.) renders as segmented cluster, click toggles fade, X resets - [ ] Visit `/experiments/<id>` → click a result row → trace panel timeline filter behaves identically - [ ] `pnpm exec tsc --noEmit` clean in `packages/playground` and `packages/playground-ui` - [ ] No remaining `CombinedButtons` references in repo (grep) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 This PR removes a duplicate button component called `CombinedButtons` that did the same thing as an existing `ButtonsGroup` component. Instead of having two similar ways to display a group of buttons, the code now uses `ButtonsGroup` everywhere, making the codebase simpler and less confusing. ## Summary Consolidates two near-duplicate button grouping primitives by removing the `CombinedButtons` component in favor of using `ButtonsGroup` with `spacing="close"` to achieve the same segmented button layout. ### Changes Made **Component Removal:** - Deleted `packages/playground-ui/src/ds/components/CombinedButtons/` directory, including: - `combined-buttons.tsx` (component implementation with `CombinedButtonsProps` interface) - `combined-buttons.stories.tsx` (Storybook stories: Default, ThreeButtons, WithIcons, IconOnly, SplitButton) - `index.ts` (barrel export) - Removed `CombinedButtons` export from `packages/playground-ui/src/index.ts` **Migration:** - `packages/playground/src/domains/experiments/components/experiment-trace-timeline-tools.tsx`: Replaced `<CombinedButtons>` wrapper with `<ButtonsGroup spacing="close">` - `packages/playground/src/domains/observability/components/trace-timeline-tools.tsx`: Replaced `<CombinedButtons>` wrapper with `<ButtonsGroup spacing="close">` **Documentation:** - Added `.changeset/wise-ties-try.md` documenting the minor version bump and breaking change removal, including before/after migration examples ### Impact - Both affected components (trace timeline tools in observability and experiments domains) now use the consolidated `ButtonsGroup` API with `spacing="close"` to render segmented button clusters - No functional or visual changes to end-user behavior; the segmented appearance and interaction patterns remain identical - API surface reduced by removing duplicate component <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 1c2dda8 commit 9efa13f

7 files changed

Lines changed: 25 additions & 107 deletions

File tree

.changeset/wise-ties-try.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@mastra/playground-ui': minor
3+
---
4+
5+
Removed the `CombinedButtons` component. Use `ButtonsGroup` with `spacing="close"` for the same segmented-style cluster of toggle buttons.
6+
7+
```tsx
8+
// Before
9+
<CombinedButtons>
10+
<Button>Agent</Button>
11+
<Button>Model</Button>
12+
</CombinedButtons>
13+
14+
// After
15+
<ButtonsGroup spacing="close">
16+
<Button>Agent</Button>
17+
<Button>Model</Button>
18+
</ButtonsGroup>
19+
```

packages/playground-ui/src/ds/components/CombinedButtons/combined-buttons.stories.tsx

Lines changed: 0 additions & 77 deletions
This file was deleted.

packages/playground-ui/src/ds/components/CombinedButtons/combined-buttons.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/playground-ui/src/ds/components/CombinedButtons/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/playground-ui/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export * from './ds/components/MainHeader';
6161
export * from './ds/components/Sections';
6262

6363
// DS Components - Migrated Complex Elements
64-
export * from './ds/components/CombinedButtons';
6564
export * from './ds/components/DateTimePicker';
6665
export * from './ds/components/EntryList';
6766
export * from './ds/components/FormFields';

packages/playground/src/domains/experiments/components/experiment-trace-timeline-tools.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { LightSpanRecord } from '@mastra/core/storage';
2-
import { Button, CombinedButtons, SearchFieldBlock, Icon } from '@mastra/playground-ui';
2+
import { Button, ButtonsGroup, SearchFieldBlock, Icon } from '@mastra/playground-ui';
33
import { XIcon, CircleDashedIcon } from 'lucide-react';
44
import { Fragment, useEffect, useState } from 'react';
55
import { useThrottledCallback } from 'use-debounce';
@@ -66,7 +66,7 @@ export function ExperimentTraceTimelineTools({
6666
onReset={() => setLocalSearchPhrase('')}
6767
/>
6868
</div>
69-
<CombinedButtons>
69+
<ButtonsGroup spacing="close">
7070
{usedSpanTypes.map(item => {
7171
const spanUI = getExperimentSpanTypeUi(item);
7272
const isFaded = fadedTypes?.includes(item);
@@ -100,7 +100,7 @@ export function ExperimentTraceTimelineTools({
100100
<XIcon />
101101
</Icon>
102102
</Button>
103-
</CombinedButtons>
103+
</ButtonsGroup>
104104
</div>
105105
);
106106
}

packages/playground/src/domains/observability/components/trace-timeline-tools.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { LightSpanRecord } from '@mastra/core/storage';
2-
import { Button, CombinedButtons, SearchFieldBlock, Icon } from '@mastra/playground-ui';
2+
import { Button, ButtonsGroup, SearchFieldBlock, Icon } from '@mastra/playground-ui';
33
import { XIcon, CircleDashedIcon } from 'lucide-react';
44
import { Fragment, useEffect, useState } from 'react';
55
import { useThrottledCallback } from 'use-debounce';
@@ -66,7 +66,7 @@ export function TraceTimelineTools({
6666
onReset={() => setLocalSearchPhrase('')}
6767
/>
6868
</div>
69-
<CombinedButtons>
69+
<ButtonsGroup spacing="close">
7070
{usedSpanTypes.map(item => {
7171
const spanUI = getSpanTypeUi(item);
7272
const isFaded = fadedTypes?.includes(item);
@@ -101,7 +101,7 @@ export function TraceTimelineTools({
101101
<XIcon />
102102
</Icon>
103103
</Button>
104-
</CombinedButtons>
104+
</ButtonsGroup>
105105
</div>
106106
);
107107
}

0 commit comments

Comments
 (0)