refactor: update environment configuration and enhance notification handling
- Refactored ecosystem configuration to utilize .env for sensitive variables, improving security and flexibility. - Replaced direct notification button implementation with a dedicated PlayerNotificationBell component for better code organization. - Updated various screens to integrate the new notification component and adjusted prefetch settings for links to optimize performance. - Added new translations for notifications and wallet logs to enhance user experience across multiple languages.
This commit is contained in:
@@ -48,7 +48,7 @@ type WalletLogsBlockProps = {
|
||||
title?: string;
|
||||
};
|
||||
|
||||
/** 待对账 + 类型筛选 + 列表(供钱包主页与 `/wallet/logs` 共用) */
|
||||
/** 类型筛选 + 列表(待对账见顶栏通知铃铛) */
|
||||
export function WalletLogsBlock({
|
||||
logs,
|
||||
logsLoading,
|
||||
@@ -74,29 +74,6 @@ export function WalletLogsBlock({
|
||||
|
||||
return (
|
||||
<>
|
||||
{logs && logs.pending_reconcile.length > 0 ? (
|
||||
<section className="rounded-xl border border-amber-200 bg-amber-50 px-3 py-3">
|
||||
<p className="text-sm font-black text-amber-700">{t("wallet.pendingTitle")}</p>
|
||||
<p className="mt-1 text-xs text-amber-700/80">
|
||||
{t("wallet.pendingDescription")}
|
||||
</p>
|
||||
<div className="mt-2 space-y-2 text-sm">
|
||||
{logs.pending_reconcile.map((p) => (
|
||||
<div
|
||||
key={p.transfer_no}
|
||||
className="flex flex-wrap items-baseline justify-between gap-1 border-b border-dashed border-border py-2 last:border-0"
|
||||
>
|
||||
<span className="text-muted-foreground">
|
||||
{logTypeLabel(p.type, t)}{" "}
|
||||
{formatMinorAsCurrency(p.amount, p.currency_code)}
|
||||
</span>
|
||||
<span className="text-xs text-amber-700">{t("wallet.pendingStatus")}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
<section className="space-y-3">
|
||||
<div className="flex flex-col gap-2">
|
||||
<h2 className="text-sm font-black text-[#0b3f96]">{resolvedTitle}</h2>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { getWalletLogs } from "@/api/wallet";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { PlayerPanel } from "@/components/layout/player-panel";
|
||||
import { WalletLogsBlock } from "@/features/wallet/wallet-logs-block";
|
||||
import { dispatchWalletLogsRefresh } from "@/hooks/use-pending-wallet-reconcile";
|
||||
import { useActivePlayerCurrency } from "@/hooks/use-active-player-currency";
|
||||
import { PLAYER_CURRENCY_CHANGE_EVENT } from "@/lib/player-currency-preference";
|
||||
import { formatWalletClientError } from "@/lib/wallet-api-error";
|
||||
@@ -49,6 +50,7 @@ export function WalletLogsScreen() {
|
||||
? { ...nextLogs, items: [...current.items, ...nextLogs.items] }
|
||||
: nextLogs,
|
||||
);
|
||||
dispatchWalletLogsRefresh(nextLogs.pending_reconcile ?? []);
|
||||
} catch (e) {
|
||||
setError(formatWalletClientError(e, t));
|
||||
if (!append) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
TransferOutDialog,
|
||||
} from "@/features/wallet/wallet-transfer-dialogs";
|
||||
import { WalletLogsBlock } from "@/features/wallet/wallet-logs-block";
|
||||
import { dispatchWalletLogsRefresh } from "@/hooks/use-pending-wallet-reconcile";
|
||||
import { useActivePlayerCurrency } from "@/hooks/use-active-player-currency";
|
||||
import { formatMinorAsCurrency } from "@/lib/money";
|
||||
import { PLAYER_CURRENCY_CHANGE_EVENT } from "@/lib/player-currency-preference";
|
||||
@@ -49,6 +50,7 @@ export function WalletScreen() {
|
||||
? { ...nextLogs, items: [...current.items, ...nextLogs.items] }
|
||||
: nextLogs,
|
||||
);
|
||||
dispatchWalletLogsRefresh(nextLogs.pending_reconcile ?? []);
|
||||
return nextLogs;
|
||||
}, [currency, filter]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user