Skip to content

Commit 7ac533b

Browse files
committed
fix: stuff
1 parent 1fbc62d commit 7ac533b

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

apps/dashboard/app/(main)/billing/cost-breakdown/components/consumption-chart.tsx

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,20 @@ export function ConsumptionChart({ usageData, isLoading, onDateRangeChange, over
186186
Daily
187187
</Button>
188188
</div>
189+
<Button
190+
variant="outline"
191+
size="sm"
192+
onClick={() => {
193+
const allHidden = Object.keys(EVENT_TYPE_COLORS).reduce((acc, key) => {
194+
acc[key] = true;
195+
return acc;
196+
}, {} as Record<string, boolean>);
197+
setHiddenTypes(allHidden);
198+
}}
199+
className="text-xs"
200+
>
201+
Select None
202+
</Button>
189203
</div>
190204
</div>
191205
</div>
@@ -293,11 +307,21 @@ export function ConsumptionChart({ usageData, isLoading, onDateRangeChange, over
293307
wrapperStyle={{ outline: 'none' }}
294308
/>
295309
<Legend
296-
formatter={(value) => (
297-
<span className="text-xs font-medium text-muted-foreground capitalize">
298-
{value.replace('_', ' ')}
299-
</span>
300-
)}
310+
formatter={(value) => {
311+
const key = String(value);
312+
const isHidden = hiddenTypes[key];
313+
return (
314+
<span
315+
className={`inline-flex items-center text-xs font-medium capitalize transition-all duration-200 select-none leading-none ${
316+
isHidden
317+
? 'opacity-40 text-slate-600 line-through decoration-1'
318+
: 'opacity-100 text-muted-foreground'
319+
}`}
320+
>
321+
{key.replace('_', ' ')}
322+
</span>
323+
);
324+
}}
301325
iconSize={10}
302326
iconType="circle"
303327
onClick={(payload) => {
@@ -307,7 +331,13 @@ export function ConsumptionChart({ usageData, isLoading, onDateRangeChange, over
307331
const key = String(raw);
308332
setHiddenTypes((prev) => ({ ...prev, [key]: !prev[key] }));
309333
}}
334+
align="center"
335+
verticalAlign="bottom"
336+
layout="horizontal"
310337
wrapperStyle={{
338+
display: 'flex',
339+
justifyContent: 'center',
340+
gap: 12,
311341
fontSize: '12px',
312342
paddingTop: '20px',
313343
fontWeight: 500,

0 commit comments

Comments
 (0)