profile refactor

This commit is contained in:
2026-06-29 18:13:56 +03:00
parent 237112c302
commit d247e41d25
12 changed files with 272 additions and 200 deletions

View File

@@ -0,0 +1,6 @@
.hint {
margin: 0;
font-size: 14px;
line-height: 1.6;
color: var(--text-secondary);
}

View File

@@ -1,10 +1,32 @@
import { useMe } from '@features/auth'
import { MnemonicSection } from '@widgets/profile'
import { Spinner } from '@shared/ui'
import { useState } from 'react'
import { useRevealMnemonic } from '@features/wallet'
import { SeedPhraseWidget } from '@widgets/seed-phrase'
import { ProfileSection } from '@widgets/profile'
import { Button, Spinner } from '@shared/ui'
import styles from './MnemonicItem.module.css'
// «Мнемоническая фраза» dashboard item.
// «Мнемоническая фраза» dashboard item. The mnemonic is fetched only after the
// user explicitly clicks "Показать мнемонику" (the query stays disabled until
// then), then the seed-phrase content is shown inline.
export function MnemonicItem() {
const { isLoading } = useMe()
const [revealed, setRevealed] = useState(false)
const { data: mnemonic, isLoading } = useRevealMnemonic(revealed)
if (!revealed) {
return (
<ProfileSection
title="Мнемоническая фраза"
actions={<Button variant="danger" onClick={() => setRevealed(true)}>Показать мнемонику</Button>}
>
<p className={styles.hint}>
Сид-фраза из 12 слов для восстановления кошелька. Никогда не передавайте её третьим лицам.
</p>
</ProfileSection>
)
}
if (isLoading) return <Spinner fullscreen label="Загрузка" />
return <MnemonicSection />
const words = mnemonic ? mnemonic.split(' ') : []
return <SeedPhraseWidget words={words} showProfileLink={false} />
}