feat: 接入公开币种目录并统一多币种金额与语言初始化处理
This commit is contained in:
@@ -17,9 +17,12 @@ import {
|
||||
} from "@/components/ui/dialog";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PlayerPanel } from "@/components/layout/player-panel";
|
||||
import { useCurrencyCatalog } from "@/hooks/use-currency-catalog";
|
||||
import { formatMinorAsCurrency } from "@/lib/money";
|
||||
import { formatLotteryInstant } from "@/lib/player-datetime";
|
||||
import { playLabel } from "@/lib/play-labels";
|
||||
import { resolvePlayerCurrency } from "@/lib/player-currency";
|
||||
import { usePlayerSessionStore } from "@/stores/player-session-store";
|
||||
import type { DrawResultListItem } from "@/types/api/draw-results";
|
||||
import type { TicketDrawMyMatchPayload, TicketItemListRow } from "@/types/api/ticket-items";
|
||||
|
||||
@@ -31,6 +34,7 @@ type WinningCheckResult = {
|
||||
|
||||
export function CheckWinningScreen() {
|
||||
const { t } = useTranslation("player");
|
||||
useCurrencyCatalog();
|
||||
const [ticketNo, setTicketNo] = useState("");
|
||||
const [latestDraw, setLatestDraw] = useState<DrawResultListItem | null>(null);
|
||||
const [recent, setRecent] = useState<string[]>([]);
|
||||
@@ -197,9 +201,11 @@ function WinningResultDialog({
|
||||
onCheckAnother: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation("player");
|
||||
const profile = usePlayerSessionStore((state) => state.profile);
|
||||
const totalWin = (data?.match.total_win_minor ?? 0) + (data?.match.total_jackpot_win_minor ?? 0);
|
||||
const isWon = totalWin > 0 || (data?.match.winning_ticket_count ?? 0) > 0;
|
||||
const firstTicket = useMemo(() => data?.tickets[0] ?? null, [data]);
|
||||
const currency = firstTicket?.currency_code ?? resolvePlayerCurrency(profile);
|
||||
|
||||
if (!data) return null;
|
||||
|
||||
@@ -250,7 +256,7 @@ function WinningResultDialog({
|
||||
{t("results.check.amount")}
|
||||
</p>
|
||||
<p className="mt-2 font-mono text-lg font-black text-[#0a8f3e]">
|
||||
{formatMinorAsCurrency(totalWin, firstTicket?.currency_code ?? "NPR")}
|
||||
{formatMinorAsCurrency(totalWin, currency)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user