Skip to content

Commit e0f4b56

Browse files
committed
fix: show translated text for Total admin selection
1 parent 7576ece commit e0f4b56

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

build_dashboard.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/bash
2-
2+
set -e
33
cd "$(dirname "$0")/dashboard"
44
VITE_BASE_API=/ bun run build
55
cp ./build/index.html ./build/404.html

dashboard/src/components/admins/filters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function Filters<T extends BaseFilters>({ filters, onFilterChange }: Filt
7171
</div>
7272
{/* Refresh Button */}
7373
<div className="flex items-center gap-2 h-full">
74-
<Button size="icon-md" onClick={() => refetch()} variant="ghost" className="flex items-center gap-2 border bg-input">
74+
<Button size="icon-md" onClick={() => refetch()} variant="ghost" className="flex items-center gap-2 border">
7575
<RefreshCw className="w-4 h-4" />
7676
</Button>
7777
</div>

dashboard/src/components/dashboard/admin-statistics-card.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import { AdminDetails, SystemStats, useGetSystemStats } from '@/service/api'
22
import { UserCircleIcon } from 'lucide-react'
3+
import { useTranslation } from 'react-i18next'
34
import UserStatisticsCard from './users-statistics-card'
45
import DataUsageChart from './data-usage-chart'
56

67
const AdminStatisticsCard = ({
78
admin,
89
systemStats,
910
showAdminInfo = true,
10-
currentAdmin
1111
}: {
1212
admin: AdminDetails | undefined;
1313
systemStats: SystemStats | undefined;
1414
showAdminInfo?: boolean;
1515
currentAdmin?: AdminDetails | undefined;
1616
}) => {
17+
const { t } = useTranslation()
1718
if (!admin) return null
1819

1920
// Send admin_username for specific admin stats, except for 'Total' which shows global stats
@@ -43,7 +44,9 @@ const AdminStatisticsCard = ({
4344
<div className="flex flex-row items-center justify-between">
4445
<div className="flex flex-row items-center gap-2">
4546
<UserCircleIcon className="size-7 text-muted-foreground" />
46-
<span className="text-xl font-bold">{admin.username}</span>
47+
<span className="text-xl font-bold">
48+
{admin.username === 'Total' ? t('admins.total') : admin.username}
49+
</span>
4750
</div>
4851
</div>
4952
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">

dashboard/src/pages/_dashboard._index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,9 @@ const Dashboard = () => {
379379
{selectedAdmin?.username === 'Total' ? <Sigma className="h-3 w-3" /> : selectedAdmin?.username?.charAt(0).toUpperCase() || '?'}
380380
</AvatarFallback>
381381
</Avatar>
382-
<span className="truncate text-xs sm:text-sm">{selectedAdmin?.username || t('advanceSearch.selectAdmin')}</span>
382+
<span className="truncate text-xs sm:text-sm">
383+
{selectedAdmin?.username === 'Total' ? t('admins.total') : selectedAdmin?.username || t('advanceSearch.selectAdmin')}
384+
</span>
383385
{selectedAdmin && selectedAdmin.username !== 'Total' && (
384386
<div className="flex-shrink-0">{selectedAdmin.is_sudo ? <UserCog className="h-3 w-3 text-primary" /> : <UserRound className="h-3 w-3 text-primary" />}</div>
385387
)}
@@ -407,7 +409,7 @@ const Dashboard = () => {
407409
<Sigma className="h-3 w-3" />
408410
</AvatarFallback>
409411
</Avatar>
410-
<span className="flex-1 truncate">Total</span>
412+
<span className="flex-1 truncate">{t('admins.total')}</span>
411413
<div className="flex flex-shrink-0 items-center gap-1">{selectedAdmin?.username === 'Total' && <Check className="h-3 w-3 text-primary" />}</div>
412414
</CommandItem>
413415

0 commit comments

Comments
 (0)