fix: fixed accountId usage (#491)
* fix: fixed accountId usage * fix: fixed rewards center * fix: copy fix
This commit is contained in:
parent
2ba18d2f05
commit
574dedec23
@ -1,4 +1,5 @@
|
||||
import classNames from 'classnames'
|
||||
import useAccountId from 'hooks/useAccountId'
|
||||
import { NavLink, useParams } from 'react-router-dom'
|
||||
|
||||
import { getRoute } from 'utils/route'
|
||||
@ -11,7 +12,8 @@ interface Props {
|
||||
}
|
||||
|
||||
export default function Tab(props: Props) {
|
||||
const { address, accountId } = useParams()
|
||||
const accountId = useAccountId()
|
||||
const { address } = useParams()
|
||||
|
||||
return (
|
||||
<div className='relative w-full mb-4'>
|
||||
|
@ -7,7 +7,7 @@ import DesktopNavigation from 'components/Navigation/DesktopNavigation'
|
||||
import RewardsCenter from 'components/RewardsCenter'
|
||||
import Settings from 'components/Settings'
|
||||
import Wallet from 'components/Wallet'
|
||||
import useCurrentAccount from 'hooks/useCurrentAccount'
|
||||
import useAccountId from 'hooks/useAccountId'
|
||||
import useStore from 'store'
|
||||
|
||||
export const menuTree: { pages: Page[]; label: string }[] = [
|
||||
@ -20,7 +20,7 @@ export const menuTree: { pages: Page[]; label: string }[] = [
|
||||
export default function DesktopHeader() {
|
||||
const address = useStore((s) => s.address)
|
||||
const focusComponent = useStore((s) => s.focusComponent)
|
||||
const currentAccount = useCurrentAccount()
|
||||
const accountId = useAccountId()
|
||||
|
||||
function handleCloseFocusMode() {
|
||||
if (focusComponent && focusComponent.onClose) focusComponent.onClose()
|
||||
@ -52,7 +52,7 @@ export default function DesktopHeader() {
|
||||
</div>
|
||||
) : (
|
||||
<div className='flex gap-4'>
|
||||
{currentAccount && <RewardsCenter />}
|
||||
{accountId && <RewardsCenter />}
|
||||
{address && <AccountMenu />}
|
||||
<Wallet />
|
||||
<Settings />
|
||||
|
@ -8,11 +8,8 @@ import { Logo } from 'components/Icons'
|
||||
import Overlay from 'components/Overlay'
|
||||
import Text from 'components/Text'
|
||||
import { ASSETS } from 'constants/assets'
|
||||
import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
|
||||
import { DISPLAY_CURRENCY_KEY } from 'constants/localStore'
|
||||
import { ORACLE_DENOM } from 'constants/oracle'
|
||||
import useCurrentAccount from 'hooks/useCurrentAccount'
|
||||
import useLocalStorage from 'hooks/useLocalStorage'
|
||||
import useAccountId from 'hooks/useAccountId'
|
||||
import usePrices from 'hooks/usePrices'
|
||||
import useToggle from 'hooks/useToggle'
|
||||
import useUnclaimedRewards from 'hooks/useUnclaimedRewards'
|
||||
@ -43,8 +40,7 @@ const renderIncentives = (unclaimedRewards: BNCoin[]) => {
|
||||
}
|
||||
|
||||
export default function RewardsCenter() {
|
||||
const account = useCurrentAccount()
|
||||
const accountId = account?.id
|
||||
const accountId = useAccountId()
|
||||
const [isConfirming, setIsConfirming] = useState(false)
|
||||
const [estimatedFee, setEstimatedFee] = useState(defaultFee)
|
||||
const [showRewardsCenter, setShowRewardsCenter] = useToggle()
|
||||
|
@ -2,7 +2,7 @@ import useSWR from 'swr'
|
||||
|
||||
import getAccount from 'api/accounts/getAccount'
|
||||
|
||||
export default function useAccounts(accountId?: string, suspense?: boolean) {
|
||||
export default function useAccount(accountId?: string, suspense?: boolean) {
|
||||
return useSWR(`account${accountId}`, () => getAccount(accountId || ''), {
|
||||
suspense: suspense,
|
||||
revalidateOnFocus: false,
|
||||
|
Loading…
Reference in New Issue
Block a user