diff --git a/src/app/providers/RouterProvider.tsx b/src/app/providers/RouterProvider.tsx
index a631e49..e6e9710 100644
--- a/src/app/providers/RouterProvider.tsx
+++ b/src/app/providers/RouterProvider.tsx
@@ -26,9 +26,8 @@ export function RouterProvider() {
} />
- } />
-
}>
+ } />
} />
} />
} />
diff --git a/src/pages/profile/ui/ProfilePage.tsx b/src/pages/profile/ui/ProfilePage.tsx
index b439301..bb3a56a 100644
--- a/src/pages/profile/ui/ProfilePage.tsx
+++ b/src/pages/profile/ui/ProfilePage.tsx
@@ -1,4 +1,7 @@
+import { useNavigate } from 'react-router-dom'
import { useMe } from '@features/auth'
+import { usePortfolio } from '@features/wallet'
+import { ROUTES } from '@shared/config/routes'
import { Button, FormField } from '@shared/ui'
import { WalletHeader } from '@widgets/wallet-header'
import { ProfileAvatar, ProfileSection } from '@widgets/profile'
@@ -6,11 +9,19 @@ import styles from './ProfilePage.module.css'
export function ProfilePage() {
const { data } = useMe()
+ const { data: portfolio, isLoading: isPortfolioLoading } = usePortfolio()
+ const navigate = useNavigate()
+ const capitalize = (s: string) => (s ? s[0].toUpperCase() + s.slice(1).toLowerCase() : '')
const fullName = data
- ? [data.last_name, data.first_name, data.middle_name].filter(Boolean).join(' ')
+ ? [data.last_name, data.first_name, data.middle_name].filter(Boolean).map(capitalize).join(' ')
: ''
+ const userBalance =
+ isPortfolioLoading || !portfolio || portfolio.totalUsd == null
+ ? '$—'
+ : `$${portfolio.totalUsd.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`
+
return (
@@ -24,8 +35,8 @@ export function ProfilePage() {
{fullName}
- $245.00
- ≈ 22 340,50 ₽
+ {userBalance}
+ {/* ≈ 22 340,50 ₽ */}
@@ -66,7 +77,7 @@ export function ProfilePage() {
🔑
Сид-фраза из 12 слов для восстановления кошелька
-
+
diff --git a/src/widgets/converter-page/ui/ConverterSection.tsx b/src/widgets/converter-page/ui/ConverterSection.tsx
index 9229008..778fe2e 100644
--- a/src/widgets/converter-page/ui/ConverterSection.tsx
+++ b/src/widgets/converter-page/ui/ConverterSection.tsx
@@ -61,7 +61,7 @@ export function ConverterSection() {
>
КУПИТЬ
-
+ */}
@@ -141,7 +141,7 @@ export function ConverterSection() {
type="button"
className={styles.payBtn}
onClick={handlePay}
- disabled={!rubTotal || isPending}
+ disabled={!rubTotal || isPending || !c.agreed}
>
{isPending ? 'Обработка...' : 'Оплатить'}
diff --git a/src/widgets/wallet-header/ui/WalletHeader.tsx b/src/widgets/wallet-header/ui/WalletHeader.tsx
index e6c270d..004afad 100644
--- a/src/widgets/wallet-header/ui/WalletHeader.tsx
+++ b/src/widgets/wallet-header/ui/WalletHeader.tsx
@@ -7,14 +7,21 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'
import { useNavigate } from 'react-router-dom'
import { logout } from '@features/auth/api/registrationApi'
import { AUTH_QUERY_KEY, useMe } from '@features/auth'
+import { usePrices } from '@features/wallet'
import { tokenStore } from '@shared/api/tokenStore'
import { Notification } from '@shared/ui'
-const TICKERS = [
- { symbol: 'BTC', price: '$66,916.00', change: 0.12, },
- { symbol: 'ETH', price: '$2,053.97', change: -0.12 },
- { symbol: 'SOL', price: '$163.84', change: -1.57 },
-]
+const TICKER_SYMBOLS = ['BTC', 'ETH', 'SOL']
+
+const capitalize = (s: string) => (s ? s[0].toUpperCase() + s.slice(1).toLowerCase() : '')
+
+function formatPrice(value: number | null | undefined): string {
+ if (value == null) return '$—'
+ if (value >= 1) {
+ return `$${value.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`
+ }
+ return `$${value.toLocaleString('en-US', { minimumFractionDigits: 4, maximumFractionDigits: 6 })}`
+}
export function WalletHeader() {
const [open, setOpen] = useState(false)
@@ -23,7 +30,10 @@ export function WalletHeader() {
const navigate = useNavigate()
const queryClient = useQueryClient()
const { data: me } = useMe()
- const fullName = me ? `${me.first_name} ${me.middle_name}`.trim() : ''
+ const { data: prices } = usePrices(TICKER_SYMBOLS)
+ const fullName = me
+ ? [me.first_name, me.middle_name].filter(Boolean).map(capitalize).join(' ')
+ : ''
const { mutate: logoutMutate } = useMutation({
mutationFn: logout,
@@ -57,13 +67,10 @@ export function WalletHeader() {
- {TICKERS.map(({ symbol, price, change }) => (
+ {TICKER_SYMBOLS.map((symbol) => (
{symbol}
- {price}
- = 0 ? styles.up : styles.dn}>
- {change >= 0 ? '+' : ''}{change}%
-
+ {formatPrice(prices?.[symbol]?.usd)}
))}