diff --git a/src/components/dashboard/Overview/Overview.tsx b/src/components/dashboard/Overview/Overview.tsx index b60e7d5915..81c0adb606 100644 --- a/src/components/dashboard/Overview/Overview.tsx +++ b/src/components/dashboard/Overview/Overview.tsx @@ -1,3 +1,4 @@ +import Track from '@/components/common/Track' import QrCodeButton from '@/components/sidebar/QrCodeButton' import { TxModalContext } from '@/components/tx-flow' import { NewTxFlow } from '@/components/tx-flow/flows' @@ -5,80 +6,37 @@ import { OVERVIEW_EVENTS, trackEvent } from '@/services/analytics' import { useAppSelector } from '@/store' import { selectCurrency } from '@/store/settingsSlice' import { formatCurrency } from '@/utils/formatNumber' -import type { ReactElement } from 'react' -import { useContext, useMemo } from 'react' -import { useRouter } from 'next/router' -import Link from 'next/link' -import { Box, Button, Divider, Grid, Skeleton, Typography } from '@mui/material' -import { Card, WidgetBody, WidgetContainer } from '../styled' +import { useContext, useMemo, type ReactElement } from 'react' +import { Button, Grid, Skeleton, Typography } from '@mui/material' +import { WidgetBody, WidgetContainer } from '../styled' import useSafeInfo from '@/hooks/useSafeInfo' -import { useCurrentChain } from '@/hooks/useChains' -import ChainIndicator from '@/components/common/ChainIndicator' -import { AppRoutes } from '@/config/routes' -import useCollectibles from '@/hooks/useCollectibles' -import type { UrlObject } from 'url' import { useVisibleBalances } from '@/hooks/useVisibleBalances' import ArrowIconNW from '@/public/images/common/arrow-top-right.svg' import ArrowIconSE from '@/public/images/common/arrow-se.svg' import BuyCryproButton from '@/components/common/BuyCryproButton' -const ValueSkeleton = () => - const SkeletonOverview = ( - - - - - - - - - - - - - + <> + + + + - - - - - Tokens - - - NFTs - + + + + + + - - - - - + ) const Overview = (): ReactElement => { const currency = useAppSelector(selectCurrency) - const router = useRouter() const { safeLoading, safeLoaded } = useSafeInfo() const { balances, loading: balancesLoading } = useVisibleBalances() - const [nfts, , nftsLoading] = useCollectibles() - const chain = useCurrentChain() - const { chainId } = chain || {} const { setTxFlow } = useContext(TxModalContext) const fiatTotal = useMemo( @@ -86,21 +44,8 @@ const Overview = (): ReactElement => { [currency, balances.fiatTotal], ) - const assetsLink: UrlObject = { - pathname: AppRoutes.balances.index, - query: { safe: router.query.safe }, - } - const nftsLink: UrlObject = { - pathname: AppRoutes.balances.nfts, - query: { safe: router.query.safe }, - } - - // Native token is always returned even when its balance is 0 - const tokenCount = useMemo(() => balances.items.filter((token) => token.balance !== '0').length, [balances]) - const nftsCount = useMemo(() => (nfts ? `${nfts.next ? '>' : ''}${nfts.results.length}` : ''), [nfts]) - const isInitialState = !safeLoaded && !safeLoading - const isLoading = safeLoading || balancesLoading || nftsLoading || isInitialState + const isLoading = safeLoading || balancesLoading || isInitialState const handleOnSend = () => { setTxFlow(, undefined, false) @@ -109,104 +54,52 @@ const Overview = (): ReactElement => { return ( - - Overview - - {isLoading ? ( SkeletonOverview ) : ( - - + <> + - + Total asset value - {fiatTotal} + + {fiatTotal} + - - - - - - - - - - - palette.border.light, - gap: 0.5, - pr: 1, - }} - > - - {balancesLoading ? : tokenCount} - {' '} - - Tokens - - - - - - - - {nftsCount || } - {' '} - + + + + + + - - - - - + + + + + + + + - + )} diff --git a/src/components/dashboard/index.tsx b/src/components/dashboard/index.tsx index 75d8d96613..f72bc36909 100644 --- a/src/components/dashboard/index.tsx +++ b/src/components/dashboard/index.tsx @@ -28,7 +28,7 @@ const Dashboard = (): ReactElement => { {supportsRecovery && } - + diff --git a/src/components/sidebar/SidebarHeader/index.tsx b/src/components/sidebar/SidebarHeader/index.tsx index 1b0fe8617b..01346caac6 100644 --- a/src/components/sidebar/SidebarHeader/index.tsx +++ b/src/components/sidebar/SidebarHeader/index.tsx @@ -77,7 +77,7 @@ const SafeHeader = (): ReactElement => {
- +