fix
This commit is contained in:
@@ -6,19 +6,18 @@ import { BalanceCard } from '@widgets/balance-card'
|
|||||||
import { TokenTable, AllTokenTable } from '@widgets/token-table'
|
import { TokenTable, AllTokenTable } from '@widgets/token-table'
|
||||||
import { WalletHeader } from '@widgets/wallet-header'
|
import { WalletHeader } from '@widgets/wallet-header'
|
||||||
import { WalletChainTabs } from '@widgets/wallet-chain-tabs'
|
import { WalletChainTabs } from '@widgets/wallet-chain-tabs'
|
||||||
import { Button } from '@shared/ui'
|
import { Button, Spinner } from '@shared/ui'
|
||||||
import styles from './WalletPage.module.css'
|
import styles from './WalletPage.module.css'
|
||||||
|
|
||||||
export function WalletPage() {
|
export function WalletPage() {
|
||||||
const { data, isLoading, isError } = useMe()
|
const { data, isLoading, isError } = useMe()
|
||||||
const { error: portfolioError } = usePortfolio()
|
const { error: portfolioError, isLoading: isPortfolioLoading } = usePortfolio()
|
||||||
const { mutate: createWallet, isPending } = useCreateWallet()
|
const { mutate: createWallet, isPending } = useCreateWallet()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const { chain: chainParam } = useParams<{ chain?: string }>()
|
const { chain: chainParam } = useParams<{ chain?: string }>()
|
||||||
|
|
||||||
const noWallet = (portfolioError as { error?: string } | null)?.error?.includes('No wallets')
|
const noWallet = (portfolioError as { error?: string } | null)?.error?.includes('No wallets')
|
||||||
|
|
||||||
if (isLoading) return null
|
|
||||||
if (isError) return <div className={styles.error}>Произошла ошибка. Попробуйте обновить страницу.</div>
|
if (isError) return <div className={styles.error}>Произошла ошибка. Попробуйте обновить страницу.</div>
|
||||||
if (data && !data.kyc_verified) return <Navigate to={ROUTES.KYC} replace />
|
if (data && !data.kyc_verified) return <Navigate to={ROUTES.KYC} replace />
|
||||||
|
|
||||||
@@ -30,7 +29,9 @@ export function WalletPage() {
|
|||||||
<WalletHeader />
|
<WalletHeader />
|
||||||
<main className={styles.main}>
|
<main className={styles.main}>
|
||||||
<div className={styles.glow} />
|
<div className={styles.glow} />
|
||||||
{noWallet ? (
|
{isLoading || isPortfolioLoading ? (
|
||||||
|
<Spinner fullscreen label="Загрузка" />
|
||||||
|
) : noWallet ? (
|
||||||
<div className={styles.noWallet}>
|
<div className={styles.noWallet}>
|
||||||
<p>У вас пока нет кошелька. Создайте его, чтобы начать.</p>
|
<p>У вас пока нет кошелька. Создайте его, чтобы начать.</p>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -28,6 +28,13 @@
|
|||||||
padding: 24px 0;
|
padding: 24px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spinnerWrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 24px 0;
|
||||||
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
|
|||||||
@@ -100,7 +100,11 @@ export function PoolsTable({ pools, selected, onSelect, loading, error }: Props)
|
|||||||
<span className={styles.title}>Курируемые пулы</span>
|
<span className={styles.title}>Курируемые пулы</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{loading && <Spinner label="Загрузка пулов" />}
|
{loading && (
|
||||||
|
<div className={styles.spinnerWrap}>
|
||||||
|
<Spinner label="Загрузка пулов" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{!loading && error && <div className={styles.message}>{error}</div>}
|
{!loading && error && <div className={styles.message}>{error}</div>}
|
||||||
{!loading && !error && pools.length === 0 && (
|
{!loading && !error && pools.length === 0 && (
|
||||||
<div className={styles.message}>Курируемых пулов пока нет.</div>
|
<div className={styles.message}>Курируемых пулов пока нет.</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useMemo, useState } from 'react'
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
import { Notification } from '@shared/ui'
|
import { Notification } from '@shared/ui'
|
||||||
import { useDebounce } from '@shared/lib/hooks/useDebounce'
|
import { useDebounce } from '@shared/lib/hooks/useDebounce'
|
||||||
import {
|
import {
|
||||||
@@ -56,6 +56,14 @@ export function PoolsWidget() {
|
|||||||
setAmount1('')
|
setAmount1('')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Когда пулы загрузились, автоматически выбираем первый, если ничего не выбрано.
|
||||||
|
useEffect(() => {
|
||||||
|
if (!selected && pools.length > 0) {
|
||||||
|
handleSelect(pools[0].poolAddress)
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [pools, selected])
|
||||||
|
|
||||||
// Дебаунсим вход квоты, чтобы не дёргать /lp/quote на каждый символ.
|
// Дебаунсим вход квоты, чтобы не дёргать /lp/quote на каждый символ.
|
||||||
const dAmount0 = useDebounce(amount0, 400)
|
const dAmount0 = useDebounce(amount0, 400)
|
||||||
const dAmount1 = useDebounce(amount1, 400)
|
const dAmount1 = useDebounce(amount1, 400)
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ export function PositionsPanel({ chain, onUnstakeEth, onUnstakeSol, onClaim, uns
|
|||||||
const solEmpty = data?.chain === 'SOL' && data.positions.length === 0
|
const solEmpty = data?.chain === 'SOL' && data.positions.length === 0
|
||||||
const empty = ethEmpty || solEmpty
|
const empty = ethEmpty || solEmpty
|
||||||
|
|
||||||
console.log(empty, data?.chain, data)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.panel}>
|
<div className={styles.panel}>
|
||||||
<div className={styles.inner}>
|
<div className={styles.inner}>
|
||||||
|
|||||||
Reference in New Issue
Block a user