fix(frontend): 修复重构页面的遗漏问题

- 添加 en.ts 中缺失的 admin.redeem.types 翻译
- RedeemView 状态筛选器添加 expired 选项
- SubscriptionsView 用量进度条添加 null/undefined 兜底
- SubscriptionsView 添加 validity_days 表单校验
- GroupsView/ProxiesView 搜索图标添加 dark mode 样式
This commit is contained in:
ianshaw
2026-01-04 20:51:37 -08:00
parent 85f53ef2dd
commit ee29b9428b
6 changed files with 21 additions and 7 deletions

View File

@@ -877,6 +877,10 @@ const handleAssignSubscription = async () => {
appStore.showError(t('admin.subscriptions.pleaseSelectGroup'))
return
}
if (!assignForm.validity_days || assignForm.validity_days < 1) {
appStore.showError(t('admin.subscriptions.validityDaysRequired'))
return
}
submitting.value = true
try {
@@ -960,15 +964,17 @@ const isExpiringSoon = (expiresAt: string): boolean => {
return days !== null && days <= 7
}
const getProgressWidth = (used: number, limit: number | null): string => {
const getProgressWidth = (used: number | null | undefined, limit: number | null): string => {
if (!limit || limit === 0) return '0%'
const percentage = Math.min((used / limit) * 100, 100)
const usedValue = used ?? 0
const percentage = Math.min((usedValue / limit) * 100, 100)
return `${percentage}%`
}
const getProgressClass = (used: number, limit: number | null): string => {
const getProgressClass = (used: number | null | undefined, limit: number | null): string => {
if (!limit || limit === 0) return 'bg-gray-400'
const percentage = (used / limit) * 100
const usedValue = used ?? 0
const percentage = (usedValue / limit) * 100
if (percentage >= 90) return 'bg-red-500'
if (percentage >= 70) return 'bg-orange-500'
return 'bg-green-500'