Files
Genarrative/apps/ai-game-creator-shell/src/features/app-shell/AccountWallet.tsx
T
k88936 fc0dcb0782
Project CI / Repository checks (push) Successful in 50s
Project CI / Frontend tests (push) Has been cancelled
Project CI / Backend tests (push) Has been cancelled
Project CI / Native shell tests (push) Has been cancelled
修复泥点消耗刷新不及时 (#138)
refactor:
- 主站复用game agent的zustand store

fix:
- 修复旧请求覆盖问题
- 修复账号切换问题

- 主站原本已经每 4 秒轮询 external generation 任务状态, 在这里补充触发余额刷新的时机

---------

Co-authored-by: 段舒康 <kdletters@qq.com>
Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/138
Co-authored-by: 王德宇 <kvtodev@outlook.com>
Co-committed-by: 王德宇 <kvtodev@outlook.com>
2026-08-08 10:25:02 +08:00

69 lines
2.5 KiB
TypeScript

import { PlatformMudPointWalletEntry } from '../../../../../packages/shared/src/components/PlatformMudPointWalletEntry';
import { PlatformProfileRechargeModal } from '../../../../../packages/shared/src/components/PlatformProfileRechargeModal';
import { PlatformProfileWalletLedgerModal } from '../../../../../packages/shared/src/components/PlatformProfileWalletLedgerModal';
import type { AccountWalletController } from './useAccountWallet';
export function AccountWalletBar({
controller,
}: {
controller: AccountWalletController;
}) {
return (
<div className="launcher-account-bar" aria-label="账户资产">
<PlatformMudPointWalletEntry
balance={
controller.mudPointBalance?.totalPoints ??
controller.legacyWalletBalance
}
breakdown={controller.mudPointBalance}
isLoading={controller.mudPointBalanceStatus === 'loading'}
error={controller.mudPointBalanceError || null}
onRequestDetails={() => void controller.onWalletBalanceMayHaveChanged()}
onRecharge={controller.openRecharge}
onOpenLedger={controller.openWalletLedger}
/>
</div>
);
}
export function AccountWalletDialogs({
controller,
}: {
controller: AccountWalletController;
}) {
return (
<>
{controller.rechargeOpen ? (
<PlatformProfileRechargeModal
center={controller.rechargeModalCenter}
isLoading={controller.rechargeLoading}
error={controller.rechargeError}
submittingProductId={controller.submittingRechargeProductId}
nativePayment={controller.nativeRechargePayment}
onClose={controller.closeRecharge}
onRetry={() => void controller.loadRechargeCenter()}
onBuy={(product) => void controller.buyRechargeProduct(product)}
onConfirmNativePayment={() =>
void controller.confirmNativeRechargePayment()
}
onCloseNativePayment={() => controller.setNativeRechargePayment(null)}
/>
) : null}
{controller.walletLedgerOpen ? (
<PlatformProfileWalletLedgerModal
ledger={controller.walletLedger}
fallbackBalance={
controller.mudPointBalance?.totalPoints ??
controller.legacyWalletBalance ??
0
}
isLoading={controller.walletLedgerLoading}
error={controller.walletLedgerError}
onClose={() => controller.setWalletLedgerOpen(false)}
onRetry={() => void controller.loadWalletLedger()}
/>
) : null}
</>
);
}