Skip to content

Commit d53f974

Browse files
committed
fix(dashboard): show unlimited template limits clearly
1 parent c4877a3 commit d53f974

5 files changed

Lines changed: 28 additions & 6 deletions

File tree

dashboard/public/statics/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"dashboard": "Dashboard",
44
"master": "Overall",
55
"dashboardDescription": "PasarGuard Management Dashboard",
6+
"default": "Default",
7+
"unlimited": "Unlimited",
68
"active": "active",
79
"online": "Online",
810
"platform": "Platform",

dashboard/public/statics/locales/fa.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"dashboard": "داشبورد",
44
"master": "کلی",
55
"dashboardDescription": "داشبورد مدیریت پاسارگارد",
6+
"default": "پیش‌فرض",
7+
"unlimited": "نامحدود",
68
"active": "فعال",
79
"online": "آنلاین",
810
"platform": "پلتفرم",

dashboard/public/statics/locales/ru.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"dashboard": "Панель управления",
44
"master": "Общее",
55
"dashboardDescription": "Панель управления PasarGuard",
6+
"default": "По умолчанию",
7+
"unlimited": "Без ограничений",
68
"active": "активный",
79
"online": "В сети",
810
"platform": "Платформа",

dashboard/public/statics/locales/zh.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"dashboard": "仪表板",
55
"master": "总体",
66
"dashboardDescription": "PasarGuard 管理仪表板",
7+
"default": "默认",
8+
"unlimited": "无限制",
79
"allStatuses": "所有状态",
810
"status": "状态",
911
"statistics": "统计",

dashboard/src/pages/_dashboard.bulk.create.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ import {
3232
Copy,
3333
ArrowLeft,
3434
QrCode,
35-
Check
35+
Check,
36+
Infinity
3637
} from 'lucide-react'
3738
import { cn } from '@/lib/utils'
3839
import { Badge } from '@/components/ui/badge'
@@ -55,7 +56,7 @@ const getPreviewRandomHex = (index: number, count: number) => {
5556
}
5657

5758
export default function BulkCreateUsersPage() {
58-
const { t, i18n } = useTranslation()
59+
const { t } = useTranslation()
5960
const navigate = useNavigate()
6061
const dir = useDirDetection()
6162
const isRTL = dir === 'rtl'
@@ -81,6 +82,7 @@ export default function BulkCreateUsersPage() {
8182

8283
const templates = templatesData || []
8384
const selectedTemplate = templates.find(t => t.id === selectedTemplateId)
85+
const unlimitedLabel = t('unlimited', { defaultValue: 'Unlimited' })
8486

8587
useEffect(() => {
8688
if (templates.length > 0 && !selectedTemplateId) {
@@ -435,7 +437,13 @@ export default function BulkCreateUsersPage() {
435437
{selectedTemplate.data_limit !== null && selectedTemplate.data_limit !== undefined && (
436438
<div className="flex items-center justify-between">
437439
<span className="text-muted-foreground">{t('userDialog.dataLimit')}:</span>
438-
<span className="font-medium" dir="ltr">{formatBytes(selectedTemplate.data_limit)}</span>
440+
<span className="font-medium" dir="ltr">
441+
{selectedTemplate.data_limit === 0 ? (
442+
<Infinity className="inline h-4 w-4" aria-label={unlimitedLabel} />
443+
) : (
444+
formatBytes(selectedTemplate.data_limit)
445+
)}
446+
</span>
439447
</div>
440448
)}
441449
{selectedTemplate.hwid_limit !== undefined && (
@@ -445,22 +453,28 @@ export default function BulkCreateUsersPage() {
445453
{selectedTemplate.hwid_limit === null
446454
? t('default', { defaultValue: 'Default' })
447455
: selectedTemplate.hwid_limit === 0
448-
? t('unlimited', { defaultValue: 'Unlimited' })
456+
? <Infinity className="inline h-4 w-4" aria-label={unlimitedLabel} />
449457
: selectedTemplate.hwid_limit}
450458
</span>
451459
</div>
452460
)}
453461
{selectedTemplate.expire_duration !== null && selectedTemplate.expire_duration !== undefined && (
454462
<div className="flex items-center justify-between">
455463
<span className="text-muted-foreground">{t('expire')}:</span>
456-
<span className="font-medium">{Math.floor(selectedTemplate.expire_duration / 86400)}{t('dateInfo.day')}</span>
464+
<span className="font-medium">
465+
{selectedTemplate.expire_duration === 0 ? (
466+
<Infinity className="inline h-4 w-4" aria-label={unlimitedLabel} />
467+
) : (
468+
`${Math.floor(selectedTemplate.expire_duration / 86400)}${t('dateInfo.day')}`
469+
)}
470+
</span>
457471
</div>
458472
)}
459473
{selectedTemplate.group_ids && selectedTemplate.group_ids.length > 0 && (
460474
<div className="flex items-center justify-between">
461475
<span className="text-muted-foreground">{t('groups')}:</span>
462476
<span className="font-medium">
463-
{selectedTemplate.group_ids.length} {i18n.language === 'fa' ? 'گروه' : t('groups')}
477+
{t('bulk.groupsCount', { count: selectedTemplate.group_ids.length, defaultValue: '{{count}} groups' })}
464478
</span>
465479
</div>
466480
)}

0 commit comments

Comments
 (0)