From b97b7410da3ef35830498189c458fe33c7d8f6a4 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Sat, 27 Nov 2021 22:15:57 +0000 Subject: [PATCH] update balance page --- nym-wallet/src/components/Nav.tsx | 8 ---- nym-wallet/src/components/index.ts | 1 - nym-wallet/src/routes/balance.tsx | 68 +++++++++++++----------------- 3 files changed, 30 insertions(+), 47 deletions(-) diff --git a/nym-wallet/src/components/Nav.tsx b/nym-wallet/src/components/Nav.tsx index d2c2ec85a9..92425bd775 100644 --- a/nym-wallet/src/components/Nav.tsx +++ b/nym-wallet/src/components/Nav.tsx @@ -7,7 +7,6 @@ import { ArrowForward, AttachMoney, Cancel, - ExitToApp, HowToVote, MoneyOff, Description, @@ -108,13 +107,6 @@ export const Nav = () => { )} - - - - - - - ) diff --git a/nym-wallet/src/components/index.ts b/nym-wallet/src/components/index.ts index e304e4a5f8..5e691f367b 100644 --- a/nym-wallet/src/components/index.ts +++ b/nym-wallet/src/components/index.ts @@ -4,7 +4,6 @@ export * from './Confirmation' export * from './CopyToClipboard' export * from './NymCard' export * from './Nav' -export * from './NavigationCards' export * from './NodeTypeSelector' export * from './RequestStatus' export * from './NoClientError' diff --git a/nym-wallet/src/routes/balance.tsx b/nym-wallet/src/routes/balance.tsx index 0c166fe54b..31ca59778d 100644 --- a/nym-wallet/src/routes/balance.tsx +++ b/nym-wallet/src/routes/balance.tsx @@ -1,57 +1,49 @@ -import React, { useEffect } from 'react' -import { Alert, Button, CircularProgress, Grid } from '@mui/material' +import React, { useContext } from 'react' +import { + Alert, + Button, + CircularProgress, + Grid, + IconButton, +} from '@mui/material' +import { Box } from '@mui/system' import { Refresh } from '@mui/icons-material' import { NymCard } from '../components' import { Layout } from '../layouts' -import { useGetBalance } from '../hooks/useGetBalance' + +import { ClientContext } from '../context/main' export const Balance = () => { - const { balance, isLoading, error, fetchBalance } = useGetBalance() - - useEffect(fetchBalance, []) + const { userBalance } = useContext(ClientContext) const RefreshAction = () => ( - + {userBalance.isLoading ? : } + ) return ( - + } + > - {error && ( - } - sx={{ p: 2 }} - > - {error} + {userBalance.error && ( + + {userBalance.error} )} - {!error && ( - } - > - {'The current balance is ' + balance?.printable_balance} - + {!userBalance.error && ( + + {'The current balance is ' + + userBalance.balance?.printable_balance} + )}