diff --git a/apps/ui/src/components/molecules/connectWalletButton/connectWalletButton.tsx b/apps/ui/src/components/molecules/connectWalletButton/connectWalletButton.tsx index d9977f5..8dea4ec 100644 --- a/apps/ui/src/components/molecules/connectWalletButton/connectWalletButton.tsx +++ b/apps/ui/src/components/molecules/connectWalletButton/connectWalletButton.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import classNames from 'classnames'; import style from './index.module.css'; @@ -24,8 +24,9 @@ const ConnectWalletButton = ({ handleAddress }: { handleAddress: (value: boolean }; const address = accountId?.[0]; - - handleAddress(!address); + useEffect(() => { + handleAddress(!address); + }); const handleConnect = () => { setShowPopup(true); diff --git a/apps/ui/src/components/molecules/imageSuspense/index.tsx b/apps/ui/src/components/molecules/imageSuspense/index.tsx index 19de193..fc57d57 100644 --- a/apps/ui/src/components/molecules/imageSuspense/index.tsx +++ b/apps/ui/src/components/molecules/imageSuspense/index.tsx @@ -55,13 +55,7 @@ const ImgSuspense = ({ /> {((!isLoaded && fallback) || !isLoaded || isLoading) && (
- preloader + preloader
)} diff --git a/apps/ui/src/components/organisms/pageHeader/pageHeader.tsx b/apps/ui/src/components/organisms/pageHeader/pageHeader.tsx index 91162fd..b583fb7 100644 --- a/apps/ui/src/components/organisms/pageHeader/pageHeader.tsx +++ b/apps/ui/src/components/organisms/pageHeader/pageHeader.tsx @@ -10,7 +10,7 @@ import style from './index.module.css'; import { formatNum } from '../../../comman/helpers'; import { useBalances } from '../../../store/hooks/useBalances'; -const PageHeader = () => { +const PageHeader = ({ isStakeAvailable }: { isStakeAvailable: boolean }): JSX.Element => { const [openStakeModul, setOpenStaekeModul] = useState(false); const [isDisableStakeButton, setIsDisableStakeButton] = useState(true); const { accountId, balance: balanceByWallet } = useWallet(); @@ -32,7 +32,7 @@ const PageHeader = () => { text="Stake" variant={Variant.blue} onClick={() => setOpenStaekeModul(true)} - disabled={isDisableStakeButton} + disabled={isDisableStakeButton || !isStakeAvailable} /> setOpenStaekeModul(false)} /> diff --git a/apps/ui/src/pages/index.tsx b/apps/ui/src/pages/index.tsx index 25b49a7..018a4aa 100644 --- a/apps/ui/src/pages/index.tsx +++ b/apps/ui/src/pages/index.tsx @@ -30,6 +30,8 @@ export default function Home(): JSX.Element { useObserveBalance(); usePollBlockHeight(); + const isStakeAvailable = activTab === tabSwitcherOptions[1]; + useEffect(() => { if (window.localStorage.getItem('isConnectedAuro') === 'true') { initAccount(); @@ -45,7 +47,7 @@ export default function Home(): JSX.Element {
- +
diff --git a/apps/ui/src/store/wallet/walletSlice.ts b/apps/ui/src/store/wallet/walletSlice.ts index 2f97519..2284d76 100644 --- a/apps/ui/src/store/wallet/walletSlice.ts +++ b/apps/ui/src/store/wallet/walletSlice.ts @@ -42,7 +42,7 @@ export const walletSlice = createSlice({ }; }, addPendingTransaction: (state, action: PayloadAction) => { - state.pendingTransactions.push(action.payload); + state.pendingTransactions?.push(action.payload); }, removePendingTransaction: (state, action: PayloadAction) => { state.pendingTransactions = state.pendingTransactions.filter((tx) => {