diff --git a/src/i18n/locales/en/dashboard.json b/src/i18n/locales/en/dashboard.json index 7b42b75..c7b00db 100644 --- a/src/i18n/locales/en/dashboard.json +++ b/src/i18n/locales/en/dashboard.json @@ -85,7 +85,10 @@ "noFinanceActivity": "No bets this draw", "noPayoutYet": "No payout this draw", "resultBatches": "Result batch progress", + "resultBatchQueueScope": "Site-wide pending batches", "batchPending": "Pending review", + "batchPendingDraws": "Draws involved", + "batchCurrentDrawPending": "Current draw", "batchPublished": "Published", "batchTotal": "Total batches", "batchOther": "Other statuses", diff --git a/src/i18n/locales/ne/dashboard.json b/src/i18n/locales/ne/dashboard.json index 067383f..cd3e8ea 100644 --- a/src/i18n/locales/ne/dashboard.json +++ b/src/i18n/locales/ne/dashboard.json @@ -85,7 +85,10 @@ "noFinanceActivity": "यस ड्रअमा बेट छैन", "noPayoutYet": "यस ड्रअमा भुक्तानी छैन", "resultBatches": "परिणाम ब्याच प्रगति", + "resultBatchQueueScope": "साइटव्यापी पेन्डिङ ब्याच", "batchPending": "समीक्षा बाँकी", + "batchPendingDraws": "सम्बन्धित ड्रअ", + "batchCurrentDrawPending": "हालको ड्रअ", "batchPublished": "प्रकाशित", "batchTotal": "कुल ब्याच", "batchOther": "अन्य स्थिति", diff --git a/src/i18n/locales/zh/dashboard.json b/src/i18n/locales/zh/dashboard.json index db78fe7..6d8fd4c 100644 --- a/src/i18n/locales/zh/dashboard.json +++ b/src/i18n/locales/zh/dashboard.json @@ -85,7 +85,10 @@ "noFinanceActivity": "本期暂无投注", "noPayoutYet": "本期暂无派彩", "resultBatches": "开奖批次进度", + "resultBatchQueueScope": "全站待审核批次", "batchPending": "待审核", + "batchPendingDraws": "涉及期数", + "batchCurrentDrawPending": "当前期", "batchPublished": "已发布", "batchTotal": "批次合计", "batchOther": "其他状态", diff --git a/src/modules/dashboard/dashboard-console.tsx b/src/modules/dashboard/dashboard-console.tsx index bec3ca6..1e1db1e 100644 --- a/src/modules/dashboard/dashboard-console.tsx +++ b/src/modules/dashboard/dashboard-console.tsx @@ -42,7 +42,7 @@ import { FinanceStructureChart, HotUsageBars, PayoutPanelSnapshot, - ResultBatchProgress, + ResultBatchQueueSummary, DashboardPanelCard, SettlementStatusChart, } from "@/modules/dashboard/dashboard-visuals"; @@ -53,7 +53,10 @@ import { getAdminRequestLocale } from "@/lib/admin-locale"; import { formatAdminMinorUnits, getAdminCurrencyDecimalPlaces } from "@/lib/money"; import { cn } from "@/lib/utils"; import { LotteryApiBizError } from "@/types/api/errors"; -import type { AdminDashboardDrawPanel } from "@/types/api/admin-dashboard"; +import type { + AdminDashboardDrawPanel, + AdminDashboardResultBatchQueue, +} from "@/types/api/admin-dashboard"; import type { AdminDrawFinanceSummaryData } from "@/types/api/admin-draw-finance"; import type { AdminRiskPoolRow } from "@/types/api/admin-risk"; import type { DrawCurrentSnapshot } from "@/types/api/public-draw"; @@ -84,6 +87,17 @@ function drawScopedHref( return drawId != null ? `/admin/draws/${drawId}${suffix}` : fallback; } +function pendingReviewHref( + drawId: number | null, + queue: AdminDashboardResultBatchQueue | null, +): string { + if (queue != null && queue.pending_review_total > 0 && queue.first_pending_draw_id != null) { + return `/admin/draws/${queue.first_pending_draw_id}/review`; + } + + return drawScopedHref(drawId, "/review"); +} + function poolPlayCategory(normalizedNumber: string): HotPlayTab | "other" { const raw = normalizedNumber.trim(); const digits = raw.replace(/\D/g, ""); @@ -134,7 +148,9 @@ export function DashboardConsole(): ReactElement { const [drawPanel, setDrawPanel] = useState(null); const [finance, setFinance] = useState(null); const [capabilities, setCapabilities] = useState<{ draw_finance_risk: boolean; wallet_transfer_view: boolean } | null>(null); - const [pendingReview, setPendingReview] = useState(null); + const [resultBatchQueue, setResultBatchQueue] = useState( + null, + ); const [riskLocked, setRiskLocked] = useState(0); const [riskCap, setRiskCap] = useState(0); const [hotPoolSample, setHotPoolSample] = useState([]); @@ -173,7 +189,7 @@ export function DashboardConsole(): ReactElement { setFinance(null); setCapabilities(null); setDrawPanel(null); - setPendingReview(null); + setResultBatchQueue(null); setDrawId(null); setRiskLocked(0); setRiskCap(0); @@ -194,7 +210,7 @@ export function DashboardConsole(): ReactElement { } if (d.draw != null) { setDrawPanel(d.draw); - setPendingReview(d.draw.result_batch_counts.pending_review); + setResultBatchQueue(d.result_batch_queue); } if (d.risk != null) { setRiskLocked(d.risk.locked_amount); @@ -225,6 +241,9 @@ export function DashboardConsole(): ReactElement { const hotRows = useMemo(() => topPoolsForTab(hotPoolSample, hotTab), [hotPoolSample, hotTab]); + const pendingReviewTotal = resultBatchQueue?.pending_review_total ?? 0; + const currentDrawPending = drawPanel?.result_batch_counts.pending_review ?? 0; + const analytics = useDashboardAnalytics({ enabled: canFinance, playOptions }); const showAnalytics = canFinance; @@ -288,21 +307,27 @@ export function DashboardConsole(): ReactElement { />
0 + pendingReviewTotal > 0 ? t("actions.reviewNow", { ns: "common" }) : t("drawDetails") } icon={} - accent={(pendingReview ?? 0) > 0 ? "destructive" : "muted"} - highlight={(pendingReview ?? 0) > 0} + accent={pendingReviewTotal > 0 ? "destructive" : "muted"} + highlight={pendingReviewTotal > 0} loading={loading} > - {drawPanel ? : null} + {resultBatchQueue != null ? ( + + ) : null} +
+

+ {pending_review_total} +

+

{t("batchPending")}

+
+
+

+ {pending_draw_count} +

+

{t("batchPendingDraws")}

+
+
+

+ {currentDrawPending} +

+

{t("batchCurrentDrawPending")}

+
+
+ ); +} + export function SettlementStatusChart({ finance, }: { diff --git a/src/types/api/admin-dashboard.ts b/src/types/api/admin-dashboard.ts index c7462d1..e585e50 100644 --- a/src/types/api/admin-dashboard.ts +++ b/src/types/api/admin-dashboard.ts @@ -49,6 +49,14 @@ export type AdminDashboardCapabilities = { wallet_transfer_view: boolean; }; +/** 全站待审核开奖批次队列(不限于大厅当前期) */ +export type AdminDashboardResultBatchQueue = { + pending_review_total: number; + pending_draw_count: number; + first_pending_draw_id: number | null; + first_pending_batch_id: number | null; +}; + /** 按业务日汇总的今日投注/派彩/盈亏(与报表 daily-profit 口径一致) */ export type AdminDashboardTodayFinance = { business_date: string; @@ -79,6 +87,7 @@ export type AdminDashboardData = { finance: AdminDrawFinanceSummaryData | null; draw: AdminDashboardDrawPanel | null; risk: AdminDashboardRiskSnapshot | null; + result_batch_queue: AdminDashboardResultBatchQueue | null; abnormal_transfer_total: number | null; warnings: AdminDashboardWarning[]; capabilities: AdminDashboardCapabilities;