diff --git a/packages/desktop-client/src/components/LoggedInUser.js b/packages/desktop-client/src/components/LoggedInUser.js index c4d115f936db75e798b7efe7b38b6f24d8325332..d3bae724a6e968e6d5d4a7d905fbae1f5bc1b8d0 100644 --- a/packages/desktop-client/src/components/LoggedInUser.js +++ b/packages/desktop-client/src/components/LoggedInUser.js @@ -37,7 +37,7 @@ function LoggedInUser({ async function onChangePassword() { await closeBudget(); - history.push('/change-password'); + window.__history.push('/change-password'); } function onMenuSelect(type) { @@ -54,11 +54,12 @@ function LoggedInUser({ } } - function onClick() { + async function onClick() { if (serverUrl) { setMenuOpen(true); } else { - history.push('/config-server'); + await closeBudget(); + window.__history.push('/config-server'); } } diff --git a/packages/desktop-client/src/components/Titlebar.js b/packages/desktop-client/src/components/Titlebar.js index c0b807ca8a40e0c85672bf1182f6617b36cf5486..dc2899218ea765b19bab4a591aa039fd2e60b774 100644 --- a/packages/desktop-client/src/components/Titlebar.js +++ b/packages/desktop-client/src/components/Titlebar.js @@ -22,6 +22,7 @@ import AlertTriangle from 'loot-design/src/svg/v2/AlertTriangle'; import ArrowButtonRight1 from 'loot-design/src/svg/v2/ArrowButtonRight1'; import NavigationMenu from 'loot-design/src/svg/v2/NavigationMenu'; +import { useServerURL } from '../hooks/useServerURL'; import AccountSyncCheck from './accounts/AccountSyncCheck'; import AnimatedRefresh from './AnimatedRefresh'; import { MonthCountSelector } from './budget/MonthCountSelector'; @@ -247,6 +248,7 @@ function Titlebar({ sync }) { let sidebar = useSidebar(); + const serverURL = useServerURL(); return ( <View @@ -353,11 +355,13 @@ function Titlebar({ </Switch> <View style={{ flex: 1 }} /> <UncategorizedButton /> - <SyncButton - style={{ marginLeft: 10 }} - localPrefs={localPrefs} - onSync={sync} - /> + {serverURL ? ( + <SyncButton + style={{ marginLeft: 10 }} + localPrefs={localPrefs} + onSync={sync} + /> + ) : null} <LoggedInUser style={{ marginLeft: 10 }} /> </View> );