diff --git a/wallet-web/components/MainNav.tsx b/wallet-web/components/MainNav.tsx index 65f29f2bab..f545673342 100644 --- a/wallet-web/components/MainNav.tsx +++ b/wallet-web/components/MainNav.tsx @@ -1,172 +1,190 @@ import { - AppBar, - Divider, - Drawer, - IconButton, - List, - ListItem, - ListItemIcon, - ListItemText, - ListSubheader, - Toolbar, - Typography -} from "@material-ui/core"; -import React, { useContext } from "react"; + AppBar, + Button, + Divider, + Drawer, + IconButton, + List, + ListItem, + ListItemIcon, + ListItemText, + ListSubheader, + Toolbar, + Typography, +} from '@material-ui/core' +import React, { useContext } from 'react' import Link from 'next/link' -import VpnKeyIcon from "@material-ui/icons/VpnKey" -import AccountBalanceWalletIcon from '@material-ui/icons/AccountBalanceWallet'; -import { ValidatorClientContext } from "../contexts/ValidatorClient"; -import { ADMIN_ADDRESS } from "../pages/_app"; -import MenuIcon from '@material-ui/icons/Menu'; -import MonetizationOnIcon from '@material-ui/icons/MonetizationOn'; -import AttachMoneyIcon from '@material-ui/icons/AttachMoney'; -import MoneyOffIcon from '@material-ui/icons/MoneyOff'; -import HowToVoteIcon from '@material-ui/icons/HowToVote'; -import CancelIcon from '@material-ui/icons/Cancel'; -import PageviewIcon from '@material-ui/icons/Pageview'; -import { makeBasicStyle } from "../common/helpers"; -import { theme } from "../lib/theme"; +import VpnKeyIcon from '@material-ui/icons/VpnKey' +import { + ExitToApp, + AccountBalanceWallet, + MonetizationOn, + AttachMoney, + MoneyOff, + Menu, + HowToVote, + Cancel, + Pageview, +} from '@material-ui/icons' +import { ValidatorClientContext } from '../contexts/ValidatorClient' +import { ADMIN_ADDRESS } from '../pages/_app' +import { makeBasicStyle } from '../common/helpers' +import { theme } from '../lib/theme' export default function MainNav() { - const classes = makeBasicStyle(theme); + const classes = makeBasicStyle(theme) - const { client } = useContext(ValidatorClientContext) + const { client, setClient } = useContext(ValidatorClientContext) - let adminPageDisplayed = false + let adminPageDisplayed = false - if (client !== null && client.address === ADMIN_ADDRESS) { - adminPageDisplayed = true - } + if (client !== null && client.address === ADMIN_ADDRESS) { + adminPageDisplayed = true + } - const [open, setOpen] = React.useState(false) + const [open, setOpen] = React.useState(false) + const toggleDrawer = () => { + setOpen((prevOpen) => !prevOpen) + } - const toggleDrawer = () => { - setOpen((prevOpen) => !prevOpen); - }; + const closeDrawer = () => { + setOpen(false) + } - const closeDrawer = () => { - setOpen(false) - } + return ( + + + + + + - return ( - - - - - - + + + Nym Wallet + } + > + - - - - Nym Wallet - - } - > - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + - + {/**/} + {/* */} + {/**/} - {/**/} - {/* */} - {/**/} + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + setClient(null)}> + + + + + - {adminPageDisplayed && - - - - - - + {adminPageDisplayed && ( + + + + + + - - - - - - } - - - + + + + + + )} + + + - - - Nym - - - - - ) -} \ No newline at end of file + + Nym + + + setClient(null)}> + Log out + + + + + + ) +} diff --git a/wallet-web/components/bond/NodeBond.tsx b/wallet-web/components/bond/NodeBond.tsx index 3e14c4eaaa..2b1a436626 100644 --- a/wallet-web/components/bond/NodeBond.tsx +++ b/wallet-web/components/bond/NodeBond.tsx @@ -27,7 +27,7 @@ const BondNode = () => { const router = useRouter() const { client } = useContext(ValidatorClientContext) - const [isLoading, setIsLoading] = React.useState(false) + const [isLoading, setIsLoading] = React.useState() const [bondingError, setBondingError] = React.useState(null) const [checkedOwnership, setCheckedOwnership] = React.useState(false) @@ -111,7 +111,7 @@ const BondNode = () => { You have already have a bonded mixnode. If you wish to bond a different one, you need to first{' '} - unbond the existing one. + unbond the existing one. @@ -126,7 +126,7 @@ const BondNode = () => { You have already have a bonded gateway. If you wish to bond a different one, you need to first{' '} - unbond the existing one. + unbond the existing one. @@ -134,7 +134,7 @@ const BondNode = () => { } // we haven't clicked bond button yet - if (!isLoading) { + if (isLoading === undefined) { return ( <> @@ -164,11 +164,11 @@ const BondNode = () => { <> - + Bond a {nodeType} diff --git a/wallet-web/components/delegate/NodeDelegation.tsx b/wallet-web/components/delegate/NodeDelegation.tsx index 92f7426939..08ed72b385 100644 --- a/wallet-web/components/delegate/NodeDelegation.tsx +++ b/wallet-web/components/delegate/NodeDelegation.tsx @@ -21,7 +21,7 @@ const DelegateToNode = () => { const router = useRouter() const { client } = useContext(ValidatorClientContext) - const [isLoading, setIsLoading] = React.useState(false) + const [isLoading, setIsLoading] = React.useState() const [delegationError, setDelegationError] = React.useState(null) const [nodeType, setNodeType] = React.useState(NodeType.Mixnode) @@ -79,7 +79,7 @@ const DelegateToNode = () => { } // we haven't clicked delegate button yet - if (!isLoading) { + if (isLoading === undefined) { return ( <> @@ -106,9 +106,9 @@ const DelegateToNode = () => { Delegate to {nodeType} diff --git a/wallet-web/components/delegation-check/DelegationCheck.tsx b/wallet-web/components/delegation-check/DelegationCheck.tsx index db590eb710..f3f2345854 100644 --- a/wallet-web/components/delegation-check/DelegationCheck.tsx +++ b/wallet-web/components/delegation-check/DelegationCheck.tsx @@ -75,7 +75,6 @@ const DelegationCheck = () => { } const getDelegationCheckContent = () => { - console.log(isLoading) // we're not signed in if (client === null) { return @@ -88,7 +87,7 @@ const DelegationCheck = () => { > ) @@ -112,9 +111,9 @@ const DelegationCheck = () => { Check your stake on a {nodeType} diff --git a/wallet-web/components/unbond/UnbondNode.tsx b/wallet-web/components/unbond/UnbondNode.tsx index 81d8cd7fe7..c1591d1f0e 100644 --- a/wallet-web/components/unbond/UnbondNode.tsx +++ b/wallet-web/components/unbond/UnbondNode.tsx @@ -16,7 +16,7 @@ const UnbondNode = () => { const router = useRouter() const { client } = useContext(ValidatorClientContext) - const [isLoading, setIsLoading] = React.useState(false) + const [isLoading, setIsLoading] = React.useState() const [unbondingError, setUnbondingError] = React.useState(null) const [checkedOwnership, setCheckedOwnership] = React.useState(false) @@ -104,7 +104,7 @@ const UnbondNode = () => { } // we haven't clicked unbond button yet - if (!isLoading) { + if (isLoading === undefined) { return } @@ -131,9 +131,9 @@ const UnbondNode = () => { Unbond a {headerText} diff --git a/wallet-web/components/undelegate/NodeUndelegation.tsx b/wallet-web/components/undelegate/NodeUndelegation.tsx index c04aa1464d..4138449e4d 100644 --- a/wallet-web/components/undelegate/NodeUndelegation.tsx +++ b/wallet-web/components/undelegate/NodeUndelegation.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect } from 'react' +import React, { useContext, useEffect, useState } from 'react' import { Paper } from '@material-ui/core' import Typography from '@material-ui/core/Typography' import { useRouter } from 'next/router' @@ -17,7 +17,7 @@ const UndelegateFromNode = () => { const router = useRouter() const { client } = useContext(ValidatorClientContext) - const [isLoading, setIsLoading] = React.useState(false) + const [isLoading, setIsLoading] = React.useState() const [undelegationError, setUndelegationError] = React.useState(null) const [nodeType, setNodeType] = React.useState(NodeType.Mixnode) @@ -65,15 +65,15 @@ const UndelegateFromNode = () => { } // we haven't clicked undelegate button yet - if (!undelegationStarted) { + if (isLoading === undefined) { return ( - + <> - + > ) } @@ -95,9 +95,9 @@ const UndelegateFromNode = () => { Undelegate stake from {nodeType} diff --git a/wallet-web/pages/send.tsx b/wallet-web/pages/send.tsx index 5d9dc46df4..223ad3e4d8 100644 --- a/wallet-web/pages/send.tsx +++ b/wallet-web/pages/send.tsx @@ -80,9 +80,9 @@ export default function SendFunds() { return ( ) @@ -200,16 +200,16 @@ export default function SendFunds() { <> {activeStep === steps.length ? ( <> - + Payment complete. - + You ({transaction.sender}) - + have sent {printableCoin(transaction.coin)} - + to {transaction.recipient}. > @@ -224,9 +224,9 @@ export default function SendFunds() { )} @@ -250,10 +250,9 @@ export default function SendFunds() { - + Send Nym - {client === null ? : getStepperContent()}