refactor: 重构奖池配置页面,移除冗余组件,优化加载体验与国际化支持
This commit is contained in:
@@ -125,10 +125,12 @@ export function DrawDetailConsole({ drawId }: { drawId: string }) {
|
||||
status={data.status}
|
||||
label={drawStatusText(data.status, t)}
|
||||
/>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t("hallPreviewStatus", {
|
||||
status: drawStatusText(data.hall_preview_status, t),
|
||||
})}
|
||||
<p className="flex flex-wrap items-center justify-end gap-2 text-sm text-muted-foreground">
|
||||
<span>{t("hallPreviewStatus", { status: "" }).replace(/\{\{status\}\}/, "").replace(/\s+$/, "")}</span>
|
||||
<DrawStatusBadge
|
||||
status={data.hall_preview_status}
|
||||
label={drawStatusText(data.hall_preview_status, t)}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,9 @@ import { useTranslation } from "react-i18next";
|
||||
import { getAdminDrawFinanceSummary } from "@/api/admin-draws";
|
||||
import { postAdminRunDrawSettlement } from "@/api/admin-settlement";
|
||||
import { Button, buttonVariants } from "@/components/ui/button";
|
||||
import { AdminStatusBadge } from "@/components/admin/admin-status-badge";
|
||||
import { AdminTableExportButton } from "@/components/admin/admin-table-export-button";
|
||||
import { DrawStatusBadge } from "@/modules/draws/draw-status-badge";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
Table,
|
||||
@@ -104,7 +106,9 @@ export function DrawFinanceConsole({ drawId }: { drawId: string }): React.ReactE
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-muted-foreground">{t("status")}</span>
|
||||
<p>{drawStatusText(data.draw_status, t)}</p>
|
||||
<p className="mt-1">
|
||||
<DrawStatusBadge status={data.draw_status} label={drawStatusText(data.draw_status, t)} />
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-muted-foreground">{t("orderAndItemCount")}</span>
|
||||
@@ -186,7 +190,9 @@ export function DrawFinanceConsole({ drawId }: { drawId: string }): React.ReactE
|
||||
{data.settlement_batches.map((b) => (
|
||||
<TableRow key={b.id}>
|
||||
<TableCell className="font-mono text-xs">{b.id}</TableCell>
|
||||
<TableCell className="text-xs">{drawStatusText(b.status, t)}</TableCell>
|
||||
<TableCell>
|
||||
<AdminStatusBadge status={b.status}>{drawStatusText(b.status, t)}</AdminStatusBadge>
|
||||
</TableCell>
|
||||
<TableCell className="text-right tabular-nums text-xs">
|
||||
{b.total_ticket_count}
|
||||
</TableCell>
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
||||
const emphasis: Record<string, "default" | "secondary" | "destructive" | "outline"> = {
|
||||
open: "default",
|
||||
closing: "destructive",
|
||||
closed: "secondary",
|
||||
drawing: "secondary",
|
||||
review: "outline",
|
||||
cooldown: "secondary",
|
||||
pending: "outline",
|
||||
};
|
||||
import { AdminStatusBadge } from "@/components/admin/admin-status-badge";
|
||||
import { resolveAdminStatusTone } from "@/lib/admin-status-tone";
|
||||
|
||||
export function DrawStatusBadge({
|
||||
status,
|
||||
@@ -18,6 +9,9 @@ export function DrawStatusBadge({
|
||||
/** 可与 DB 不同时展示预览态文案 */
|
||||
label?: string;
|
||||
}) {
|
||||
const v = emphasis[status] ?? "outline";
|
||||
return <Badge variant={v}>{label ?? status}</Badge>;
|
||||
return (
|
||||
<AdminStatusBadge status={status} tone={resolveAdminStatusTone(status)}>
|
||||
{label ?? status}
|
||||
</AdminStatusBadge>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -267,7 +267,10 @@ export function DrawsIndexConsole() {
|
||||
<TableCell className="text-sm">{formatDt(row.close_time)}</TableCell>
|
||||
<TableCell className="text-sm">{formatDt(row.draw_time)}</TableCell>
|
||||
<TableCell>
|
||||
<DrawStatusBadge status={row.status} />
|
||||
<DrawStatusBadge
|
||||
status={row.status}
|
||||
label={drawAdminStatusSelectLabel(row.status, t)}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className="text-right font-mono text-xs tabular-nums">
|
||||
{row.total_bet_minor ?? "—"}
|
||||
|
||||
Reference in New Issue
Block a user