From a2981ea552b142edce582dd1124efec31241962a Mon Sep 17 00:00:00 2001 From: Jonny Scholes Date: Sat, 10 Jul 2021 23:20:34 +1000 Subject: [PATCH 1/3] Link wallet preview button to profile. Separate unsync button from profile button. --- src/components/header/index.js | 48 ++++++++++++++++------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/src/components/header/index.js b/src/components/header/index.js index e94a5f240..034527ea6 100644 --- a/src/components/header/index.js +++ b/src/components/header/index.js @@ -29,20 +29,6 @@ export const Header = () => { context.setTheme(getItem('theme') || setItem('theme', 'dark')) }, []) - // we assume user isn't connected - let button = 'sync' - - // but if they are - if (context.acc?.address) { - // is menu closed? - if (context.collapsed) { - button = walletPreview(context.acc.address) - } else { - // menu is open - button = 'unsync' - } - } - //const activeAccount = await wallet.client.getActiveAccount() //console.log(activeAccount) const handleRoute = (path, data) => { @@ -50,16 +36,29 @@ export const Header = () => { history.push(path, data) } - const handleSyncUnsync = () => { - if (context.acc?.address && !context.collapsed) { - // disconnect wallet - context.disconnect() - } else { - // connect wallet - context.syncTaquito() - } + // we assume user isn't connected + let profileButton = ( + + ) + + // but if they are, we add shortcut to their profile + if (context.acc?.address) { + profileButton = ( + + ) } + // ... and show additional unsync button when menu opens + const unSyncButton = context.acc?.address && !context.collapsed ? ( + + ) : '' + return ( <>
@@ -138,9 +137,8 @@ export const Header = () => {
- + {unSyncButton} + {profileButton} - ) + let headerButtonHandler = () => context.syncTaquito() + let headerButtonText = 'sync' - // but if they are, we add shortcut to their profile + // but if they are if (context.acc?.address) { - profileButton = ( - - ) + // is menu closed? + if (context.collapsed) { + headerButtonHandler = () => handleRoute('/sync', 'tz') + headerButtonText = walletPreview(context.acc.address) + } else { + // menu is open + headerButtonHandler = () => context.disconnect() + headerButtonText = 'unsync' + } } - // ... and show additional unsync button when menu opens - const unSyncButton = context.acc?.address && !context.collapsed ? ( - - ) : '' - return ( <>
@@ -137,8 +131,9 @@ export const Header = () => {
- {unSyncButton} - {profileButton} +