diff --git a/src/features/pools/api/poolsApi.ts b/src/features/pools/api/poolsApi.ts index 5e12c96..d187e5b 100644 --- a/src/features/pools/api/poolsApi.ts +++ b/src/features/pools/api/poolsApi.ts @@ -261,7 +261,7 @@ export function getPoolsErrorMessage(e: unknown): string { if (typeof msg === 'string') return msg } if (e instanceof Error) { - return e.message === 'Unauthorized' ? 'Сессия истекла — войдите снова.' : e.message + return e.message === 'Unauthorized' ? 'Сессия истекла — перезагрузите страницу.' : e.message } return 'Произошла ошибка. Попробуйте ещё раз.' } diff --git a/src/features/staking/api/stakingApi.ts b/src/features/staking/api/stakingApi.ts index d08f634..d62caf6 100644 --- a/src/features/staking/api/stakingApi.ts +++ b/src/features/staking/api/stakingApi.ts @@ -269,7 +269,7 @@ export function getStakingErrorMessage(e: unknown): string { if (typeof msg === 'string') return msg } if (e instanceof Error) { - return e.message === 'Unauthorized' ? 'Сессия истекла — войдите снова.' : e.message + return e.message === 'Unauthorized' ? 'Сессия истекла — перезагрузите страницу.' : e.message } return 'Произошла ошибка. Попробуйте ещё раз.' } diff --git a/src/widgets/pools/ui/LpDepositCard.module.css b/src/widgets/pools/ui/LpDepositCard.module.css index a725ad6..19a5e1a 100644 --- a/src/widgets/pools/ui/LpDepositCard.module.css +++ b/src/widgets/pools/ui/LpDepositCard.module.css @@ -44,10 +44,23 @@ .amounts { display: flex; flex-direction: column; - gap: 10px; + gap: 14px; margin-bottom: 20px; } +.amountField { + display: flex; + flex-direction: column; + gap: 6px; +} + +.balance { + font-size: 13px; + color: var(--text-secondary); + text-align: right; + padding: 0 4px; +} + .amountRow { display: flex; align-items: center; diff --git a/src/widgets/pools/ui/LpDepositCard.tsx b/src/widgets/pools/ui/LpDepositCard.tsx index ed47608..b854216 100644 --- a/src/widgets/pools/ui/LpDepositCard.tsx +++ b/src/widgets/pools/ui/LpDepositCard.tsx @@ -1,6 +1,7 @@ import { PrimaryButton } from '@shared/ui' import { truncateDecimals } from '@shared/lib/utils/truncateDecimals' import type { Pool, LpQuote } from '@features/pools' +import { useWalletBalance, type WalletBalanceData } from '@features/wallet' import { formatFeeTier } from '../model/meta' import styles from './LpDepositCard.module.css' @@ -25,32 +26,44 @@ interface Props { const DASH = '—' const decimalRe = /^(\d+\.?\d*|\.?\d*)$/ +// Баланс ноги по символу: нативный токен (chain === символ) берём из native, остальное — из tokens. +function legBalance(wb: WalletBalanceData | undefined, symbol: string): string { + if (!wb) return '0' + if (symbol === wb.chain) return wb.native.formatted + return wb.tokens[symbol]?.formatted ?? '0' +} + function AmountInput({ symbol, value, onChange, + balance, }: { symbol: string value: string onChange: (v: string) => void + balance: string }) { return ( -
- { - const v = e.target.value - if (decimalRe.test(v) || v === '') onChange(v) - }} - placeholder="0" - aria-label={`Сумма ${symbol}`} - /> -
- {symbol} +
+
+ { + const v = e.target.value + if (decimalRe.test(v) || v === '') onChange(v) + }} + placeholder="0" + aria-label={`Сумма ${symbol}`} + /> +
+ {symbol} +
+ Баланс: {truncateDecimals(balance, 6)} {symbol}
) } @@ -99,6 +112,8 @@ export function LpDepositCard({ onSlippageChange, onSubmit, }: Props) { + const { data: walletBalance } = useWalletBalance('ETH') + if (!pool) { return (
@@ -133,8 +148,18 @@ export function LpDepositCard({ Суммы взноса
- - + +
Диапазон цен ({pool.symbol1} за {pool.symbol0})