diff --git a/tauri-wallet/src/components/Admin.tsx b/tauri-wallet/src/components/AdminForm.tsx similarity index 98% rename from tauri-wallet/src/components/Admin.tsx rename to tauri-wallet/src/components/AdminForm.tsx index 98aa934d45..9c11370ae0 100644 --- a/tauri-wallet/src/components/Admin.tsx +++ b/tauri-wallet/src/components/AdminForm.tsx @@ -23,9 +23,9 @@ export const Admin: React.FC = () => { } return ( - + - + diff --git a/tauri-wallet/src/components/Nav.tsx b/tauri-wallet/src/components/Nav.tsx index 468169f71c..679e0365b3 100644 --- a/tauri-wallet/src/components/Nav.tsx +++ b/tauri-wallet/src/components/Nav.tsx @@ -21,7 +21,7 @@ import { } from '@material-ui/icons' import { makeStyles } from '@material-ui/styles' import clsx from 'clsx' -import { ClientContext } from '../context/main' +import { ADMIN_ADDRESS, ClientContext } from '../context/main' let routesSchema = [ { @@ -81,7 +81,7 @@ const useStyles = makeStyles((theme: Theme) => ({ export const Nav = () => { const classes = useStyles() - const { handleShowAdmin, logOut } = useContext(ClientContext) + const { clientDetails, handleShowAdmin, logOut } = useContext(ClientContext) const location = useLocation() return ( @@ -114,17 +114,20 @@ export const Nav = () => { /> ))} - - - - - - + {clientDetails?.client_address === ADMIN_ADDRESS && ( + + + + + + + )} + diff --git a/tauri-wallet/src/components/index.ts b/tauri-wallet/src/components/index.ts index dbdc9e5889..e304e4a5f8 100644 --- a/tauri-wallet/src/components/index.ts +++ b/tauri-wallet/src/components/index.ts @@ -1,3 +1,4 @@ +export * from './AdminForm' export * from './Error' export * from './Confirmation' export * from './CopyToClipboard' diff --git a/tauri-wallet/src/context/main.tsx b/tauri-wallet/src/context/main.tsx index 41d5be17ae..9e8dfe7482 100644 --- a/tauri-wallet/src/context/main.tsx +++ b/tauri-wallet/src/context/main.tsx @@ -3,6 +3,8 @@ import { useHistory } from 'react-router-dom' import { Coin, TClientDetails, TSignInWithMnemonic } from '../types' import { TUseGetBalance, useGetBalance } from '../hooks/useGetBalance' +export const ADMIN_ADDRESS = 'punk1h3w4nj7kny5dfyjw2le4vm74z03v9vd4dstpu0' + type TClientContext = { clientDetails?: TClientDetails getBalance: TUseGetBalance diff --git a/tauri-wallet/src/index.tsx b/tauri-wallet/src/index.tsx index 02c0be2d54..0a4c9c2951 100644 --- a/tauri-wallet/src/index.tsx +++ b/tauri-wallet/src/index.tsx @@ -8,8 +8,7 @@ import { theme } from './theme' import { ClientContext, ClientContextProvider } from './context/main' import { ApplicationLayout } from './layouts' import { SignIn } from './routes/sign-in' -import { ErrorFallback } from './components' -import { Admin } from './components/Admin' +import { Admin, ErrorFallback } from './components' const AppWrapper = () => { const { clientDetails } = useContext(ClientContext)