feat: 增强封盘状态处理与用户界面反馈
- 在 draw-status-meta.ts 中新增 isHallSealedCountdownUi 函数以判断封盘状态 - 在 hall-bet-preview-dialog.tsx 中添加 allowSubmit 属性,控制提交按钮状态 - 更新 hall-betting-grid.tsx 以显示封盘提示与禁用下注功能 - 在 hall-draw-panel.tsx 中优化封盘状态的视觉反馈 - 修改 hall-screen.tsx 的注释以反映封盘相关的界面变化
This commit is contained in:
@@ -18,6 +18,7 @@ import { mapTicketBetError } from "@/features/hall/hall-bet-errors";
|
||||
import { HallBetAmountInput } from "@/features/hall/hall-bet-amount-input";
|
||||
import { HallBetPreviewDialog } from "@/features/hall/hall-bet-preview-dialog";
|
||||
import { HallBetNumberInput } from "@/features/hall/hall-bet-number-input";
|
||||
import { isHallSealedCountdownUi } from "@/features/draw/draw-status-meta";
|
||||
import {
|
||||
playNeedsDigitSlot,
|
||||
playNeedsDimension,
|
||||
@@ -195,6 +196,7 @@ export function HallBettingGrid() {
|
||||
const maxBet = selectedRow?.config?.max_bet_amount ?? 999_999_999;
|
||||
|
||||
const tableDisabled = !isBettable || catalogState.kind !== "ok";
|
||||
const sealedBetUi = Boolean(display && isHallSealedCountdownUi(display.status));
|
||||
|
||||
const [previewOpen, setPreviewOpen] = useState(false);
|
||||
const [previewData, setPreviewData] = useState<TicketPreviewData | null>(null);
|
||||
@@ -271,6 +273,10 @@ export function HallBettingGrid() {
|
||||
|
||||
const handlePlace = async () => {
|
||||
if (!display || !previewData) return;
|
||||
if (!isBettable) {
|
||||
toast.error("已封盘,无法提交。");
|
||||
return;
|
||||
}
|
||||
const line = buildLine();
|
||||
if (!line) {
|
||||
toast.error("提交前数据已变化,请关闭预览后重试。");
|
||||
@@ -328,13 +334,23 @@ export function HallBettingGrid() {
|
||||
<div
|
||||
className={cn(
|
||||
"space-y-5 transition-opacity",
|
||||
tableDisabled && "pointer-events-none opacity-50",
|
||||
tableDisabled && "pointer-events-none",
|
||||
tableDisabled && (sealedBetUi ? "opacity-[0.52]" : "opacity-50"),
|
||||
)}
|
||||
>
|
||||
{!isBettable && display ? (
|
||||
<p className="rounded-lg border border-rose-500/30 bg-rose-500/10 px-3 py-2 text-sm text-rose-800 dark:text-rose-200">
|
||||
已封盘:本期状态为「{display.status}」,不可下注。按钮已锁定为「已封盘」(产品文档 §6.3、界面 §4.2)。
|
||||
</p>
|
||||
sealedBetUi ? (
|
||||
<div className="space-y-1 rounded-lg border border-[#ff4d4f]/35 bg-[#ff4d4f]/8 px-3 py-2 text-sm text-[#ff4d4f] dark:bg-[#ff4d4f]/10">
|
||||
<p className="font-medium">
|
||||
已封盘:表格置灰且不可编辑;倒计时区域见上方期号卡片(界面文档 §4.2)。
|
||||
</p>
|
||||
<p className="text-xs leading-relaxed">请选择下一期。</p>
|
||||
</div>
|
||||
) : (
|
||||
<p className="rounded-lg border border-muted-foreground/30 bg-muted/50 px-3 py-2 text-sm text-muted-foreground">
|
||||
当前期不可下注(状态「{display.status}」)。提交入口已禁用。
|
||||
</p>
|
||||
)
|
||||
) : null}
|
||||
|
||||
<HallPlaySwitcher
|
||||
@@ -437,7 +453,12 @@ export function HallBettingGrid() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card className={cn(!isBettable && display && "border-rose-500/30")}>
|
||||
<Card
|
||||
className={cn(
|
||||
sealedBetUi && "border-[#ff4d4f]/40 bg-muted/30",
|
||||
!isBettable && display && !sealedBetUi && "border-muted-foreground/20 bg-muted/20",
|
||||
)}
|
||||
>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base">下注</CardTitle>
|
||||
<CardDescription>
|
||||
@@ -456,6 +477,7 @@ export function HallBettingGrid() {
|
||||
currencyCode={currencyCode}
|
||||
data={previewData}
|
||||
placing={placeLoading}
|
||||
allowSubmit={isBettable}
|
||||
onConfirmPlace={() => void handlePlace()}
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user