Skip to content

Commit f96a934

Browse files
committed
fix(chart): correct tooltip for usage modal in single node
1 parent e16b34f commit f96a934

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

dashboard/src/components/dialogs/usage-modal.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState, useMemo, useRef, useEffect, useCallback } from 'react'
2-
import { Dialog, DialogContent } from '../ui/dialog'
2+
import { Dialog, DialogContent, DialogTitle, DialogDescription } from '../ui/dialog'
33
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '../ui/card'
44
import { ChartContainer, ChartTooltip, ChartConfig } from '../ui/chart'
55
import { PieChart, TrendingUp, Calendar, Info } from 'lucide-react'
@@ -222,15 +222,7 @@ function CustomBarTooltip({ active, payload, chartConfig, dir, period }: Tooltip
222222
</span>
223223
</div>
224224

225-
{isUserUsageData ? (
226-
// User usage data - show simple node label
227-
<div className={`flex flex-col gap-1`}>
228-
<div className={`flex items-center gap-1 text-[10px] text-muted-foreground ${isRTL ? 'flex-row-reverse' : 'flex-row'}`}>
229-
<div className="h-1.5 w-1.5 flex-shrink-0 rounded-full sm:h-2 sm:w-2" style={{ backgroundColor: 'hsl(var(--primary))' }} />
230-
<span className="max-w-[60px] overflow-hidden truncate text-ellipsis sm:max-w-[80px]">{t('statistics.allNodes', { defaultValue: 'All Nodes' })}</span>
231-
</div>
232-
</div>
233-
) : (
225+
{!isUserUsageData &&(
234226
// Node breakdown data
235227
<div className={`grid gap-1 sm:gap-1.5 ${nodesToShow.length > (isMobile ? 2 : 3) ? 'grid-cols-2' : 'grid-cols-1'}`}>
236228
{nodesToShow.map(node => (
@@ -242,7 +234,7 @@ function CustomBarTooltip({ active, payload, chartConfig, dir, period }: Tooltip
242234
</span>
243235
</span>
244236
<span className={`flex items-center gap-0.5 text-[9px] text-muted-foreground sm:text-[10px] ${isRTL ? 'flex-row-reverse' : 'flex-row'}`}>
245-
<span className="font-mono">{node.usage.toFixed(2)} GB</span>
237+
<span dir="ltr" className="font-mono">{node.usage.toFixed(2)} GB</span>
246238
</span>
247239
</div>
248240
))}
@@ -656,6 +648,10 @@ const UsageModal = ({ open, onClose, username }: UsageModalProps) => {
656648
return (
657649
<Dialog open={open} onOpenChange={onClose}>
658650
<DialogContent className="max-w-2xl p-0.5">
651+
<DialogTitle className="sr-only">{t('usersTable.usageChart', { defaultValue: 'Usage Chart' })}</DialogTitle>
652+
<DialogDescription className="sr-only">
653+
Showing total usage for the selected period
654+
</DialogDescription>
659655
<Card className="w-full border-none shadow-none">
660656
<CardHeader className="pb-2">
661657
<CardTitle className="text-center text-lg sm:text-xl">{t('usersTable.usageChart', { defaultValue: 'Usage Chart' })}</CardTitle>

0 commit comments

Comments
 (0)