diff --git a/src/components/Account/AccountDetails.tsx b/src/components/Account/AccountDetails.tsx index 382399fa..e4785ea7 100644 --- a/src/components/Account/AccountDetails.tsx +++ b/src/components/Account/AccountDetails.tsx @@ -51,14 +51,6 @@ function AccountDetails(props: Props) { />
- - Leverage - - - 4.5x - -
-
Balance diff --git a/src/components/Account/AccountList.tsx b/src/components/Account/AccountList.tsx index 5ca391ee..604742ff 100644 --- a/src/components/Account/AccountList.tsx +++ b/src/components/Account/AccountList.tsx @@ -10,14 +10,10 @@ import { ArrowCircledTopRight, ArrowDownLine, ArrowUpLine, TrashBin } from 'comp import Radio from 'components/Radio' import SwitchWithLabel from 'components/SwitchWithLabel' import Text from 'components/Text' -import { DEFAULT_SETTINGS } from 'constants/defaultSettings' -import { DISPLAY_CURRENCY_KEY } from 'constants/localStore' -import { BN_ZERO } from 'constants/math' import useAutoLendEnabledAccountIds from 'hooks/useAutoLendEnabledAccountIds' -import useLocalStorage from 'hooks/useLocalStorage' import usePrices from 'hooks/usePrices' import useStore from 'store' -import { calculateAccountBalanceValue, calculateAccountDepositsValue } from 'utils/accounts' +import { calculateAccountDepositsValue } from 'utils/accounts' import { hardcodedFee } from 'utils/constants' import { getPage, getRoute } from 'utils/route' @@ -28,6 +24,7 @@ interface Props { 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) { @@ -38,10 +35,6 @@ export default function AccountList(props: Props) { const { autoLendEnabledAccountIds, toggleAutoLend } = useAutoLendEnabledAccountIds() const deleteAccount = useStore((s) => s.deleteAccount) const accountSelected = !!accountId && !isNaN(Number(accountId)) - const selectedAccountDetails = props.accounts.find((account) => account.id === accountId) - const selectedAccountBalance = selectedAccountDetails - ? calculateAccountBalanceValue(selectedAccountDetails, prices) - : BN_ZERO async function deleteAccountHandler() { if (!accountSelected) return @@ -72,31 +65,25 @@ export default function AccountList(props: Props) { { + if (isActive) return + navigate(getRoute(getPage(pathname), address, account.id)) + }} title={ -
{ - if (isActive) return - navigate(getRoute(getPage(pathname), address, account.id)) - }} - > +
Credit Account {account.id} - +
} > {isActive ? ( <>
- +
) : ( - + )}
) diff --git a/src/components/Earn/Lend/LendingActionButtons.tsx b/src/components/Earn/Lend/LendingActionButtons.tsx index 62e1b333..792d79a1 100644 --- a/src/components/Earn/Lend/LendingActionButtons.tsx +++ b/src/components/Earn/Lend/LendingActionButtons.tsx @@ -1,7 +1,9 @@ import { useCallback } from 'react' +import { useParams } from 'react-router-dom' import { ACCOUNT_MENU_BUTTON_ID } from 'components/Account/AccountMenuContent' import Button from 'components/Button' +import ActionButton from 'components/Button/ActionButton' import { ArrowDownLine, ArrowUpLine, Enter } from 'components/Icons' import Text from 'components/Text' import { Tooltip } from 'components/Tooltip' @@ -10,6 +12,7 @@ import useAlertDialog from 'hooks/useAlertDialog' import useAutoLendEnabledAccountIds from 'hooks/useAutoLendEnabledAccountIds' import useCurrentAccountDeposits from 'hooks/useCurrentAccountDeposits' import useLendAndReclaimModal from 'hooks/useLendAndReclaimModal' +import useStore from 'store' import { byDenom } from 'utils/array' interface Props { @@ -26,6 +29,9 @@ export default function LendingActionButtons(props: Props) { const { open: showAlertDialog } = useAlertDialog() const { isAutoLendEnabledForCurrentAccount } = useAutoLendEnabledAccountIds() const assetDepositAmount = accountDeposits.find(byDenom(asset.denom))?.amount + const address = useStore((s) => s.address) + const { accountId } = useParams() + const hasNoDeposit = !!(!assetDepositAmount && address && accountId) const handleWithdraw = useCallback(() => { if (isAutoLendEnabledForCurrentAccount) { @@ -64,7 +70,7 @@ export default function LendingActionButtons(props: Props) { )} ( )} > - + text='Lend' + />
) diff --git a/src/components/Modals/WalletAssets/WalletAssetsModalContent.tsx b/src/components/Modals/WalletAssets/WalletAssetsModalContent.tsx index 4b10e255..18ad5f07 100644 --- a/src/components/Modals/WalletAssets/WalletAssetsModalContent.tsx +++ b/src/components/Modals/WalletAssets/WalletAssetsModalContent.tsx @@ -7,11 +7,11 @@ import { byDenom } from 'utils/array' import { getAssetByDenom } from 'utils/assets' interface Props { - defaultSelectedDenoms: string[] onChangeDenoms: (denoms: string[]) => void } export default function WalletAssetsModalContent(props: Props) { + const { onChangeDenoms } = props const [searchString, setSearchString] = useState('') const balances = useStore((s) => s.balances) @@ -39,12 +39,12 @@ export default function WalletAssetsModalContent(props: Props) { currentSelectedDenom?.filter((denom) => filteredAssets.findIndex(byDenom(denom))) || [], ) - const onChangeDenoms = useCallback( + const onChangeSelect = useCallback( (denoms: string[]) => { setSelectedDenoms(denoms) - props.onChangeDenoms(denoms) + onChangeDenoms(denoms) }, - [props.onChangeDenoms], + [onChangeDenoms], ) return ( @@ -59,7 +59,7 @@ export default function WalletAssetsModalContent(props: Props) {
diff --git a/src/components/Modals/WalletAssets/index.tsx b/src/components/Modals/WalletAssets/index.tsx index 4c707163..07ed32d0 100644 --- a/src/components/Modals/WalletAssets/index.tsx +++ b/src/components/Modals/WalletAssets/index.tsx @@ -25,10 +25,7 @@ export default function WalletAssetsModal() { modalClassName='max-w-modal-xs' headerClassName='bg-white/10 border-b-white/5 border-b items-center p-4' > - +
diff --git a/src/components/Trade/TradeModule/SwapForm/TradeSummary.tsx b/src/components/Trade/TradeModule/SwapForm/TradeSummary.tsx index 7ebaa69b..e986ab45 100644 --- a/src/components/Trade/TradeModule/SwapForm/TradeSummary.tsx +++ b/src/components/Trade/TradeModule/SwapForm/TradeSummary.tsx @@ -1,11 +1,11 @@ import classNames from 'classnames' import { useCallback, useMemo, useState } from 'react' -import Button from 'components/Button' +import ActionButton from 'components/Button/ActionButton' +import useSwapRoute from 'hooks/useSwapRoute' +import { getAssetByDenom } from 'utils/assets' import { hardcodedFee } from 'utils/constants' import { formatAmountWithSymbol } from 'utils/formatters' -import { getAssetByDenom } from 'utils/assets' -import useSwapRoute from 'hooks/useSwapRoute' interface Props { buyAsset: Asset @@ -53,12 +53,14 @@ export default function TradeSummary(props: Props) { {parsedRoutes} - + className={props.className} + text={props.textOverride ?? 'Connect Wallet'} + /> ) } diff --git a/src/components/Wallet/WalletConnectedButton.tsx b/src/components/Wallet/WalletConnectedButton.tsx index ebffd0a5..d10f7f98 100644 --- a/src/components/Wallet/WalletConnectedButton.tsx +++ b/src/components/Wallet/WalletConnectedButton.tsx @@ -3,6 +3,7 @@ import BigNumber from 'bignumber.js' import classNames from 'classnames' import { useCallback, useEffect, useState } from 'react' import useClipboard from 'react-use-clipboard' +import { useLocation, useNavigate } from 'react-router-dom' import Button from 'components/Button' import { CircularProgress } from 'components/CircularProgress' @@ -20,6 +21,7 @@ import useStore from 'store' import { ChainInfoID } from 'types/enums/wallet' import { getBaseAsset, getEnabledMarketAssets } from 'utils/assets' import { truncate } from 'utils/formatters' +import { getPage, getRoute } from 'utils/route' export default function WalletConnectedButton() { // --------------- @@ -33,6 +35,8 @@ export default function WalletConnectedButton() { const network = useStore((s) => s.client?.connectedWallet.network) const baseAsset = getBaseAsset() const { data: walletBalances, isLoading } = useWalletBalances(address) + const navigate = useNavigate() + const { pathname } = useLocation() // --------------- // LOCAL STATE @@ -57,6 +61,7 @@ export default function WalletConnectedButton() { if (!currentWallet) return disconnectWallet(currentWallet) useStore.setState({ client: undefined, balances: [] }) + navigate(getRoute(getPage(pathname))) } useEffect(() => {