This commit is contained in:
2026-06-17 23:53:57 +03:00
parent 0064e25cb6
commit f17367658d
5 changed files with 26 additions and 8 deletions

View File

@@ -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 <div className={styles.error}>Произошла ошибка. Попробуйте обновить страницу.</div>
if (data && !data.kyc_verified) return <Navigate to={ROUTES.KYC} replace />
@@ -30,7 +29,9 @@ export function WalletPage() {
<WalletHeader />
<main className={styles.main}>
<div className={styles.glow} />
{noWallet ? (
{isLoading || isPortfolioLoading ? (
<Spinner fullscreen label="Загрузка" />
) : noWallet ? (
<div className={styles.noWallet}>
<p>У вас пока нет кошелька. Создайте его, чтобы начать.</p>
<Button

View File

@@ -28,6 +28,13 @@
padding: 24px 0;
}
.spinnerWrap {
display: flex;
align-items: center;
justify-content: center;
padding: 24px 0;
}
.table {
width: 100%;
border-collapse: collapse;

View File

@@ -100,7 +100,11 @@ export function PoolsTable({ pools, selected, onSelect, loading, error }: Props)
<span className={styles.title}>Курируемые пулы</span>
</div>
{loading && <Spinner label="Загрузка пулов" />}
{loading && (
<div className={styles.spinnerWrap}>
<Spinner label="Загрузка пулов" />
</div>
)}
{!loading && error && <div className={styles.message}>{error}</div>}
{!loading && !error && pools.length === 0 && (
<div className={styles.message}>Курируемых пулов пока нет.</div>

View File

@@ -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)

View File

@@ -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 (
<div className={styles.panel}>
<div className={styles.inner}>