diff --git a/tauri-wallet/src/components/Nav.tsx b/tauri-wallet/src/components/Nav.tsx index b9c98f1214..d6c2a7d272 100644 --- a/tauri-wallet/src/components/Nav.tsx +++ b/tauri-wallet/src/components/Nav.tsx @@ -1,5 +1,5 @@ import React, { useContext } from 'react' -import { Link } from 'react-router-dom' +import { Link, useLocation } from 'react-router-dom' import { List, ListItem, @@ -81,6 +81,7 @@ const useStyles = makeStyles((theme: Theme) => ({ export const Nav = () => { const classes = useStyles() const { logOut } = useContext(ClientContext) + const location = useLocation() return (
( - - +const AppWrapper = () => { + const { clientDetails } = useContext(ClientContext) + return ( + + + {!clientDetails ? ( + + ) : ( + + + + )} + + ) +} + +const App = () => { + return ( - + - -) + ) +} const root = document.getElementById('root') diff --git a/tauri-wallet/src/components/Page.tsx b/tauri-wallet/src/layouts/AppLayout.tsx similarity index 88% rename from tauri-wallet/src/components/Page.tsx rename to tauri-wallet/src/layouts/AppLayout.tsx index bd01cc78bf..a263c8e384 100644 --- a/tauri-wallet/src/components/Page.tsx +++ b/tauri-wallet/src/layouts/AppLayout.tsx @@ -1,11 +1,14 @@ import React from 'react' import { Divider } from '@material-ui/core' -import { AddressCard, BalanceCard } from './NavigationCards' -import { Nav } from './Nav' +import { AddressCard, BalanceCard, Nav } from '../components' import Logo from '../images/logo.png' import { theme } from '../theme' -export const Page = ({ children }: { children: React.ReactElement }) => { +export const ApplicationLayout = ({ + children, +}: { + children: React.ReactElement +}) => { return (
{ gridTemplateRows: '100%', gridColumnGap: '8px', gridRowGap: '0px', + overflow: 'hidden', }} >
{ display: 'flex', alignItems: 'center', justifyContent: 'center', + overflow: 'auto', }} > - + {children} diff --git a/tauri-wallet/src/layouts/index.tsx b/tauri-wallet/src/layouts/index.tsx new file mode 100644 index 0000000000..831d294045 --- /dev/null +++ b/tauri-wallet/src/layouts/index.tsx @@ -0,0 +1,2 @@ +export * from './AppLayout' +export * from './ContentLayout' diff --git a/tauri-wallet/src/routes/404.tsx b/tauri-wallet/src/routes/404.tsx index f895b41bdd..0452e298ae 100644 --- a/tauri-wallet/src/routes/404.tsx +++ b/tauri-wallet/src/routes/404.tsx @@ -1,14 +1,12 @@ import React, { useState } from 'react' -import { Layout, Page } from '../components' +import { Layout } from '../layouts' export const NotFound = () => { return ( - - - <> -

404

- -
-
+ + <> +

404

+ +
) } diff --git a/tauri-wallet/src/routes/balance.tsx b/tauri-wallet/src/routes/balance.tsx index 32a18a1a1f..61a6513653 100644 --- a/tauri-wallet/src/routes/balance.tsx +++ b/tauri-wallet/src/routes/balance.tsx @@ -1,9 +1,10 @@ import React, { useContext } from 'react' import { Button, Grid } from '@material-ui/core' -import { Refresh } from '@material-ui/icons' -import { Layout, NymCard, Page } from '../components' -import { ClientContext } from '../context/main' import { Alert } from '@material-ui/lab' +import { Refresh } from '@material-ui/icons' +import { NymCard } from '../components' +import { Layout } from '../layouts' +import { ClientContext } from '../context/main' import { theme } from '../theme' export const Balance = () => { @@ -25,29 +26,27 @@ export const Balance = () => { ) return ( - - - - - - {balanceError && ( - }> - {balanceError} - - )} - {!balanceError && ( - } - > - {'The current balance is ' + balance?.amount} - - )} - + + + + + {balanceError && ( + }> + {balanceError} + + )} + {!balanceError && ( + } + > + {'The current balance is ' + balance?.printable_balance} + + )} - - - +
+ + ) } diff --git a/tauri-wallet/src/routes/bond/index.tsx b/tauri-wallet/src/routes/bond/index.tsx index 5b0395e095..d34a4cd90a 100644 --- a/tauri-wallet/src/routes/bond/index.tsx +++ b/tauri-wallet/src/routes/bond/index.tsx @@ -1,15 +1,14 @@ import React from 'react' -import { Layout, NymCard, Page } from '../../components' +import { NymCard } from '../../components' +import { Layout } from '../../layouts' import { BondForm } from './BondForm' export const Bond = () => { return ( - - - - - - - + + + + + ) } diff --git a/tauri-wallet/src/routes/delegate/index.tsx b/tauri-wallet/src/routes/delegate/index.tsx index 9ca3a65d10..c0a8806c3f 100644 --- a/tauri-wallet/src/routes/delegate/index.tsx +++ b/tauri-wallet/src/routes/delegate/index.tsx @@ -1,19 +1,18 @@ import React from 'react' import { DelegateForm } from './DelegateForm' -import { Layout, NymCard, Page } from '../../components' +import { NymCard } from '../../components' +import { Layout } from '../../layouts' export const Delegate = () => { return ( - - - - - - - + + + + + ) } diff --git a/tauri-wallet/src/routes/internal-docs/index.tsx b/tauri-wallet/src/routes/internal-docs/index.tsx index 97554a4ec5..f7cdc36375 100644 --- a/tauri-wallet/src/routes/internal-docs/index.tsx +++ b/tauri-wallet/src/routes/internal-docs/index.tsx @@ -1,17 +1,16 @@ import React, { useState } from 'react' -import { Layout, Page, NymCard } from '../../components' +import { NymCard } from '../../components' import { ApiList } from './ApiList' +import { Layout } from '../../layouts' export const InternalDocs = () => { if (process.env.NODE_ENV == 'development') { return ( - - - - - - - + + + + + ) } diff --git a/tauri-wallet/src/routes/receive.tsx b/tauri-wallet/src/routes/receive.tsx index ee0ed97b4f..37685a15fa 100644 --- a/tauri-wallet/src/routes/receive.tsx +++ b/tauri-wallet/src/routes/receive.tsx @@ -1,8 +1,9 @@ import React, { useContext } from 'react' -import { Card, CardContent, Grid, Typography } from '@material-ui/core' +import { Card, Grid, Typography } from '@material-ui/core' import { Alert } from '@material-ui/lab' -import { CopyToClipboard, Layout, NymCard, Page } from '../components' import { useMediaQuery } from '@material-ui/core' +import { CopyToClipboard, NymCard } from '../components' +import { Layout } from '../layouts' import { theme } from '../theme' import { ClientContext } from '../context/main' @@ -11,38 +12,36 @@ export const Receive = () => { const matches = useMediaQuery('(min-width:769px)') return ( - - - - - - - You can receive tokens by providing this address to the sender - - - - - - {clientDetails?.client_address} - - - - + + + + + + You can receive tokens by providing this address to the sender + - - - + + + + {clientDetails?.client_address} + + + + +
+ + ) } diff --git a/tauri-wallet/src/routes/send/index.tsx b/tauri-wallet/src/routes/send/index.tsx index 0a4c2d3e02..db998cd8ea 100644 --- a/tauri-wallet/src/routes/send/index.tsx +++ b/tauri-wallet/src/routes/send/index.tsx @@ -1,15 +1,14 @@ import React from 'react' -import { Layout, NymCard, Page } from '../../components' +import { NymCard } from '../../components' import { SendWizard } from './SendWizard' +import { Layout } from '../../layouts' export const Send = () => { return ( - - - - - - - + + + + + ) } diff --git a/tauri-wallet/src/routes/sign-in.tsx b/tauri-wallet/src/routes/sign-in.tsx index bcd8c49bdd..c1b8293bd2 100644 --- a/tauri-wallet/src/routes/sign-in.tsx +++ b/tauri-wallet/src/routes/sign-in.tsx @@ -31,7 +31,7 @@ export const SignIn = () => { setIsLoading(true) setInputError(undefined) - invoke('connect_with_mnemonic', { mnemonic }) + await invoke('connect_with_mnemonic', { mnemonic }) .then((res) => { logIn(res as TClientDetails) }) diff --git a/tauri-wallet/src/routes/unbond/index.tsx b/tauri-wallet/src/routes/unbond/index.tsx index 2333437b57..ff768ab63e 100644 --- a/tauri-wallet/src/routes/unbond/index.tsx +++ b/tauri-wallet/src/routes/unbond/index.tsx @@ -1,19 +1,14 @@ import React from 'react' -import { Layout, NymCard, Page } from '../../components' +import { NymCard } from '../../components' import { UnbondForm } from './UnbondForm' +import { Layout } from '../../layouts' export const Unbond = () => { return ( - - - - - - - + + + + + ) } diff --git a/tauri-wallet/src/routes/undelegate/index.tsx b/tauri-wallet/src/routes/undelegate/index.tsx index 80dbf5161b..479554d89b 100644 --- a/tauri-wallet/src/routes/undelegate/index.tsx +++ b/tauri-wallet/src/routes/undelegate/index.tsx @@ -1,19 +1,18 @@ import React from 'react' -import { Layout, NymCard, Page } from '../../components' +import { NymCard } from '../../components' import { UndelegateForm } from './UndelegateForm' +import { Layout } from '../../layouts' export const Undelegate = () => { return ( - - - - - - - + + + + + ) } diff --git a/tauri-wallet/tsconfig.json b/tauri-wallet/tsconfig.json index c161daf48c..47c3a46834 100644 --- a/tauri-wallet/tsconfig.json +++ b/tauri-wallet/tsconfig.json @@ -47,7 +47,7 @@ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ "typeRoots": [ - "node_modules/@types", + "../node_modules/@types", "src/types", "./" ] /* List of folders to include type definitions from. */,