import { Coins } from 'lucide-react'; import type { ProfileWalletLedgerResponse } from '../../../packages/shared/src/contracts/runtime'; import { PlatformActionButton } from '../common/PlatformActionButton'; import { PlatformEmptyState } from '../common/PlatformEmptyState'; import { PlatformPillBadge } from '../common/PlatformPillBadge'; import { PlatformStatusMessage } from '../common/PlatformStatusMessage'; import { PlatformSubpanel } from '../common/PlatformSubpanel'; import { PlatformProfileSecondaryModalShell } from './PlatformProfileModalShell'; import { buildWalletLedgerPresentation } from '../rpg-entry/rpgEntryProfileFundsViewModel'; import { formatPlatformWorldTime } from '../rpg-entry/rpgEntryWorldPresentation'; export type PlatformProfileWalletLedgerModalProps = { ledger: ProfileWalletLedgerResponse | null; fallbackBalance: number; isLoading: boolean; error: string | null; onClose: () => void; onRetry: () => void; }; /** * 个人中心泥点账单弹窗。 * 保持 RPG 首页里既有的展示文案、状态分支和交互,仅把实现提取为共享组件。 */ export function PlatformProfileWalletLedgerModal({ ledger, fallbackBalance, isLoading, error, onClose, onRetry, }: PlatformProfileWalletLedgerModalProps) { const walletLedgerPresentation = buildWalletLedgerPresentation( ledger, fallbackBalance, ); const entries = walletLedgerPresentation.entries; return (
LEDGER
泥点账单
} className="mt-3 bg-white/70" > {walletLedgerPresentation.balanceLabel}
{error ? (
{error}
重新加载
) : isLoading ? (
{Array.from({ length: 5 }).map((_, index) => (
))}
) : entries.length === 0 ? ( 暂无账单记录 ) : (
{entries.map((entry) => (
{entry.sourceLabel}
{formatPlatformWorldTime(entry.createdAt)}
{entry.amountLabel}
{entry.balanceLabel}
))}
)} ); }