A local-first personal finance app
:bug: (mobile) hide sync button if sync is not active (#1546)
Matiss Janis Aboltins85f21550cbeb
diff --git a/packages/desktop-client/src/components/Titlebar.tsx b/packages/desktop-client/src/components/Titlebar.tsxindex a98f594c94..afe4b8729e 100644--- a/packages/desktop-client/src/components/Titlebar.tsx+++ b/packages/desktop-client/src/components/Titlebar.tsx@@ -149,6 +149,21 @@ export function SyncButton({ style }: SyncButtonProps) {return unlisten;}, []);+ const mobileColor =+ syncState === 'error'+ ? colors.r7+ : syncState === 'disabled' ||+ syncState === 'offline' ||+ syncState === 'local'+ ? colors.n9+ : style.color;+ const activeStyle = css(+ // mobile+ media(`(max-width: ${tokens.breakpoint_small})`, {+ color: mobileColor,+ }),+ );+return (<Buttontype="bare"@@ -156,14 +171,7 @@ export function SyncButton({ style }: SyncButtonProps) {style,{WebkitAppRegion: 'none',- color:- syncState === 'error'- ? colors.r7- : syncState === 'disabled' ||- syncState === 'offline' ||- syncState === 'local'- ? colors.n9- : null,+ color: mobileColor,},media(`(min-width: ${tokens.breakpoint_small})`, {color:@@ -176,6 +184,8 @@ export function SyncButton({ style }: SyncButtonProps) {: null,}),)}+ hoveredStyle={activeStyle}+ activeStyle={activeStyle}onClick={sync}>{syncState === 'error' ? (diff --git a/packages/desktop-client/src/components/budget/MobileBudgetTable.js b/packages/desktop-client/src/components/budget/MobileBudgetTable.jsindex 0242523f39..39c065ba58 100644--- a/packages/desktop-client/src/components/budget/MobileBudgetTable.js+++ b/packages/desktop-client/src/components/budget/MobileBudgetTable.js@@ -22,6 +22,7 @@ import Card from '../common/Card';import Label from '../common/Label';import Text from '../common/Text';import View from '../common/View';+import { useServerURL } from '../ServerContext';import CellValue from '../spreadsheet/CellValue';import format from '../spreadsheet/format';import NamespaceContext from '../spreadsheet/NamespaceContext';@@ -1016,6 +1017,8 @@ function BudgetHeader({onPrevMonth,onNextMonth,}) {+ let serverURL = useServerURL();+// let [menuOpen, setMenuOpen] = useState(false);// let onMenuSelect = type => {@@ -1113,18 +1116,20 @@ function BudgetHeader({/></Button>- <SyncButton- style={{- color: 'white',- position: 'absolute',- top: 0,- bottom: 0,- right: 0,- backgroundColor: 'transparent',- paddingLeft: 12,- paddingRight: 12,- }}- />+ {serverURL && (+ <SyncButton+ style={{+ color: 'white',+ position: 'absolute',+ top: 0,+ bottom: 0,+ right: 0,+ backgroundColor: 'transparent',+ paddingLeft: 12,+ paddingRight: 12,+ }}+ />+ )}{/* <Buttontype="bare"onClick={() => setMenuOpen(true)}diff --git a/upcoming-release-notes/1546.md b/upcoming-release-notes/1546.mdnew file mode 100644index 0000000000..3f72299a74--- /dev/null+++ b/upcoming-release-notes/1546.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [MatissJanis]+---++Mobile: hide sync button when sync is not active