feat: enhance API error handling and UI improvements
Some checks failed
lotteryfront CI / build (push) Has been cancelled

- Updated `getPublicCurrencies` and `getPlayerAuthCaptcha` functions to include `skipGlobalServerError` option, improving error handling for API requests.
- Refactored the NotFoundPage component to enhance mobile responsiveness and UI consistency, integrating `PlayerMobileViewport`.
- Improved the NetworkStatusBanner and OfflineBanner components by adding player banner height reference for better layout management.
- Updated Wallet components to utilize `PlayerMoneyDisplay` for consistent currency representation and added credit mode handling in various screens.
- Enhanced the WalletScreen and Transfer screens with loading panels and credit guard logic for better user experience during wallet operations.
This commit is contained in:
2026-06-22 10:50:52 +08:00
parent 34b851d7e1
commit ecb032f8cc
43 changed files with 756 additions and 297 deletions

View File

@@ -7,6 +7,7 @@ import { useTranslation } from "react-i18next";
import { useSWRConfig } from "swr";
import { getWalletBalance } from "@/api/wallet";
import { PlayerMoneyDisplay } from "@/components/player-money-display";
import { Skeleton } from "@/components/ui/skeleton";
import {
TransferInDialog,
@@ -65,29 +66,6 @@ export function HallWalletStrip() {
const balanceMinor = Number(balance?.balance ?? 0);
const headlineMinor = isCreditPlayer ? availableMinor : balanceMinor;
const transferInLotteryMinor = isCreditPlayer ? availableMinor : balanceMinor;
// #region agent log
if (typeof window !== "undefined" && balance && !loading) {
fetch("http://127.0.0.1:7696/ingest/e56128e6-898b-4d61-b06d-2aefe0923744", {
method: "POST",
headers: { "Content-Type": "application/json", "X-Debug-Session-Id": "7fd0fc" },
body: JSON.stringify({
sessionId: "7fd0fc",
runId: "hall-wallet-display-post-fix",
hypothesisId: "H3",
location: "hall-wallet-strip.tsx:render",
message: "hall wallet headline amounts",
data: {
isCreditPlayer,
availableMinor,
balanceMinor,
headlineMinor,
mismatchWithWalletPage: !isCreditPlayer && headlineMinor !== balanceMinor,
},
timestamp: Date.now(),
}),
}).catch(() => {});
}
// #endregion
const mainMinor =
balance?.main_balance === null || balance?.main_balance === undefined
? null
@@ -115,7 +93,7 @@ export function HallWalletStrip() {
aria-hidden
/>
<div className="relative flex items-center gap-3">
<div className="flex size-13 shrink-0 items-center justify-center rounded-full bg-white text-[#d81435] shadow-sm">
<div className="flex size-14 shrink-0 items-center justify-center rounded-full bg-white text-[#d81435] shadow-sm">
<Wallet className="size-7" aria-hidden />
</div>
<div className="min-w-0 flex-1">
@@ -127,10 +105,21 @@ export function HallWalletStrip() {
{loading ? (
<Skeleton className="mt-2 h-8 w-44 rounded-md bg-white/25" />
) : (
<p className="mt-1 text-2xl font-black leading-none tabular-nums tracking-normal">
{formatMinorAsCurrency(headlineMinor, currency)}
</p>
<PlayerMoneyDisplay
amountMinor={headlineMinor}
currency={currency}
className="mt-1 text-white"
/>
)}
{isCreditPlayer && !loading && balance ? (
<p className="mt-2 text-xs text-white/75">
{t("wallet.creditSummary", {
defaultValue: "授信 {{limit}} · 已用 {{used}}",
limit: formatMinorAsCurrency(balance.credit_limit ?? 0, currency),
used: formatMinorAsCurrency(balance.used_credit ?? 0, currency),
})}
</p>
) : null}
</div>
</div>
</div>