feat(i18n): 更新英文、尼泊尔语与中文的注单状态翻译
修改多语言配置文件,将 success 统一替换为 placed,并新增 partial_failed 与 refunded 状态,以提升注单管理中的状态表达清晰度。 增强国际化支持,确保多语言间术语一致性,进一步优化后台管理界面的用户体验。
This commit is contained in:
@@ -237,209 +237,270 @@ export function JackpotPoolsConsole({ embedded = false }: JackpotPoolsConsolePro
|
||||
const d = drafts[p.id] ?? toDraft(p);
|
||||
const adj = adjustmentDrafts[p.id] ?? { direction: "increase", amount: "", reason: "" };
|
||||
const ledger = adjustmentRows[p.id] ?? [];
|
||||
const currentAmount = formatAdminMinorDecimal(p.current_amount, p.currency_code);
|
||||
const triggerThreshold = formatAdminMinorDecimal(p.trigger_threshold, p.currency_code);
|
||||
const minBetAmount = formatAdminMinorDecimal(p.min_bet_amount, p.currency_code);
|
||||
const statusOn = d.status === "1";
|
||||
return (
|
||||
<div
|
||||
key={p.id}
|
||||
className="space-y-4 rounded-xl border border-border/60 bg-muted/10 p-4"
|
||||
className="space-y-3 rounded-xl border border-border/60 bg-background p-3 shadow-sm"
|
||||
>
|
||||
<div className="flex flex-wrap items-baseline justify-between gap-2">
|
||||
<h3 className="font-mono text-sm font-semibold">{p.currency_code}</h3>
|
||||
<p className="text-muted-foreground font-mono text-xs">
|
||||
{t("displayBalance", {
|
||||
amount: formatAdminMinorDecimal(p.current_amount, p.currency_code),
|
||||
})}
|
||||
</p>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<div>
|
||||
<h3 className="font-mono text-sm font-semibold">{p.currency_code}</h3>
|
||||
<p className="text-muted-foreground text-xs">{t("configTitle")}</p>
|
||||
</div>
|
||||
<p className="text-muted-foreground font-mono text-xs">{t("displayBalance", { amount: currentAmount })}</p>
|
||||
</div>
|
||||
{canManageJackpot ? (
|
||||
<div className="space-y-3 rounded-lg border border-border/60 bg-background/60 p-4">
|
||||
<p className="text-sm font-medium">{t("balanceAdjustmentTitle")}</p>
|
||||
<p className="text-muted-foreground text-xs">{t("balanceAdjustmentHint")}</p>
|
||||
<div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<div className="space-y-1.5">
|
||||
<Label>{t("adjustmentDirection")}</Label>
|
||||
<Select
|
||||
value={adj.direction}
|
||||
onValueChange={(value: "increase" | "decrease") =>
|
||||
updateAdjustmentDraft(p.id, { direction: value })
|
||||
}
|
||||
>
|
||||
<SelectTrigger className="font-mono">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="increase">{t("adjustmentIncrease")}</SelectItem>
|
||||
<SelectItem value="decrease">{t("adjustmentDecrease")}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<div className="grid gap-2 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<div className="rounded-lg border border-border/60 bg-muted/20 p-2.5">
|
||||
<p className="text-muted-foreground text-xs">{t("currentAmount")}</p>
|
||||
<p className="mt-0.5 font-mono text-base font-semibold">{currentAmount}</p>
|
||||
</div>
|
||||
<div className="rounded-lg border border-border/60 bg-muted/20 p-2.5">
|
||||
<p className="text-muted-foreground text-xs">{t("status")}</p>
|
||||
<p className="mt-0.5 text-base font-semibold">
|
||||
{statusOn ? t("enabled") : t("disabled")}
|
||||
</p>
|
||||
</div>
|
||||
<div className="rounded-lg border border-border/60 bg-muted/20 p-2.5">
|
||||
<p className="text-muted-foreground text-xs">{t("payoutRate")}</p>
|
||||
<p className="mt-0.5 font-mono text-base font-semibold">{d.payout_rate}</p>
|
||||
</div>
|
||||
<div className="rounded-lg border border-border/60 bg-muted/20 p-2.5">
|
||||
<p className="text-muted-foreground text-xs">{t("forceTriggerGap")}</p>
|
||||
<p className="mt-0.5 font-mono text-base font-semibold">{d.force_trigger_draw_gap}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-3 xl:grid-cols-12">
|
||||
<div className="space-y-3 xl:col-span-8">
|
||||
{canManageJackpot ? (
|
||||
<div className="space-y-2 rounded-lg border border-border/60 bg-background p-3">
|
||||
<p className="text-sm font-medium">{t("balanceAdjustmentTitle")}</p>
|
||||
<p className="text-muted-foreground text-xs">{t("balanceAdjustmentHint")}</p>
|
||||
<div className="grid gap-2 sm:grid-cols-2">
|
||||
<div className="space-y-1.5">
|
||||
<Label>{t("adjustmentDirection")}</Label>
|
||||
<Select
|
||||
value={adj.direction}
|
||||
onValueChange={(value: "increase" | "decrease") =>
|
||||
updateAdjustmentDraft(p.id, { direction: value })
|
||||
}
|
||||
>
|
||||
<SelectTrigger className="w-full min-w-0 sm:max-w-[12rem]">
|
||||
<SelectValue>
|
||||
{(value) =>
|
||||
value === "increase"
|
||||
? t("adjustmentIncrease")
|
||||
: value === "decrease"
|
||||
? t("adjustmentDecrease")
|
||||
: value != null
|
||||
? String(value)
|
||||
: t("adjustmentIncrease")
|
||||
}
|
||||
</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="increase">{t("adjustmentIncrease")}</SelectItem>
|
||||
<SelectItem value="decrease">{t("adjustmentDecrease")}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`adj-amt-${p.id}`}>{t("adjustmentAmount")}</Label>
|
||||
<Input
|
||||
id={`adj-amt-${p.id}`}
|
||||
className="font-mono"
|
||||
value={adj.amount}
|
||||
onChange={(e) => updateAdjustmentDraft(p.id, { amount: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5 sm:col-span-2">
|
||||
<Label htmlFor={`adj-reason-${p.id}`}>{t("adjustmentReason")}</Label>
|
||||
<Textarea
|
||||
id={`adj-reason-${p.id}`}
|
||||
rows={1}
|
||||
value={adj.reason}
|
||||
onChange={(e) => updateAdjustmentDraft(p.id, { reason: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
disabled={adjustingId === p.id}
|
||||
onClick={() =>
|
||||
requestConfirm({
|
||||
title: t("confirmAdjustmentTitle"),
|
||||
description: t("confirmAdjustmentDescription"),
|
||||
confirmLabel: t("confirm.confirmSave", { ns: "common" }),
|
||||
onConfirm: () => submitAdjustment(p),
|
||||
})
|
||||
}
|
||||
>
|
||||
{adjustingId === p.id ? t("processing") : t("submitAdjustment")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<fieldset
|
||||
disabled={!canManageJackpot}
|
||||
className="grid gap-2 rounded-lg border border-border/60 bg-background p-3 sm:grid-cols-2"
|
||||
>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`adj-amt-${p.id}`}>{t("adjustmentAmount")}</Label>
|
||||
<Label htmlFor={`th-${p.id}`}>{t("triggerThreshold")}</Label>
|
||||
<Input
|
||||
id={`adj-amt-${p.id}`}
|
||||
id={`th-${p.id}`}
|
||||
className="font-mono"
|
||||
value={adj.amount}
|
||||
onChange={(e) => updateAdjustmentDraft(p.id, { amount: e.target.value })}
|
||||
value={d.trigger_threshold}
|
||||
onChange={(e) => updateDraft(p.id, { trigger_threshold: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5 sm:col-span-2 xl:col-span-2">
|
||||
<Label htmlFor={`adj-reason-${p.id}`}>{t("adjustmentReason")}</Label>
|
||||
<Textarea
|
||||
id={`adj-reason-${p.id}`}
|
||||
rows={2}
|
||||
value={adj.reason}
|
||||
onChange={(e) => updateAdjustmentDraft(p.id, { reason: e.target.value })}
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`min-${p.id}`}>{t("minBetAmount")}</Label>
|
||||
<Input
|
||||
id={`min-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.min_bet_amount}
|
||||
onChange={(e) => updateDraft(p.id, { min_bet_amount: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
disabled={adjustingId === p.id}
|
||||
onClick={() =>
|
||||
requestConfirm({
|
||||
title: t("confirmAdjustmentTitle"),
|
||||
description: t("confirmAdjustmentDescription"),
|
||||
confirmLabel: t("confirm.confirmSave", { ns: "common" }),
|
||||
onConfirm: () => submitAdjustment(p),
|
||||
})
|
||||
}
|
||||
>
|
||||
{adjustingId === p.id ? t("processing") : t("submitAdjustment")}
|
||||
</Button>
|
||||
</div>
|
||||
{ledger.length > 0 ? (
|
||||
<div className="space-y-2 border-t border-border/60 pt-3">
|
||||
<p className="text-xs font-medium">{t("recentAdjustments")}</p>
|
||||
<ul className="text-muted-foreground space-y-1 font-mono text-xs">
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`pr-${p.id}`}>{t("payoutRate")}</Label>
|
||||
<Input
|
||||
id={`pr-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.payout_rate}
|
||||
onChange={(e) => updateDraft(p.id, { payout_rate: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`gap-${p.id}`}>{t("forceTriggerGap")}</Label>
|
||||
<Input
|
||||
id={`gap-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.force_trigger_draw_gap}
|
||||
onChange={(e) => updateDraft(p.id, { force_trigger_draw_gap: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`cr-${p.id}`}>{t("contributionRate")}</Label>
|
||||
<Input
|
||||
id={`cr-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.contribution_rate}
|
||||
onChange={(e) => updateDraft(p.id, { contribution_rate: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`combo-${p.id}`}>{t("comboTriggerPlays")}</Label>
|
||||
<Input
|
||||
id={`combo-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.combo_trigger_play_codes}
|
||||
placeholder="straight,ibox"
|
||||
onChange={(e) => updateDraft(p.id, { combo_trigger_play_codes: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2 sm:col-span-2">
|
||||
<Label htmlFor={`status-${p.id}`} className="text-sm font-medium">
|
||||
{t("status")}
|
||||
</Label>
|
||||
<Switch
|
||||
id={`status-${p.id}`}
|
||||
checked={statusOn}
|
||||
disabled={!canManageJackpot}
|
||||
aria-label={t("status")}
|
||||
onCheckedChange={(checked) =>
|
||||
updateDraft(p.id, { status: checked ? "1" : "0" })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
{canManageJackpot ? (
|
||||
<div className="flex justify-end sm:col-span-2">
|
||||
<Button
|
||||
type="button"
|
||||
disabled={savingId === p.id}
|
||||
onClick={() =>
|
||||
requestConfirm({
|
||||
title: t("confirmSavePoolTitle"),
|
||||
description: t("confirmSavePoolDescription"),
|
||||
confirmLabel: t("confirm.confirmSave", { ns: "common" }),
|
||||
onConfirm: () => save(p),
|
||||
})
|
||||
}
|
||||
>
|
||||
{savingId === p.id ? t("saving") : t("save")}
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3 xl:col-span-4">
|
||||
<div className="rounded-lg border border-border/60 bg-background p-3">
|
||||
<div className="mb-2 flex items-center justify-between gap-2">
|
||||
<p className="text-sm font-medium">{t("recentAdjustments")}</p>
|
||||
<span className="text-muted-foreground text-xs">{ledger.length}</span>
|
||||
</div>
|
||||
{ledger.length > 0 ? (
|
||||
<ul className="max-h-60 space-y-2 overflow-y-auto pr-1">
|
||||
{ledger.map((row) => (
|
||||
<li key={row.id}>
|
||||
{row.adjustment_no} · {row.amount_delta > 0 ? "+" : ""}
|
||||
{formatAdminMinorDecimal(row.amount_delta, p.currency_code)} ·{" "}
|
||||
{row.reason}
|
||||
<li key={row.id} className="rounded-md border border-border/60 bg-muted/20 p-2">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<span className="font-mono text-xs">{row.adjustment_no}</span>
|
||||
<span className="font-mono text-xs">
|
||||
{row.amount_delta > 0 ? "+" : ""}
|
||||
{formatAdminMinorDecimal(row.amount_delta, p.currency_code)}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-muted-foreground mt-1 line-clamp-2 text-xs">{row.reason}</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
<fieldset disabled={!canManageJackpot} className="grid gap-4 border-0 p-0 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`cr-${p.id}`}>{t("contributionRate")}</Label>
|
||||
<Input
|
||||
id={`cr-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.contribution_rate}
|
||||
onChange={(e) => updateDraft(p.id, { contribution_rate: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`th-${p.id}`}>{t("triggerThreshold")}</Label>
|
||||
<Input
|
||||
id={`th-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.trigger_threshold}
|
||||
onChange={(e) => updateDraft(p.id, { trigger_threshold: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`pr-${p.id}`}>{t("payoutRate")}</Label>
|
||||
<Input
|
||||
id={`pr-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.payout_rate}
|
||||
onChange={(e) => updateDraft(p.id, { payout_rate: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`gap-${p.id}`}>{t("forceTriggerGap")}</Label>
|
||||
<Input
|
||||
id={`gap-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.force_trigger_draw_gap}
|
||||
onChange={(e) => updateDraft(p.id, { force_trigger_draw_gap: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`min-${p.id}`}>{t("minBetAmount")}</Label>
|
||||
<Input
|
||||
id={`min-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.min_bet_amount}
|
||||
onChange={(e) => updateDraft(p.id, { min_bet_amount: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor={`combo-${p.id}`}>{t("comboTriggerPlays")}</Label>
|
||||
<Input
|
||||
id={`combo-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.combo_trigger_play_codes}
|
||||
placeholder="straight,ibox"
|
||||
onChange={(e) => updateDraft(p.id, { combo_trigger_play_codes: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5">
|
||||
<Label htmlFor={`status-${p.id}`} className="text-sm font-medium">
|
||||
{t("status")}
|
||||
</Label>
|
||||
<Switch
|
||||
id={`status-${p.id}`}
|
||||
checked={d.status === "1"}
|
||||
disabled={!canManageJackpot}
|
||||
aria-label={t("status")}
|
||||
onCheckedChange={(checked) =>
|
||||
updateDraft(p.id, { status: checked ? "1" : "0" })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
{canManageJackpot ? (
|
||||
<div className="flex justify-end border-t border-border/60 pt-3">
|
||||
<Button
|
||||
type="button"
|
||||
disabled={savingId === p.id}
|
||||
onClick={() =>
|
||||
requestConfirm({
|
||||
title: t("confirmSavePoolTitle"),
|
||||
description: t("confirmSavePoolDescription"),
|
||||
confirmLabel: t("confirm.confirmSave", { ns: "common" }),
|
||||
onConfirm: () => save(p),
|
||||
})
|
||||
}
|
||||
>
|
||||
{savingId === p.id ? t("saving") : t("save")}
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
{canManualBurst ? (
|
||||
<div className="rounded-lg border border-amber-200/80 bg-amber-50/80 p-4 dark:border-amber-900/50 dark:bg-amber-950/30">
|
||||
<p className="mb-1 text-xs font-medium text-amber-900 dark:text-amber-200">
|
||||
{t("manualBurst")}
|
||||
</p>
|
||||
<p className="mb-3 text-xs text-amber-800/90 dark:text-amber-300/90">{t("manualBurstHint")}</p>
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end">
|
||||
<div className="min-w-0 flex-1 space-y-1.5 sm:max-w-xs">
|
||||
<Label htmlFor={`burst-draw-${p.id}`}>{t("manualBurstDrawId")}</Label>
|
||||
<Input
|
||||
id={`burst-draw-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.manual_burst_draw_id}
|
||||
onChange={(e) => updateDraft(p.id, { manual_burst_draw_id: e.target.value })}
|
||||
/>
|
||||
) : (
|
||||
<p className="text-muted-foreground text-xs">—</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="rounded-lg border border-border/60 bg-background p-3">
|
||||
<p className="text-muted-foreground text-xs">{t("triggerThreshold")}</p>
|
||||
<p className="mt-0.5 font-mono text-sm">{triggerThreshold}</p>
|
||||
<p className="text-muted-foreground mt-2 text-xs">{t("minBetAmount")}</p>
|
||||
<p className="mt-0.5 font-mono text-sm">{minBetAmount}</p>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
variant="destructive"
|
||||
className="shrink-0 sm:ml-auto"
|
||||
disabled={burstingId === p.id}
|
||||
onClick={() => setConfirmBurstPoolId(p.id)}
|
||||
>
|
||||
{burstingId === p.id ? t("processing") : t("manualBurst")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{canManualBurst ? (
|
||||
<div className="rounded-lg border border-destructive/30 bg-destructive/5 p-3">
|
||||
<p className="mb-1 text-sm font-medium text-destructive">{t("manualBurst")}</p>
|
||||
<p className="mb-2 text-xs text-muted-foreground">{t("manualBurstHint")}</p>
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-end">
|
||||
<div className="min-w-0 flex-1 space-y-1.5 sm:max-w-xs">
|
||||
<Label htmlFor={`burst-draw-${p.id}`}>{t("manualBurstDrawId")}</Label>
|
||||
<Input
|
||||
id={`burst-draw-${p.id}`}
|
||||
className="font-mono"
|
||||
value={d.manual_burst_draw_id}
|
||||
onChange={(e) => updateDraft(p.id, { manual_burst_draw_id: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
variant="destructive"
|
||||
className="shrink-0 sm:ml-auto"
|
||||
disabled={burstingId === p.id}
|
||||
onClick={() => setConfirmBurstPoolId(p.id)}
|
||||
>
|
||||
{burstingId === p.id ? t("processing") : t("manualBurst")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user