Skip to content

Commit 410a575

Browse files
committed
Wire donut selection feedback + unexport FeedbackBucketKey
Two more bugbot findings on the Usage strip. - Donuts now render selected slices with a darker stroke (3px vs 2px) and unselected slices at 50% opacity when any slice is selected — matching the bar/stacked cards' "dim only when something is active" pattern. `UsageInsightsStrip` maps `deviceKind` and `language` chips onto the donut data via the existing `isDimSelected` helper. - `FeedbackBucketKey` is only used inside `UsageStackedBarCard.tsx` (via the `onSegmentClick` prop signature); drop the export and make it local. https://claude.ai/code/session_01LEZrzpRouYiybD1thXkGh5
1 parent 734eeb6 commit 410a575

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

mcpjam-inspector/client/src/components/shared/usage-insights/UsageDonutPairCard.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ function Donut({
4444
onClick?: (datum: BarDatum) => void;
4545
}) {
4646
const hasData = data.length > 0 && data.some((d) => d.count > 0);
47+
// Same "only dim when something is selected" semantics as UsageBarCard so
48+
// donuts stay at full opacity with nothing active and visually highlight
49+
// the selected slice(s) otherwise.
50+
const hasSelection = data.some((d) => d.isSelected);
4751

4852
if (!hasData) {
4953
return (
@@ -76,7 +80,11 @@ function Donut({
7680
<Cell
7781
key={entry.key}
7882
fill={PALETTE[index % PALETTE.length]}
79-
stroke="var(--background)"
83+
stroke={
84+
entry.isSelected ? "var(--foreground)" : "var(--background)"
85+
}
86+
strokeWidth={entry.isSelected ? 3 : 2}
87+
opacity={!hasSelection || entry.isSelected ? 1 : 0.5}
8088
/>
8189
))}
8290
</Pie>

mcpjam-inspector/client/src/components/shared/usage-insights/UsageInsightsStrip.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,15 @@ export function UsageInsightsStrip({
253253
<UsageDonutPairCard
254254
title="Device & language"
255255
leftLabel="Device"
256-
leftData={devices}
256+
leftData={devices.map((d) => ({
257+
...d,
258+
isSelected: isDimSelected("deviceKind", d.key),
259+
}))}
257260
rightLabel="Language"
258-
rightData={languages}
261+
rightData={languages.map((l) => ({
262+
...l,
263+
isSelected: isDimSelected("language", l.key),
264+
}))}
259265
onLeftSliceClick={(datum) =>
260266
onToggleChip({
261267
kind: "dimension",

mcpjam-inspector/client/src/components/shared/usage-insights/UsageStackedBarCard.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import {
1212
type ChartConfig,
1313
} from "@/components/ui/chart";
1414

15-
export type FeedbackBucketKey = "positive" | "neutral" | "negative" | "none";
15+
// Local helper — every consumer goes through the `onSegmentClick` prop
16+
// signature, so nothing outside this file imports the union directly.
17+
type FeedbackBucketKey = "positive" | "neutral" | "negative" | "none";
1618

1719
export type StackedDatum = {
1820
key: string;

0 commit comments

Comments
 (0)