diff --git a/src/pages/wallet/ui/WalletPage.tsx b/src/pages/wallet/ui/WalletPage.tsx index 3eff9cc..2650564 100644 --- a/src/pages/wallet/ui/WalletPage.tsx +++ b/src/pages/wallet/ui/WalletPage.tsx @@ -6,19 +6,18 @@ import { BalanceCard } from '@widgets/balance-card' import { TokenTable, AllTokenTable } from '@widgets/token-table' import { WalletHeader } from '@widgets/wallet-header' import { WalletChainTabs } from '@widgets/wallet-chain-tabs' -import { Button } from '@shared/ui' +import { Button, Spinner } from '@shared/ui' import styles from './WalletPage.module.css' export function WalletPage() { const { data, isLoading, isError } = useMe() - const { error: portfolioError } = usePortfolio() + const { error: portfolioError, isLoading: isPortfolioLoading } = usePortfolio() const { mutate: createWallet, isPending } = useCreateWallet() const navigate = useNavigate() const { chain: chainParam } = useParams<{ chain?: string }>() const noWallet = (portfolioError as { error?: string } | null)?.error?.includes('No wallets') - if (isLoading) return null if (isError) return
Произошла ошибка. Попробуйте обновить страницу.
if (data && !data.kyc_verified) return @@ -30,7 +29,9 @@ export function WalletPage() {
- {noWallet ? ( + {isLoading || isPortfolioLoading ? ( + + ) : noWallet ? (

У вас пока нет кошелька. Создайте его, чтобы начать.

- {loading && } + {loading && ( +
+ +
+ )} {!loading && error &&
{error}
} {!loading && !error && pools.length === 0 && (
Курируемых пулов пока нет.
diff --git a/src/widgets/pools/ui/PoolsWidget.tsx b/src/widgets/pools/ui/PoolsWidget.tsx index c6883a8..85ded86 100644 --- a/src/widgets/pools/ui/PoolsWidget.tsx +++ b/src/widgets/pools/ui/PoolsWidget.tsx @@ -1,4 +1,4 @@ -import { useMemo, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' import { Notification } from '@shared/ui' import { useDebounce } from '@shared/lib/hooks/useDebounce' import { @@ -56,6 +56,14 @@ export function PoolsWidget() { setAmount1('') } + // Когда пулы загрузились, автоматически выбираем первый, если ничего не выбрано. + useEffect(() => { + if (!selected && pools.length > 0) { + handleSelect(pools[0].poolAddress) + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [pools, selected]) + // Дебаунсим вход квоты, чтобы не дёргать /lp/quote на каждый символ. const dAmount0 = useDebounce(amount0, 400) const dAmount1 = useDebounce(amount1, 400) diff --git a/src/widgets/staking/ui/PositionsPanel.tsx b/src/widgets/staking/ui/PositionsPanel.tsx index a64a617..d97d19f 100644 --- a/src/widgets/staking/ui/PositionsPanel.tsx +++ b/src/widgets/staking/ui/PositionsPanel.tsx @@ -37,8 +37,6 @@ export function PositionsPanel({ chain, onUnstakeEth, onUnstakeSol, onClaim, uns const solEmpty = data?.chain === 'SOL' && data.positions.length === 0 const empty = ethEmpty || solEmpty - console.log(empty, data?.chain, data) - return (