fc0dcb0782
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>
69 lines
2.5 KiB
TypeScript
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}
|
|
</>
|
|
);
|
|
}
|