diff --git a/__tests__/components/Account/AccountDetails.test.tsx b/__tests__/components/Account/AccountDetails.test.tsx
index 5dc5e226..90b1de80 100644
--- a/__tests__/components/Account/AccountDetails.test.tsx
+++ b/__tests__/components/Account/AccountDetails.test.tsx
@@ -14,11 +14,15 @@ jest.mock('hooks/useHealthComputer', () =>
jest.mock('components/Account/AccountBalancesTable', () => jest.fn(() => null))
const mockedUseCurrentAccount = useCurrentAccount as jest.Mock
+const mockedAccount = { id: '1', deposits: [], lends: [], debts: [], vaults: [] }
+jest.mock('hooks/useAccountId', () => jest.fn(() => '1'))
+jest.mock('hooks/useAccounts', () => jest.fn(() => [mockedAccount]))
describe('', () => {
beforeAll(() => {
useStore.setState({
address: 'walletAddress',
+ accounts: [mockedAccount],
})
})
@@ -27,7 +31,7 @@ describe('', () => {
})
it('renders account details WHEN account is selected', () => {
- mockedUseCurrentAccount.mockReturnValue({ id: 1 })
+ mockedUseCurrentAccount.mockReturnValue(mockedAccount)
render()
const container = screen.queryByTestId('account-details')
diff --git a/__tests__/components/MarketAssetTable/MarketDetails.test.tsx b/__tests__/components/MarketAssetTable/MarketDetails.test.tsx
index 9f35977b..75b193c4 100644
--- a/__tests__/components/MarketAssetTable/MarketDetails.test.tsx
+++ b/__tests__/components/MarketAssetTable/MarketDetails.test.tsx
@@ -13,6 +13,7 @@ const data: LendingMarketTableData = {
marketLiquidityRate: 0.017,
marketLiquidationThreshold: 0.61,
marketMaxLtv: 0.59,
+ borrowEnabled: true,
}
jest.mock('hooks/useDisplayCurrencyPrice', () => () => {
diff --git a/__tests__/components/Modals/Unlock/UnlockModal.test.tsx b/__tests__/components/Modals/Unlock/UnlockModal.test.tsx
index de734ecc..2297fa19 100644
--- a/__tests__/components/Modals/Unlock/UnlockModal.test.tsx
+++ b/__tests__/components/Modals/Unlock/UnlockModal.test.tsx
@@ -28,6 +28,8 @@ const mockedDepositedVault: DepositedVault = {
values: {
primary: BN_ZERO,
secondary: BN_ZERO,
+ unlocked: BN_ZERO,
+ unlocking: BN_ZERO,
},
cap: {
denom: 'mock',
diff --git a/src/components/Account/AccountDetails/Skeleton.tsx b/src/components/Account/AccountDetails/Skeleton.tsx
new file mode 100644
index 00000000..dd25cdc5
--- /dev/null
+++ b/src/components/Account/AccountDetails/Skeleton.tsx
@@ -0,0 +1,36 @@
+import { HealthGauge } from 'components/HealthGauge'
+import Loading from 'components/Loading'
+import Text from 'components/Text'
+
+export default function Skeleton() {
+ return (
+
+
+
+
+
+ Account Health
+
+
+
+
+ Net worth
+
+
+
+
+
+ Leverage
+
+
+
+
+
+ APR
+
+
+
+
+
+ )
+}
diff --git a/src/components/Account/AccountDetails/index.tsx b/src/components/Account/AccountDetails/index.tsx
index 15cb1b05..70a06c12 100644
--- a/src/components/Account/AccountDetails/index.tsx
+++ b/src/components/Account/AccountDetails/index.tsx
@@ -1,9 +1,11 @@
import classNames from 'classnames'
-import { useMemo } from 'react'
+import { useCallback, useMemo } from 'react'
import AccountBalancesTable from 'components/Account/AccountBalancesTable'
import AccountComposition from 'components/Account/AccountComposition'
import AccountDetailsLeverage from 'components/Account/AccountDetails/AccountDetailsLeverage'
+import Skeleton from 'components/Account/AccountDetails/Skeleton'
+import EscButton from 'components/Button/EscButton'
import { glowElement } from 'components/Button/utils'
import Card from 'components/Card'
import DisplayCurrency from 'components/DisplayCurrency'
@@ -14,6 +16,8 @@ import Text from 'components/Text'
import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
import { REDUCE_MOTION_KEY } from 'constants/localStore'
import { ORACLE_DENOM } from 'constants/oracle'
+import useAccountId from 'hooks/useAccountId'
+import useAccounts from 'hooks/useAccounts'
import useBorrowMarketAssetsTableData from 'hooks/useBorrowMarketAssetsTableData'
import useCurrentAccount from 'hooks/useCurrentAccount'
import useHealthComputer from 'hooks/useHealthComputer'
@@ -29,11 +33,15 @@ import {
} from 'utils/accounts'
export default function AccountDetailsController() {
- const account = useCurrentAccount()
const address = useStore((s) => s.address)
+ const { isLoading } = useAccounts(address)
+ const accountId = useAccountId()
+ const account = useCurrentAccount()
const focusComponent = useStore((s) => s.focusComponent)
- if (!account || !address || focusComponent) return null
+ if (!address || focusComponent) return null
+
+ if ((isLoading && accountId && !focusComponent) || !account) return
return
}
@@ -81,6 +89,19 @@ function AccountDetails(props: Props) {
[account, borrowAssetsData, lendingAssetsData, prices],
)
+ function AccountDetailsHeader() {
+ const onClose = useCallback(() => useStore.setState({ accountDetailsExpanded: false }), [])
+
+ return (
+
+
+ {`Credit Account ${account.id}`}
+
+
+
+ )
+ }
+
return (
-
+ }>
Balances
void
-}
-
-const accountCardHeaderClasses = classNames(
- 'flex w-full items-center justify-between bg-white/20 px-4 py-2.5 text-white/70',
- 'border border-transparent border-b-white/20',
- 'group-hover/account:bg-white/30',
-)
-
-export default function AccountList(props: Props) {
- const { accounts, setShowMenu } = props
- const navigate = useNavigate()
- const { pathname } = useLocation()
- const { address } = useParams()
- const { data: prices } = usePrices()
- const account = useCurrentAccount()
- const accountId = account?.id
-
- const deleteAccountHandler = useCallback(() => {
- if (!account) return
- useStore.setState({ accountDeleteModal: account })
- }, [account])
-
- useEffect(() => {
- if (!accountId) return
- const element = document.getElementById(`account-${accountId}`)
- if (element) {
- element.scrollIntoView({ behavior: 'smooth' })
- }
- }, [accountId])
-
- if (!accounts?.length) return null
-
- return (
-
- {accounts.map((account) => {
- const positionBalance = calculateAccountBalanceValue(account, prices)
- const isActive = accountId === account.id
-
- return (
-
-
{
- if (isActive) return
- useStore.setState({ accountDeleteModal: null })
- navigate(getRoute(getPage(pathname), address, account.id))
- }}
- title={
-
-
- Credit Account {account.id}
-
-
-
- }
- >
- {isActive ? (
- <>
-
-
-
}
- onClick={() => {
- setShowMenu(false)
- if (positionBalance.isLessThanOrEqualTo(0)) {
- useStore.setState({
- focusComponent: {
- component:
,
- onClose: () => {
- useStore.setState({ getStartedModal: true })
- },
- },
- })
- return
- }
- useStore.setState({ fundAndWithdrawModal: 'fund' })
- }}
- />
-
}
- text='Withdraw'
- onClick={() => {
- setShowMenu(false)
- useStore.setState({ fundAndWithdrawModal: 'withdraw' })
- }}
- disabled={positionBalance.isLessThanOrEqualTo(0)}
- />
-
}
- text='Delete'
- onClick={() => {
- setShowMenu(false)
- deleteAccountHandler()
- }}
- />
-
-
- >
- ) : (
-
- )}
-
-
- )
- })}
-
- )
-}
diff --git a/src/components/Account/AccountList/AccountStats.tsx b/src/components/Account/AccountList/AccountStats.tsx
new file mode 100644
index 00000000..92a656e2
--- /dev/null
+++ b/src/components/Account/AccountList/AccountStats.tsx
@@ -0,0 +1,112 @@
+import { useCallback, useMemo } from 'react'
+
+import AccountFundFullPage from 'components/Account/AccountFund/AccountFundFullPage'
+import Skeleton from 'components/Account/AccountList/Skeleton'
+import Button from 'components/Button'
+import { ArrowDownLine, ArrowUpLine, TrashBin } from 'components/Icons'
+import SwitchAutoLend from 'components/Switch/SwitchAutoLend'
+import useAccount from 'hooks/useAccount'
+import useBorrowMarketAssetsTableData from 'hooks/useBorrowMarketAssetsTableData'
+import useHealthComputer from 'hooks/useHealthComputer'
+import useLendingMarketAssetsTableData from 'hooks/useLendingMarketAssetsTableData'
+import usePrices from 'hooks/usePrices'
+import useStore from 'store'
+import { calculateAccountApr, calculateAccountBalanceValue } from 'utils/accounts'
+
+interface Props {
+ accountId: string
+ isActive?: boolean
+ setShowMenu?: (show: boolean) => void
+}
+
+export default function AccountStats(props: Props) {
+ const { accountId, isActive, setShowMenu } = props
+ const { data: account } = useAccount(accountId)
+ const { data: prices } = usePrices()
+ const positionBalance = useMemo(
+ () => (!account ? null : calculateAccountBalanceValue(account, prices)),
+ [account, prices],
+ )
+ const { health } = useHealthComputer(account)
+ const { availableAssets: borrowAvailableAssets, accountBorrowedAssets } =
+ useBorrowMarketAssetsTableData()
+ const { availableAssets: lendingAvailableAssets, accountLentAssets } =
+ useLendingMarketAssetsTableData()
+ const borrowAssetsData = useMemo(
+ () => [...borrowAvailableAssets, ...accountBorrowedAssets],
+ [borrowAvailableAssets, accountBorrowedAssets],
+ )
+ const lendingAssetsData = useMemo(
+ () => [...lendingAvailableAssets, ...accountLentAssets],
+ [lendingAvailableAssets, accountLentAssets],
+ )
+ const apr = useMemo(
+ () =>
+ !account ? null : calculateAccountApr(account, borrowAssetsData, lendingAssetsData, prices),
+ [account, borrowAssetsData, lendingAssetsData, prices],
+ )
+
+ const deleteAccountHandler = useCallback(() => {
+ if (!account) return
+ useStore.setState({ accountDeleteModal: account })
+ }, [account])
+
+ return (
+
+
+ {isActive && setShowMenu && (
+
+
}
+ disabled={!positionBalance}
+ onClick={() => {
+ setShowMenu(false)
+ if (!positionBalance) return
+ if (positionBalance.isLessThanOrEqualTo(0)) {
+ useStore.setState({
+ focusComponent: {
+ component:
,
+ onClose: () => {
+ useStore.setState({ getStartedModal: true })
+ },
+ },
+ })
+ return
+ }
+ useStore.setState({ fundAndWithdrawModal: 'fund' })
+ }}
+ />
+
}
+ text='Withdraw'
+ onClick={() => {
+ setShowMenu(false)
+ useStore.setState({ fundAndWithdrawModal: 'withdraw' })
+ }}
+ disabled={!positionBalance || positionBalance.isLessThanOrEqualTo(0)}
+ />
+
}
+ text='Delete'
+ disabled={!account}
+ onClick={() => {
+ setShowMenu(false)
+ deleteAccountHandler()
+ }}
+ />
+
+
+ )}
+
+ )
+}
diff --git a/src/components/Account/AccountList/Skeleton.tsx b/src/components/Account/AccountList/Skeleton.tsx
new file mode 100644
index 00000000..64ff6c11
--- /dev/null
+++ b/src/components/Account/AccountList/Skeleton.tsx
@@ -0,0 +1,52 @@
+import HealthBar from 'components/Account/HealthBar'
+import DisplayCurrency from 'components/DisplayCurrency'
+import { FormattedNumber } from 'components/FormattedNumber'
+import { ArrowChartLineUp, Heart } from 'components/Icons'
+import Loading from 'components/Loading'
+import Text from 'components/Text'
+import { ORACLE_DENOM } from 'constants/oracle'
+import { BNCoin } from 'types/classes/BNCoin'
+
+interface Props {
+ health: number
+ positionBalance: BigNumber | null
+ apr: BigNumber | null
+}
+
+export default function Skeleton(props: Props) {
+ const { positionBalance, apr, health } = props
+ return (
+
+ {positionBalance ? (
+
+ ) : (
+
+ )}
+
+
+
+
+ {apr ? (
+
+ ) : (
+
+ )}
+
+
+
+
+ Health
+
+
+
+
+
+ )
+}
diff --git a/src/components/Account/AccountList/index.tsx b/src/components/Account/AccountList/index.tsx
new file mode 100644
index 00000000..29f96b49
--- /dev/null
+++ b/src/components/Account/AccountList/index.tsx
@@ -0,0 +1,75 @@
+import classNames from 'classnames'
+import { useEffect } from 'react'
+import { useLocation, useNavigate, useParams } from 'react-router-dom'
+
+import AccountStats from 'components/Account/AccountList/AccountStats'
+import Card from 'components/Card'
+import Radio from 'components/Radio'
+import Text from 'components/Text'
+import useAccountId from 'hooks/useAccountId'
+import useAccountIds from 'hooks/useAccountIds'
+import useStore from 'store'
+import { getPage, getRoute } from 'utils/route'
+
+interface Props {
+ setShowMenu: (show: boolean) => void
+}
+
+const accountCardHeaderClasses = classNames(
+ 'flex w-full items-center justify-between bg-white/20 px-4 py-2.5 text-white/70',
+ 'border border-transparent border-b-white/20',
+ 'group-hover/account:bg-white/30',
+)
+
+export default function AccountList(props: Props) {
+ const { setShowMenu } = props
+ const navigate = useNavigate()
+ const { pathname } = useLocation()
+ const currentAccountId = useAccountId()
+ const { address } = useParams()
+ const { data: accountIds } = useAccountIds(address)
+
+ useEffect(() => {
+ if (!currentAccountId) return
+ const element = document.getElementById(`account-${currentAccountId}`)
+ if (element) {
+ element.scrollIntoView({ behavior: 'smooth' })
+ }
+ }, [currentAccountId])
+
+ if (!accountIds?.length) return null
+
+ return (
+
+ {accountIds.map((accountId) => {
+ const isActive = currentAccountId === accountId
+
+ return (
+
+
{
+ if (isActive) return
+ useStore.setState({ accountDeleteModal: null })
+ navigate(getRoute(getPage(pathname), address, accountId))
+ }}
+ title={
+
+
+ Credit Account {accountId}
+
+
+
+ }
+ >
+
+
+
+ )
+ })}
+
+ )
+}
diff --git a/src/components/Account/AccountMenu.tsx b/src/components/Account/AccountMenu.tsx
index 45d6f25a..91bb2b0c 100644
--- a/src/components/Account/AccountMenu.tsx
+++ b/src/components/Account/AccountMenu.tsx
@@ -2,15 +2,15 @@ import { Suspense } from 'react'
import AccountMenuContent from 'components/Account/AccountMenuContent'
import Loading from 'components/Loading'
-import useAccounts from 'hooks/useAccounts'
+import useAccountIds from 'hooks/useAccountIds'
import useStore from 'store'
function Content() {
const address = useStore((s) => s.address)
- const { data: accounts, isLoading } = useAccounts(address)
+ const { data: accountIds, isLoading } = useAccountIds(address)
if (isLoading) return
- if (!accounts) return null
- return
+ if (!accountIds) return null
+ return
}
export default function AccountMenu() {
diff --git a/src/components/Account/AccountMenuContent.tsx b/src/components/Account/AccountMenuContent.tsx
index 56a8454b..324101c1 100644
--- a/src/components/Account/AccountMenuContent.tsx
+++ b/src/components/Account/AccountMenuContent.tsx
@@ -6,7 +6,6 @@ import AccountCreateFirst from 'components/Account/AccountCreateFirst'
import AccountFund from 'components/Account/AccountFund/AccountFundFullPage'
import AccountList from 'components/Account/AccountList'
import Button from 'components/Button'
-import { CircularProgress } from 'components/CircularProgress'
import { Account, Plus, PlusCircled } from 'components/Icons'
import Overlay from 'components/Overlay'
import Text from 'components/Text'
@@ -14,6 +13,7 @@ import WalletBridges from 'components/Wallet/WalletBridges'
import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
import { LEND_ASSETS_KEY } from 'constants/localStore'
import useAccountId from 'hooks/useAccountId'
+import useAccountIds from 'hooks/useAccountIds'
import useAutoLend from 'hooks/useAutoLend'
import useCurrentWalletBalance from 'hooks/useCurrentWalletBalance'
import useLocalStorage from 'hooks/useLocalStorage'
@@ -27,14 +27,11 @@ import { getPage, getRoute } from 'utils/route'
const menuClasses = 'absolute isolate flex w-full flex-wrap scrollbar-hide'
const ACCOUNT_MENU_BUTTON_ID = 'account-menu-button'
-interface Props {
- accounts: Account[]
-}
-
-export default function AccountMenuContent(props: Props) {
+export default function AccountMenuContent() {
const navigate = useNavigate()
const { pathname } = useLocation()
const { address } = useParams()
+ const { data: accountIds } = useAccountIds(address)
const accountId = useAccountId()
const createAccount = useStore((s) => s.createAccount)
@@ -45,13 +42,9 @@ export default function AccountMenuContent(props: Props) {
const [lendAssets] = useLocalStorage(LEND_ASSETS_KEY, DEFAULT_SETTINGS.lendAssets)
const { enableAutoLendAccountId } = useAutoLend()
- const hasCreditAccounts = !!props.accounts.length
+ const hasCreditAccounts = !!accountIds.length
const isAccountSelected = isNumber(accountId)
- const selectedAccountDetails = props.accounts.find((account) => account.id === accountId)
-
- const isLoadingAccount = isAccountSelected && selectedAccountDetails?.id !== accountId
-
const checkHasFunds = useCallback(() => {
return (
transactionFeeCoinBalance &&
@@ -149,14 +142,7 @@ export default function AccountMenuContent(props: Props) {
'top-[54px] h-[calc(100%-54px)] items-start',
)}
>
- {isAccountSelected && isLoadingAccount && (
-
-
-
- )}
- {hasCreditAccounts && !isLoadingAccount && (
-
- )}
+ {hasCreditAccounts && }
diff --git a/src/components/Account/AccountStats.tsx b/src/components/Account/AccountStats.tsx
deleted file mode 100644
index deec8cd5..00000000
--- a/src/components/Account/AccountStats.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import { useMemo } from 'react'
-
-import HealthBar from 'components/Account/HealthBar'
-import DisplayCurrency from 'components/DisplayCurrency'
-import { FormattedNumber } from 'components/FormattedNumber'
-import { ArrowChartLineUp, Heart } from 'components/Icons'
-import Text from 'components/Text'
-import { ORACLE_DENOM } from 'constants/oracle'
-import useBorrowMarketAssetsTableData from 'hooks/useBorrowMarketAssetsTableData'
-import useHealthComputer from 'hooks/useHealthComputer'
-import useLendingMarketAssetsTableData from 'hooks/useLendingMarketAssetsTableData'
-import usePrices from 'hooks/usePrices'
-import { BNCoin } from 'types/classes/BNCoin'
-import { calculateAccountApr, calculateAccountBalanceValue } from 'utils/accounts'
-
-interface Props {
- account: Account
-}
-
-export default function AccountStats(props: Props) {
- const { data: prices } = usePrices()
- const positionBalance = useMemo(
- () => calculateAccountBalanceValue(props.account, prices),
- [props.account, prices],
- )
- const { health } = useHealthComputer(props.account)
- const { availableAssets: borrowAvailableAssets, accountBorrowedAssets } =
- useBorrowMarketAssetsTableData()
- const { availableAssets: lendingAvailableAssets, accountLentAssets } =
- useLendingMarketAssetsTableData()
- const borrowAssetsData = useMemo(
- () => [...borrowAvailableAssets, ...accountBorrowedAssets],
- [borrowAvailableAssets, accountBorrowedAssets],
- )
- const lendingAssetsData = useMemo(
- () => [...lendingAvailableAssets, ...accountLentAssets],
- [lendingAvailableAssets, accountLentAssets],
- )
- const apr = useMemo(
- () => calculateAccountApr(props.account, borrowAssetsData, lendingAssetsData, prices),
- [props.account, borrowAssetsData, lendingAssetsData, prices],
- )
- return (
-
- )
-}
diff --git a/src/components/Button/EscButton.tsx b/src/components/Button/EscButton.tsx
index 0b2bdb7a..b0c4a10c 100644
--- a/src/components/Button/EscButton.tsx
+++ b/src/components/Button/EscButton.tsx
@@ -6,6 +6,8 @@ import Text from 'components/Text'
interface Props {
enableKeyPress?: boolean
+ hideText?: boolean
+ className?: string
onClick: () => void
}
@@ -34,10 +36,10 @@ export default function EscButton(props: Props) {
leftIcon={}
iconClassName='w-3'
color='tertiary'
- className='h-3 w-13'
+ className={props.className ? props.className : 'h-3 w-13'}
size='xs'
>
- ESC
+ {!props.hideText && ESC}
)
}
diff --git a/src/components/HealthGauge.tsx b/src/components/HealthGauge.tsx
index c164b36f..d682fb5b 100644
--- a/src/components/HealthGauge.tsx
+++ b/src/components/HealthGauge.tsx
@@ -38,8 +38,10 @@ export const HealthGauge = ({ diameter = 40, health = 0, updatedHealth = 0 }: Pr
[color, updatedColor, isUpdated, isIncrease],
)
+ const tooltipContent = health === 0 ? 'loading...' : isUpdated ? updatedLabel : label
+
return (
-
+
(
+ MIGRATION_BANNER_KEY,
+ DEFAULT_SETTINGS.migrationBanner,
+ )
+
+ if (!migrationBanner) 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/components/Portfolio/Card/Skeleton.tsx b/src/components/Portfolio/Card/Skeleton.tsx
index 8e7ec35e..07b2eab2 100644
--- a/src/components/Portfolio/Card/Skeleton.tsx
+++ b/src/components/Portfolio/Card/Skeleton.tsx
@@ -3,22 +3,21 @@ import React from 'react'
import HealthBar from 'components/Account/HealthBar'
import Card from 'components/Card'
import { Heart } from 'components/Icons'
-import Loading from 'components/Loading'
import Text from 'components/Text'
import TitleAndSubCell from 'components/TitleAndSubCell'
interface Props {
stats: { title: React.ReactNode; sub: string }[]
health: number
+ accountId: string
isCurrent?: boolean
- accountId?: string
}
export default function Skeleton(props: Props) {
return (
-
-
-
Credit account {props.accountId || }
+
+
+
Credit account {props.accountId}
{props.isCurrent && '(current)'}
diff --git a/src/components/Tooltip/TooltipContent.tsx b/src/components/Tooltip/TooltipContent.tsx
index 6b49b256..2c43407c 100644
--- a/src/components/Tooltip/TooltipContent.tsx
+++ b/src/components/Tooltip/TooltipContent.tsx
@@ -4,8 +4,6 @@ import { ReactNode } from 'react'
import { TooltipArrow } from 'components/Icons'
import Text from 'components/Text'
-import { TooltipType } from '.'
-
interface Props {
content: ReactNode | string
type: TooltipType
diff --git a/src/components/Tooltip/index.tsx b/src/components/Tooltip/index.tsx
index 38d2c552..7e3cedce 100644
--- a/src/components/Tooltip/index.tsx
+++ b/src/components/Tooltip/index.tsx
@@ -18,8 +18,6 @@ interface Props {
underline?: boolean
}
-export type TooltipType = 'info' | 'warning' | 'error'
-
export const Tooltip = (props: Props) => {
const [reduceMotion] = useLocalStorage
(REDUCE_MOTION_KEY, DEFAULT_SETTINGS.reduceMotion)
diff --git a/src/components/Wallet/WalletConnectedButton.tsx b/src/components/Wallet/WalletConnectedButton.tsx
index b437c374..649f620d 100644
--- a/src/components/Wallet/WalletConnectedButton.tsx
+++ b/src/components/Wallet/WalletConnectedButton.tsx
@@ -12,6 +12,7 @@ import { Check, Copy, ExternalLink, Osmo } from 'components/Icons'
import Overlay from 'components/Overlay'
import Text from 'components/Text'
import RecentTransactions from 'components/Wallet/RecentTransactions'
+import WalletSelect from 'components/Wallet/WalletSelect'
import { CHAINS } from 'constants/chains'
import { ENV } from 'constants/env'
import { BN_ZERO } from 'constants/math'
@@ -25,8 +26,6 @@ import { getBaseAsset, getEnabledMarketAssets } from 'utils/assets'
import { truncate } from 'utils/formatters'
import { getPage, getRoute } from 'utils/route'
-import WalletSelect from './WalletSelect'
-
export default function WalletConnectedButton() {
// ---------------
// EXTERNAL HOOKS
diff --git a/src/constants/defaultSettings.ts b/src/constants/defaultSettings.ts
index 45a330ba..8895cf9f 100644
--- a/src/constants/defaultSettings.ts
+++ b/src/constants/defaultSettings.ts
@@ -8,4 +8,5 @@ export const DEFAULT_SETTINGS: Settings = {
displayCurrency: ORACLE_DENOM,
slippage: 0.02,
tutorial: true,
+ migrationBanner: true,
}
diff --git a/src/constants/localStore.ts b/src/constants/localStore.ts
index fd0c07cd..5bb66a1b 100644
--- a/src/constants/localStore.ts
+++ b/src/constants/localStore.ts
@@ -8,3 +8,4 @@ export const SLIPPAGE_KEY = 'slippage'
export const TERMS_OF_SERVICE_KEY = 'termsOfService'
export const TUTORIAL_KEY = 'tutorial'
export const TRANSACTIONS_KEY = 'transactions'
+export const MIGRATION_BANNER_KEY = 'migrationBanner'
diff --git a/src/hooks/broadcast/useDepositVault.ts b/src/hooks/broadcast/useDepositVault.ts
index 1fc6dd69..acd95d59 100644
--- a/src/hooks/broadcast/useDepositVault.ts
+++ b/src/hooks/broadcast/useDepositVault.ts
@@ -84,7 +84,7 @@ export default function useDepositVault(props: Props): {
amount: 'account_balance',
},
}))
- }, [isAutoLend, props.borrowings, props.deposits, props.reclaims])
+ }, [isAutoLend, props.vault.denoms.primary, props.vault.denoms.secondary])
const actions = useMemo(() => {
return [
diff --git a/src/hooks/useUpdatedAccount/index.ts b/src/hooks/useUpdatedAccount/index.ts
index 1468b0d5..574fbf39 100644
--- a/src/hooks/useUpdatedAccount/index.ts
+++ b/src/hooks/useUpdatedAccount/index.ts
@@ -1,6 +1,9 @@
import { useCallback, useEffect, useState } from 'react'
+import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
+import { SLIPPAGE_KEY } from 'constants/localStore'
import { BN_ZERO } from 'constants/math'
+import useLocalStorage from 'hooks/useLocalStorage'
import usePrices from 'hooks/usePrices'
import {
addCoins,
@@ -15,10 +18,6 @@ import { cloneAccount } from 'utils/accounts'
import { byDenom } from 'utils/array'
import { getValueFromBNCoins } from 'utils/helpers'
-import { DEFAULT_SETTINGS } from '../../constants/defaultSettings'
-import { SLIPPAGE_KEY } from '../../constants/localStore'
-import useLocalStorage from '../useLocalStorage'
-
export interface VaultValue {
address: string
value: BigNumber
diff --git a/src/pages/BorrowPage.tsx b/src/pages/BorrowPage.tsx
index bb20c0f3..97d65e2a 100644
--- a/src/pages/BorrowPage.tsx
+++ b/src/pages/BorrowPage.tsx
@@ -1,5 +1,6 @@
import BorrowIntro from 'components/Borrow/BorrowIntro'
import BorrowTable from 'components/Borrow/BorrowTable'
+import MigrationBanner from 'components/MigrationBanner'
import useBorrowMarketAssetsTableData from 'hooks/useBorrowMarketAssetsTableData'
export default function BorrowPage() {
@@ -7,6 +8,7 @@ export default function BorrowPage() {
return (
+
diff --git a/src/pages/FarmPage.tsx b/src/pages/FarmPage.tsx
index 21cf513e..fb248757 100644
--- a/src/pages/FarmPage.tsx
+++ b/src/pages/FarmPage.tsx
@@ -1,10 +1,12 @@
import FarmIntro from 'components/Earn/Farm/FarmIntro'
import { AvailableVaults, DepositedVaults } from 'components/Earn/Farm/Vaults'
import Tab from 'components/Earn/Tab'
+import MigrationBanner from 'components/MigrationBanner'
export default function FarmPage() {
return (
+
diff --git a/src/pages/LendPage.tsx b/src/pages/LendPage.tsx
index 369fe208..c27b76e3 100644
--- a/src/pages/LendPage.tsx
+++ b/src/pages/LendPage.tsx
@@ -1,12 +1,14 @@
import LendIntro from 'components/Earn/Lend/LendIntro'
import LendingMarketsTable from 'components/Earn/Lend/LendingMarketsTable'
import Tab from 'components/Earn/Tab'
+import MigrationBanner from 'components/MigrationBanner'
import useLendingMarketAssetsTableData from 'hooks/useLendingMarketAssetsTableData'
export default function LendPage() {
const { accountLentAssets, availableAssets } = useLendingMarketAssetsTableData()
return (
+
diff --git a/src/pages/PortfolioAccountPage.tsx b/src/pages/PortfolioAccountPage.tsx
index c57d39a4..fa63750a 100644
--- a/src/pages/PortfolioAccountPage.tsx
+++ b/src/pages/PortfolioAccountPage.tsx
@@ -1,6 +1,6 @@
-import React from 'react'
import { useNavigate, useParams } from 'react-router-dom'
+import MigrationBanner from 'components/MigrationBanner'
import Balances from 'components/Portfolio/Account/Balances'
import BreadCrumbs from 'components/Portfolio/Account/BreadCrumbs'
import Summary from 'components/Portfolio/Account/Summary'
@@ -19,6 +19,7 @@ export default function PortfolioAccountPage() {
return (
+
diff --git a/src/pages/PortfolioPage.tsx b/src/pages/PortfolioPage.tsx
index 353d6dbe..d7ddd49f 100644
--- a/src/pages/PortfolioPage.tsx
+++ b/src/pages/PortfolioPage.tsx
@@ -1,9 +1,11 @@
+import MigrationBanner from 'components/MigrationBanner'
import AccountOverview from 'components/Portfolio/Overview'
import PortfolioIntro from 'components/Portfolio/PortfolioIntro'
export default function PortfolioPage() {
return (
diff --git a/src/pages/TradePage.tsx b/src/pages/TradePage.tsx
index db21893a..0b916b0c 100644
--- a/src/pages/TradePage.tsx
+++ b/src/pages/TradePage.tsx
@@ -1,5 +1,6 @@
import { useState } from 'react'
+import MigrationBanner from 'components/MigrationBanner'
import AccountDetailsCard from 'components/Trade/AccountDetailsCard'
import TradeChart from 'components/Trade/TradeChart'
import TradeModule from 'components/Trade/TradeModule'
@@ -11,16 +12,19 @@ export default function TradePage() {
const [sellAsset, setSellAsset] = useState(enabledMarketAssets[1])
return (
-
-
-
-
-
+
)
}
diff --git a/src/pages/_layout.tsx b/src/pages/_layout.tsx
index 6a1d3e18..6ba8512d 100644
--- a/src/pages/_layout.tsx
+++ b/src/pages/_layout.tsx
@@ -6,12 +6,13 @@ import AccountDetails from 'components/Account/AccountDetails'
import Background from 'components/Background'
import Footer from 'components/Footer'
import DesktopHeader from 'components/Header/DesktopHeader'
+import MigrationBanner from 'components/MigrationBanner'
import ModalsContainer from 'components/Modals/ModalsContainer'
import PageMetadata from 'components/PageMetadata'
import Toaster from 'components/Toaster'
import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
import { REDUCE_MOTION_KEY } from 'constants/localStore'
-import useCurrentAccount from 'hooks/useCurrentAccount'
+import useAccountId from 'hooks/useAccountId'
import useLocalStorage from 'hooks/useLocalStorage'
import useStore from 'store'
@@ -44,7 +45,7 @@ export default function Layout({ children }: { children: React.ReactNode }) {
const [reduceMotion] = useLocalStorage
(REDUCE_MOTION_KEY, DEFAULT_SETTINGS.reduceMotion)
const accountDetailsExpanded = useStore((s) => s.accountDetailsExpanded)
const isFullWidth = location.pathname.includes('trade') || location.pathname === '/'
- const account = useCurrentAccount()
+ const accountId = useAccountId()
return (
<>
@@ -57,7 +58,7 @@ export default function Layout({ children }: { children: React.ReactNode }) {
'lg:mt-[73px]',
'min-h-screen gap-6 px-4 py-6 w-full relative',
'flex',
- isFullWidth && account && (accountDetailsExpanded ? 'pr-110.5' : 'pr-24'),
+ isFullWidth && accountId && (accountDetailsExpanded ? 'pr-110.5' : 'pr-24'),
!reduceMotion && isFullWidth && 'transition-all duration-300',
'justify-center',
focusComponent && 'items-center',
diff --git a/src/types/interfaces/store/settings.d.ts b/src/types/interfaces/store/settings.d.ts
index d66eb403..d8044fa3 100644
--- a/src/types/interfaces/store/settings.d.ts
+++ b/src/types/interfaces/store/settings.d.ts
@@ -5,4 +5,5 @@ interface Settings {
lendAssets: boolean
slippage: number
tutorial: boolean
+ migrationBanner: boolean
}
diff --git a/src/types/interfaces/tooltip.d.ts b/src/types/interfaces/tooltip.d.ts
new file mode 100644
index 00000000..be1bd12e
--- /dev/null
+++ b/src/types/interfaces/tooltip.d.ts
@@ -0,0 +1 @@
+type TooltipType = 'info' | 'warning' | 'error'
diff --git a/tailwind.config.js b/tailwind.config.js
index a63e0c89..94e91108 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -245,6 +245,7 @@ module.exports = {
4.5: '18px',
13: '52px',
15: '60px',
+ 18: '72px',
30: '120px',
35: '140px',
50: '200px',