17.05.2026 funny
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { Navigate, useNavigate } from 'react-router-dom'
|
||||
import { Navigate, useNavigate, useParams } from 'react-router-dom'
|
||||
import { useMe } from '@features/auth'
|
||||
import { ROUTES } from '@shared/config/routes'
|
||||
import { usePortfolio, useCreateWallet } from '@features/wallet'
|
||||
import { usePortfolio, useCreateWallet, CHAINS, type Chain } from '@features/wallet'
|
||||
import { BalanceCard } from '@widgets/balance-card'
|
||||
import { TokenTable } from '@widgets/token-table'
|
||||
import { WalletHeader } from '@widgets/wallet-header'
|
||||
import { WalletChainTabs } from '@widgets/wallet-chain-tabs'
|
||||
import { Button } from '@shared/ui'
|
||||
import styles from './WalletPage.module.css'
|
||||
|
||||
@@ -13,6 +14,7 @@ export function WalletPage() {
|
||||
const { error: portfolioError } = usePortfolio()
|
||||
const { mutate: createWallet, isPending } = useCreateWallet()
|
||||
const navigate = useNavigate()
|
||||
const { chain: chainParam } = useParams<{ chain?: string }>()
|
||||
|
||||
const noWallet = (portfolioError as any)?.error?.includes('No wallets')
|
||||
|
||||
@@ -20,6 +22,11 @@ export function WalletPage() {
|
||||
if (isError) return <div className={styles.error}>Произошла ошибка. Попробуйте обновить страницу.</div>
|
||||
if (data && !data.kyc_verified) return <Navigate to={ROUTES.KYC} replace />
|
||||
|
||||
const upper = chainParam?.toUpperCase() as Chain | undefined
|
||||
const chain: Chain | undefined = upper && CHAINS.includes(upper) ? upper : undefined
|
||||
|
||||
if (!noWallet && !chain) return <Navigate to="/wallet/btc" replace />
|
||||
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<WalletHeader />
|
||||
@@ -39,7 +46,8 @@ export function WalletPage() {
|
||||
) : (
|
||||
<>
|
||||
<BalanceCard />
|
||||
<TokenTable />
|
||||
<WalletChainTabs />
|
||||
<TokenTable chain={chain!} />
|
||||
</>
|
||||
)}
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user