diff --git a/nym-wallet/src/components/AppBar.tsx b/nym-wallet/src/components/AppBar.tsx index 66d50f0400..e6274b9ccb 100644 --- a/nym-wallet/src/components/AppBar.tsx +++ b/nym-wallet/src/components/AppBar.tsx @@ -1,22 +1,21 @@ -import React, { useContext } from 'react' +import React, { useContext, useEffect } from 'react' import { AppBar as MuiAppBar, Divider, Grid, IconButton, - List, - ListItem, - ListItemText, Toolbar, Typography, + useMediaQuery, } from '@mui/material' -import { ExitToApp } from '@mui/icons-material' -import { ClientContext } from '../context/main' import { Box } from '@mui/system' +import { Logout } from '@mui/icons-material' +import { ClientContext } from '../context/main' import { CopyToClipboard } from '.' export const AppBar = () => { const { userBalance, logOut, clientDetails } = useContext(ClientContext) + const matches = useMediaQuery('(min-width: 769px)') return ( { secondaryText={userBalance.balance?.printable_balance} /> - - - - } - /> - + {matches && ( + <> + + + + + } + /> + + + )} - + @@ -65,11 +77,16 @@ const AppBarItem: React.FC<{ Action?: React.ReactNode }> = ({ primaryText, secondaryText = '', Action }) => { return ( - + {primaryText}: {' '} - + {secondaryText} {Action} diff --git a/nym-wallet/src/components/CopyToClipboard.tsx b/nym-wallet/src/components/CopyToClipboard.tsx index 14ec3fce39..afde227b01 100644 --- a/nym-wallet/src/components/CopyToClipboard.tsx +++ b/nym-wallet/src/components/CopyToClipboard.tsx @@ -1,14 +1,16 @@ import React, { useEffect, useState } from 'react' -import { IconButton, Tooltip } from '@mui/material' +import { Button, IconButton, Tooltip } from '@mui/material' import { Check, ContentCopy } from '@mui/icons-material' import { clipboard } from '@tauri-apps/api' export const CopyToClipboard = ({ text = '', light, + iconButton, }: { text?: string light?: boolean + iconButton?: boolean }) => { const [copied, setCopied] = useState(false) @@ -22,24 +24,59 @@ export const CopyToClipboard = ({ } useEffect(() => { + let timer: NodeJS.Timeout if (copied) { - setTimeout(() => { + timer = setTimeout(() => { setCopied(false) - }, 1000) + }, 2000) } + return () => clearTimeout(timer) }, [copied]) + + if (iconButton) + return ( + + handleCopy(text)} + size="small" + sx={{ + color: (theme) => + light + ? theme.palette.common.white + : theme.palette.nym.background.dark, + }} + > + {!copied ? ( + + ) : ( + + )} + + + ) + return ( - - handleCopy(text)} - size="small" - sx={{ - color: (theme) => - light ? theme.palette.common.white : theme.palette.grey[600], - }} - > - {!copied ? : } - - + ) } diff --git a/nym-wallet/src/components/Nav.tsx b/nym-wallet/src/components/Nav.tsx index 92425bd775..9eb4ad0af9 100644 --- a/nym-wallet/src/components/Nav.tsx +++ b/nym-wallet/src/components/Nav.tsx @@ -2,59 +2,58 @@ import React, { useContext, useEffect } from 'react' import { Link, useLocation } from 'react-router-dom' import { List, ListItem, ListItemIcon, ListItemText } from '@mui/material' import { - AccountBalanceWalletRounded, + AccountBalanceWalletOutlined, ArrowBack, ArrowForward, AttachMoney, - Cancel, - HowToVote, + CancelOutlined, + HowToVoteOutlined, MoneyOff, Description, Settings, } from '@mui/icons-material' - import { ADMIN_ADDRESS, ClientContext } from '../context/main' let routesSchema = [ { label: 'Balance', route: '/balance', - Icon: , + Icon: AccountBalanceWalletOutlined, }, { label: 'Send', route: '/send', - Icon: , + Icon: ArrowForward, }, { label: 'Receive', route: '/receive', - Icon: , + Icon: ArrowBack, }, { label: 'Bond', route: '/bond', - Icon: , + Icon: AttachMoney, }, { label: 'Unbond', route: '/unbond', - Icon: , + Icon: MoneyOff, }, { label: 'Delegate', route: '/delegate', - Icon: , + Icon: HowToVoteOutlined, }, { label: 'Undelegate', route: '/undelegate', - Icon: , + Icon: CancelOutlined, }, ] export const Nav = () => { - const { clientDetails, handleShowAdmin, logOut } = useContext(ClientContext) + const { clientDetails, handleShowAdmin } = useContext(ClientContext) const location = useLocation() useEffect(() => { @@ -62,7 +61,7 @@ export const Nav = () => { routesSchema.push({ label: 'Docs', route: '/docs', - Icon: , + Icon: Description, }) } }, []) @@ -72,30 +71,27 @@ export const Nav = () => { style={{ display: 'flex', alignItems: 'center', - justifyContent: 'center', + justifyContent: 'flex-start', }} > - - {routesSchema.map((r, i) => ( - + + {routesSchema.map(({ Icon, route, label }, i) => ( + - {r.Icon} + ))} diff --git a/nym-wallet/src/layouts/AppLayout.tsx b/nym-wallet/src/layouts/AppLayout.tsx index 8dfefe6004..1318c909bc 100644 --- a/nym-wallet/src/layouts/AppLayout.tsx +++ b/nym-wallet/src/layouts/AppLayout.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Box, Divider } from '@mui/material' +import { Box } from '@mui/material' import { Nav } from '../components' import Logo from '../images/logo-background.svg' import { AppBar } from '../components/AppBar' @@ -20,21 +20,14 @@ export const ApplicationLayout: React.FC = ({ children }) => { sx={{ background: '#121726', overflow: 'auto', + p: [4, 5], }} > - + - theme.palette.grey[100], marginTop: 6 }} - /> - -