Skip to content

Commit 85f2155

Browse files
authored
🐛 (mobile) hide sync button if sync is not active (#1546)
1 parent fe8ed4e commit 85f2155

File tree

3 files changed

+41
-20
lines changed

3 files changed

+41
-20
lines changed

packages/desktop-client/src/components/Titlebar.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,21 +149,29 @@ export function SyncButton({ style }: SyncButtonProps) {
149149
return unlisten;
150150
}, []);
151151

152+
const mobileColor =
153+
syncState === 'error'
154+
? colors.r7
155+
: syncState === 'disabled' ||
156+
syncState === 'offline' ||
157+
syncState === 'local'
158+
? colors.n9
159+
: style.color;
160+
const activeStyle = css(
161+
// mobile
162+
media(`(max-width: ${tokens.breakpoint_small})`, {
163+
color: mobileColor,
164+
}),
165+
);
166+
152167
return (
153168
<Button
154169
type="bare"
155170
style={css(
156171
style,
157172
{
158173
WebkitAppRegion: 'none',
159-
color:
160-
syncState === 'error'
161-
? colors.r7
162-
: syncState === 'disabled' ||
163-
syncState === 'offline' ||
164-
syncState === 'local'
165-
? colors.n9
166-
: null,
174+
color: mobileColor,
167175
},
168176
media(`(min-width: ${tokens.breakpoint_small})`, {
169177
color:
@@ -176,6 +184,8 @@ export function SyncButton({ style }: SyncButtonProps) {
176184
: null,
177185
}),
178186
)}
187+
hoveredStyle={activeStyle}
188+
activeStyle={activeStyle}
179189
onClick={sync}
180190
>
181191
{syncState === 'error' ? (

packages/desktop-client/src/components/budget/MobileBudgetTable.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import Card from '../common/Card';
2222
import Label from '../common/Label';
2323
import Text from '../common/Text';
2424
import View from '../common/View';
25+
import { useServerURL } from '../ServerContext';
2526
import CellValue from '../spreadsheet/CellValue';
2627
import format from '../spreadsheet/format';
2728
import NamespaceContext from '../spreadsheet/NamespaceContext';
@@ -1016,6 +1017,8 @@ function BudgetHeader({
10161017
onPrevMonth,
10171018
onNextMonth,
10181019
}) {
1020+
let serverURL = useServerURL();
1021+
10191022
// let [menuOpen, setMenuOpen] = useState(false);
10201023

10211024
// let onMenuSelect = type => {
@@ -1113,18 +1116,20 @@ function BudgetHeader({
11131116
/>
11141117
</Button>
11151118

1116-
<SyncButton
1117-
style={{
1118-
color: 'white',
1119-
position: 'absolute',
1120-
top: 0,
1121-
bottom: 0,
1122-
right: 0,
1123-
backgroundColor: 'transparent',
1124-
paddingLeft: 12,
1125-
paddingRight: 12,
1126-
}}
1127-
/>
1119+
{serverURL && (
1120+
<SyncButton
1121+
style={{
1122+
color: 'white',
1123+
position: 'absolute',
1124+
top: 0,
1125+
bottom: 0,
1126+
right: 0,
1127+
backgroundColor: 'transparent',
1128+
paddingLeft: 12,
1129+
paddingRight: 12,
1130+
}}
1131+
/>
1132+
)}
11281133
{/* <Button
11291134
type="bare"
11301135
onClick={() => setMenuOpen(true)}

upcoming-release-notes/1546.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: Bugfix
3+
authors: [MatissJanis]
4+
---
5+
6+
Mobile: hide sync button when sync is not active

0 commit comments

Comments
 (0)