🐛 fix:: Update localization files and improve display logic for inventory handling
This commit is contained in:
parent
2316609c82
commit
83d821a2dc
@ -63,5 +63,5 @@
|
|||||||
"system": "System",
|
"system": "System",
|
||||||
"toggle": "Toggle theme"
|
"toggle": "Toggle theme"
|
||||||
},
|
},
|
||||||
"unlimited": "unlimited"
|
"unlimited": "Unlimited"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,6 @@
|
|||||||
"discountPercent": "Discount Percentage",
|
"discountPercent": "Discount Percentage",
|
||||||
"Hour": "Hour",
|
"Hour": "Hour",
|
||||||
"inventory": "Subscription Limit",
|
"inventory": "Subscription Limit",
|
||||||
"inventoryDescription": "Set to -1 for unlimited inventory",
|
|
||||||
"unlimitedInventory": "Unlimited (enter -1)",
|
"unlimitedInventory": "Unlimited (enter -1)",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
"languageDescription": "Leave empty for default without language restriction",
|
"languageDescription": "Leave empty for default without language restriction",
|
||||||
|
|||||||
@ -30,7 +30,6 @@
|
|||||||
"discountPercent": "折扣百分比",
|
"discountPercent": "折扣百分比",
|
||||||
"Hour": "小时",
|
"Hour": "小时",
|
||||||
"inventory": "订阅库存",
|
"inventory": "订阅库存",
|
||||||
"inventoryDescription": "设置为 -1 表示不限制库存",
|
|
||||||
"unlimitedInventory": "无限制(输入 -1)",
|
"unlimitedInventory": "无限制(输入 -1)",
|
||||||
"language": "语言",
|
"language": "语言",
|
||||||
"languageDescription": "留空为默认无语言限制",
|
"languageDescription": "留空为默认无语言限制",
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export function Display<T extends number | undefined | null>({
|
|||||||
if (
|
if (
|
||||||
["traffic", "trafficSpeed", "number"].includes(type) &&
|
["traffic", "trafficSpeed", "number"].includes(type) &&
|
||||||
unlimited &&
|
unlimited &&
|
||||||
!value
|
(value === 0 || value === null || value === undefined)
|
||||||
) {
|
) {
|
||||||
return t("unlimited");
|
return t("unlimited");
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ export function Display<T extends number | undefined | null>({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (type === "number") {
|
if (type === "number") {
|
||||||
return value ? value.toString() : "0";
|
return value !== null && value !== undefined ? value.toString() : "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "0";
|
return "0";
|
||||||
|
|||||||
@ -454,9 +454,6 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
|||||||
value={field.value}
|
value={field.value}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormDescription>
|
|
||||||
{t("form.inventoryDescription")}
|
|
||||||
</FormDescription>
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ const DurationSelector: React.FC<DurationSelectorProps> = ({
|
|||||||
</span>
|
</span>
|
||||||
{discountPercentage > 0 ? (
|
{discountPercentage > 0 ? (
|
||||||
<Badge className="h-6 text-sm" variant="destructive">
|
<Badge className="h-6 text-sm" variant="destructive">
|
||||||
-{discountPercentage}% {t("discount", "Discount")}
|
-{discountPercentage.toFixed(2)}% {t("discount", "Discount")}
|
||||||
</Badge>
|
</Badge>
|
||||||
) : (
|
) : (
|
||||||
<span className="h-6 text-muted-foreground text-sm">--</span>
|
<span className="h-6 text-muted-foreground text-sm">--</span>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user