From ad092c281ee969adc2723cb5fe0d67c889f1b66d Mon Sep 17 00:00:00 2001
From: Jed Fox <git@jedfox.com>
Date: Mon, 2 Jan 2023 12:43:28 -0500
Subject: [PATCH] Remove sync button when there is no server

---
 packages/desktop-client/src/components/Titlebar.js | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/packages/desktop-client/src/components/Titlebar.js b/packages/desktop-client/src/components/Titlebar.js
index c0b807ca8..dc2899218 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>
   );
-- 
GitLab