refactor: 重构奖池配置页面,移除冗余组件,优化加载体验与国际化支持

This commit is contained in:
2026-05-21 16:46:48 +08:00
parent 3ce84af39c
commit 26feed3c4f
29 changed files with 393 additions and 213 deletions

View File

@@ -15,7 +15,7 @@ import {
import { AdminDateRangeField } from "@/components/admin/admin-date-range-field";
import { AdminListPaginationFooter } from "@/components/admin/admin-list-pagination-footer";
import { AdminTableExportButton } from "@/components/admin/admin-table-export-button";
import { Badge } from "@/components/ui/badge";
import { AdminStatusBadge } from "@/components/admin/admin-status-badge";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Checkbox } from "@/components/ui/checkbox";
@@ -93,16 +93,6 @@ function CellMonoId({
);
}
function statusBadgeVariant(
status: string,
): "default" | "secondary" | "destructive" | "outline" {
if (status === "success" || status === "posted") return "secondary";
if (status === "failed") return "destructive";
if (status === "pending_reconcile") return "outline";
if (status === "reversed" || status === "manually_processed") return "outline";
return "default";
}
function statusLabelT(status: string, t: (key: string) => string): string {
switch (status) {
case "processing":
@@ -476,7 +466,7 @@ export function TransferOrdersPanel(): React.ReactElement {
{formatAdminMinorUnits(row.amount, row.currency_code)}
</TableCell>
<TableCell>
<Badge variant={statusBadgeVariant(row.status)}>{statusLabelT(row.status, t)}</Badge>
<AdminStatusBadge status={row.status}>{statusLabelT(row.status, t)}</AdminStatusBadge>
</TableCell>
<TableCell className="max-w-[14rem] whitespace-normal break-words text-xs text-muted-foreground">
{row.fail_reason?.trim() ? row.fail_reason : "—"}
@@ -798,7 +788,7 @@ export function WalletTxnsPanel(): React.ReactElement {
{row.amount} ({row.direction === 1 ? t("in") : t("out")})
</TableCell>
<TableCell>
<Badge variant={statusBadgeVariant(row.status)}>{statusLabelT(row.status, t)}</Badge>
<AdminStatusBadge status={row.status}>{statusLabelT(row.status, t)}</AdminStatusBadge>
</TableCell>
<TableCell className="min-w-0 whitespace-normal font-mono text-[11px] leading-snug text-muted-foreground">
{formatTs(row.created_at)}