feat: 优化大厅下注结果与风险提示展示,重构期号与订单详情样式

This commit is contained in:
2026-05-15 15:31:00 +08:00
parent f2c7f5e4f1
commit a83920aa2a
13 changed files with 1078 additions and 492 deletions

View File

@@ -7,6 +7,15 @@ import { getLotteryEcho } from "@/lib/lottery-echo";
import { useNetworkConnectionStore } from "@/stores/network-connection-store";
import type { DrawCurrentPayload } from "@/types/api/draw-current";
/** 大厅共享的当期快照(由 {@link useHallDrawLive} 产出,供期号条与下注表共用)。 */
export type HallDrawLiveSnapshot = {
raw: DrawCurrentPayload | null | undefined;
display: DrawCurrentPayload | null | undefined;
error: string | null;
reload: () => Promise<void>;
isBettable: boolean;
};
/** 界面文档 §2.1`draw.countdown` / `draw.status_change` / `result.published` 载荷 */
export type HallWsEnvelope = {
data: DrawCurrentPayload | null;
@@ -34,16 +43,10 @@ function applySnapshotDrift(
}
/**
* 大厅期号WebSocket `lottery-hall` + 轮询降级(与 {@link HallDrawPanel} 同源逻辑)
* 大厅期号WebSocket `lottery-hall` + 轮询降级;由 {@link HallScreen} 调用一次,注入 {@link HallDrawPanel} 与 {@link HallBettingGrid}
* 已集成网络连接管理WebSocket断开时自动切换到轮询模式。
*/
export function useHallDrawLive(): {
raw: DrawCurrentPayload | null | undefined;
display: DrawCurrentPayload | null | undefined;
error: string | null;
reload: () => Promise<void>;
isBettable: boolean;
} {
export function useHallDrawLive(): HallDrawLiveSnapshot {
const [raw, setRaw] = useState<DrawCurrentPayload | null | undefined>(undefined);
const [emittedAtMs, setEmittedAtMs] = useState(() => Date.now());
const [nowMs, setNowMs] = useState(() => Date.now());