diff --git a/components/AccountInfo.tsx b/components/AccountInfo.tsx index dfbbfcda..9f4bcc8a 100644 --- a/components/AccountInfo.tsx +++ b/components/AccountInfo.tsx @@ -30,6 +30,7 @@ import useMangoAccount from '../hooks/useMangoAccount' import Loading from './Loading' import CreateAlertModal from './CreateAlertModal' import { useWallet } from '@solana/wallet-adapter-react' +import { useRouter } from 'next/router' const I80F48_100 = I80F48.fromString('100') @@ -48,6 +49,8 @@ export default function AccountInfo() { const [showDepositModal, setShowDepositModal] = useState(false) const [showWithdrawModal, setShowWithdrawModal] = useState(false) const [showAlertsModal, setShowAlertsModal] = useState(false) + const router = useRouter() + const { pubkey } = router.query const canWithdraw = mangoAccount?.owner && publicKey @@ -154,7 +157,9 @@ export default function AccountInfo() { return ( <>
{!isMobile ? ( diff --git a/components/FloatingElement.tsx b/components/FloatingElement.tsx index fb3f5f04..78bad5d8 100644 --- a/components/FloatingElement.tsx +++ b/components/FloatingElement.tsx @@ -6,6 +6,7 @@ import EmptyState from './EmptyState' import { useTranslation } from 'next-i18next' import { handleWalletConnect } from 'components/ConnectWalletButton' import { useWallet } from '@solana/wallet-adapter-react' +import { useRouter } from 'next/router' interface FloatingElementProps { className?: string @@ -21,6 +22,8 @@ const FloatingElement: FunctionComponent = ({ const { wallet, connected } = useWallet() const { uiLocked } = useMangoStore((s) => s.settings) const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current) + const router = useRouter() + const { pubkey } = router.query const handleConnect = useCallback(() => { if (wallet) { @@ -32,7 +35,7 @@ const FloatingElement: FunctionComponent = ({
- {!connected && showConnect ? ( + {!connected && showConnect && !pubkey ? (
{ if (!selectedMarket || !mangoGroup || !mangoGroupCache) return @@ -63,7 +66,7 @@ export default function MarketBalances() { if (!mangoGroup || !selectedMarket || !mangoGroupCache) return null return ( -
+
{!isMobile ? ( {t('balances')} ) : null} diff --git a/components/MarketPosition.tsx b/components/MarketPosition.tsx index 2dd0ba60..7c028935 100644 --- a/components/MarketPosition.tsx +++ b/components/MarketPosition.tsx @@ -21,6 +21,7 @@ import { breakpoints } from './TradePageGrid' import { useTranslation } from 'next-i18next' import useMangoAccount from '../hooks/useMangoAccount' import { useWallet, Wallet } from '@solana/wallet-adapter-react' +import { useRouter } from 'next/router' export const settlePosPnl = async ( perpMarkets: PerpMarket[], @@ -154,6 +155,8 @@ export default function MarketPosition() { const perpAccounts = useMangoStore((s) => s.selectedMangoAccount.perpAccounts) const baseSymbol = marketConfig.baseSymbol const marketName = marketConfig.name + const router = useRouter() + const { pubkey } = router.query const [showMarketCloseModal, setShowMarketCloseModal] = useState(false) const [settling, setSettling] = useState(false) @@ -230,7 +233,7 @@ export default function MarketPosition() { return ( <>
{!isMobile ? (