From 1c3e4de4dda62a60e1167e1cdd3f69ac0f5b582e Mon Sep 17 00:00:00 2001 From: Linkie Link Date: Mon, 19 Feb 2024 15:01:04 +0100 Subject: [PATCH] fix: fix interactions --- src/components/Wallet/index.tsx | 2 +- .../account/AccountBalancesTable/index.tsx | 2 +- .../account/AccountDetails/index.tsx | 2 +- src/components/common/MigrationBanner.tsx | 47 ------------------- src/pages/FarmPage.tsx | 2 - src/pages/HLSFarmPage.tsx | 2 - src/pages/HLSStakingPage.tsx | 2 - src/pages/PortfolioAccountPage.tsx | 2 - src/pages/PortfolioPage.tsx | 2 - src/pages/TradePage.tsx | 2 - 10 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 src/components/common/MigrationBanner.tsx diff --git a/src/components/Wallet/index.tsx b/src/components/Wallet/index.tsx index 7b70ca62..6fd6e29b 100644 --- a/src/components/Wallet/index.tsx +++ b/src/components/Wallet/index.tsx @@ -13,7 +13,7 @@ export default function Wallet() { const address = useStore((s) => s.address) useEffect(() => { - if (address) return + if (address && address === currentWallet?.account.address) return useStore.setState({ address: undefined, userDomain: undefined, diff --git a/src/components/account/AccountBalancesTable/index.tsx b/src/components/account/AccountBalancesTable/index.tsx index a3e00be6..eb678f7c 100644 --- a/src/components/account/AccountBalancesTable/index.tsx +++ b/src/components/account/AccountBalancesTable/index.tsx @@ -47,7 +47,7 @@ export default function AccountBalancesTable(props: Props) { const columns = useAccountBalancesColumns(account, showLiquidationPrice) - if (accountBalanceData.length === 0) + if (accountBalanceData.length === 0 && account.id !== address) return ( s.focusComponent) - const isOwnAccount = accountId && accountIds?.includes(accountId) + const isOwnAccount = (accountId && accountIds?.includes(accountId)) || account?.id === address const hideAccountDetails = !address || focusComponent || !isOwnAccount || isHLS || page.includes('portfolio') const isLoadingAccountDetails = (isLoading && accountId && !focusComponent) || !account diff --git a/src/components/common/MigrationBanner.tsx b/src/components/common/MigrationBanner.tsx deleted file mode 100644 index 65ca6205..00000000 --- a/src/components/common/MigrationBanner.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import Card from 'components/common/Card' -import { Cross, ExclamationMarkCircled } from 'components/common/Icons' -import Text from 'components/common/Text' -import { TextLink } from 'components/common/TextLink' -import { DEFAULT_SETTINGS } from 'constants/defaultSettings' -import { LocalStorageKeys } from 'constants/localStorageKeys' -import useLocalStorage from 'hooks/localStorage/useLocalStorage' -import useStore from 'store' -import { DocURL } from 'types/enums/docURL' - -export default function MigrationBanner() { - const [_, setMigrationBanner] = useLocalStorage( - LocalStorageKeys.MIGRATION_BANNER, - DEFAULT_SETTINGS.migrationBanner, - ) - - const showMigrationBanner = useStore((s) => s.migrationBanner) - - if (!showMigrationBanner) return null - return ( - -
- -
- - If you have funds on{' '} - - Mars v1, - - please withdraw them and deposit them on Mars v2 to migrate. - -
setMigrationBanner(false)} - > - -
-
- ) -} diff --git a/src/pages/FarmPage.tsx b/src/pages/FarmPage.tsx index 8560e9da..6ea644ec 100644 --- a/src/pages/FarmPage.tsx +++ b/src/pages/FarmPage.tsx @@ -1,4 +1,3 @@ -import MigrationBanner from 'components/common/MigrationBanner' import Tab from 'components/common/Tab' import FarmIntro from 'components/farm/FarmIntro' import Vaults from 'components/farm/Vaults' @@ -7,7 +6,6 @@ import { LEND_AND_BORROW_TABS } from 'constants/pages' export default function FarmPage() { return (
- diff --git a/src/pages/HLSFarmPage.tsx b/src/pages/HLSFarmPage.tsx index 019adc78..9ce93cae 100644 --- a/src/pages/HLSFarmPage.tsx +++ b/src/pages/HLSFarmPage.tsx @@ -1,4 +1,3 @@ -import MigrationBanner from 'components/common/MigrationBanner' import Tab from 'components/common/Tab' import AvailableHLSVaults from 'components/hls/Farm/AvailableHLSVaults' import HlsFarmIntro from 'components/hls/Farm/HLSFarmIntro' @@ -7,7 +6,6 @@ import { HLS_TABS } from 'constants/pages' export default function HLSFarmPage() { return (
- diff --git a/src/pages/HLSStakingPage.tsx b/src/pages/HLSStakingPage.tsx index 228b070b..41fc09a7 100644 --- a/src/pages/HLSStakingPage.tsx +++ b/src/pages/HLSStakingPage.tsx @@ -1,4 +1,3 @@ -import MigrationBanner from 'components/common/MigrationBanner' import Tab from 'components/common/Tab' import ActiveStakingAccounts from 'components/hls/Staking/ActiveStakingAccounts' import AvailableHlsStakingAssets from 'components/hls/Staking/AvailableHLSStakingAssets' @@ -8,7 +7,6 @@ import { HLS_TABS } from 'constants/pages' export default function HLSStakingPage() { return (
- diff --git a/src/pages/PortfolioAccountPage.tsx b/src/pages/PortfolioAccountPage.tsx index b0308320..ab0464b5 100644 --- a/src/pages/PortfolioAccountPage.tsx +++ b/src/pages/PortfolioAccountPage.tsx @@ -1,6 +1,5 @@ import { useNavigate, useParams, useSearchParams } from 'react-router-dom' -import MigrationBanner from 'components/common/MigrationBanner' import ShareBar from 'components/common/ShareBar' import Balances from 'components/portfolio/Account/Balances' import BreadCrumbs from 'components/portfolio/Account/BreadCrumbs' @@ -25,7 +24,6 @@ export default function PortfolioAccountPage() { return (
- diff --git a/src/pages/PortfolioPage.tsx b/src/pages/PortfolioPage.tsx index 8094552e..7b0f5802 100644 --- a/src/pages/PortfolioPage.tsx +++ b/src/pages/PortfolioPage.tsx @@ -1,6 +1,5 @@ import { useParams } from 'react-router-dom' -import MigrationBanner from 'components/common/MigrationBanner' import ShareBar from 'components/common/ShareBar' import Summary from 'components/portfolio/Account/Summary' import AccountOverview from 'components/portfolio/Overview' @@ -11,7 +10,6 @@ export default function PortfolioPage() { const { address } = useParams() return (
- {address && } diff --git a/src/pages/TradePage.tsx b/src/pages/TradePage.tsx index 0a27a128..34eef272 100644 --- a/src/pages/TradePage.tsx +++ b/src/pages/TradePage.tsx @@ -1,7 +1,6 @@ import { useMemo } from 'react' import { useLocation } from 'react-router-dom' -import MigrationBanner from 'components/common/MigrationBanner' import AccountDetailsCard from 'components/trade/AccountDetailsCard' import TradeChart from 'components/trade/TradeChart' import TradeModule from 'components/trade/TradeModule' @@ -47,7 +46,6 @@ export default function TradePage() { ) return (
-