🐛 fix:: Update localization files and improve display logic for inventory handling

This commit is contained in:
web@ppanel 2025-12-29 08:08:31 +00:00
parent 2316609c82
commit 83d821a2dc
6 changed files with 4 additions and 9 deletions

View File

@ -63,5 +63,5 @@
"system": "System",
"toggle": "Toggle theme"
},
"unlimited": "unlimited"
"unlimited": "Unlimited"
}

View File

@ -30,7 +30,6 @@
"discountPercent": "Discount Percentage",
"Hour": "Hour",
"inventory": "Subscription Limit",
"inventoryDescription": "Set to -1 for unlimited inventory",
"unlimitedInventory": "Unlimited (enter -1)",
"language": "Language",
"languageDescription": "Leave empty for default without language restriction",

View File

@ -30,7 +30,6 @@
"discountPercent": "折扣百分比",
"Hour": "小时",
"inventory": "订阅库存",
"inventoryDescription": "设置为 -1 表示不限制库存",
"unlimitedInventory": "无限制(输入 -1",
"language": "语言",
"languageDescription": "留空为默认无语言限制",

View File

@ -28,7 +28,7 @@ export function Display<T extends number | undefined | null>({
if (
["traffic", "trafficSpeed", "number"].includes(type) &&
unlimited &&
!value
(value === 0 || value === null || value === undefined)
) {
return t("unlimited");
}
@ -42,7 +42,7 @@ export function Display<T extends number | undefined | null>({
}
if (type === "number") {
return value ? value.toString() : "0";
return value !== null && value !== undefined ? value.toString() : "0";
}
return "0";

View File

@ -454,9 +454,6 @@ export default function SubscribeForm<T extends Record<string, any>>({
value={field.value}
/>
</FormControl>
<FormDescription>
{t("form.inventoryDescription")}
</FormDescription>
<FormMessage />
</FormItem>
)}

View File

@ -78,7 +78,7 @@ const DurationSelector: React.FC<DurationSelectorProps> = ({
</span>
{discountPercentage > 0 ? (
<Badge className="h-6 text-sm" variant="destructive">
-{discountPercentage}% {t("discount", "Discount")}
-{discountPercentage.toFixed(2)}% {t("discount", "Discount")}
</Badge>
) : (
<span className="h-6 text-muted-foreground text-sm">--</span>