Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Settings: "Show connection status" hides the bar at the top, a dot on Home keeps the warning (#369, #330)

Duarte Santos8150382378a6
diff --git a/docs/MOBILE.md b/docs/MOBILE.md
index 3785a781d..d602255ef 100644
--- a/docs/MOBILE.md
+++ b/docs/MOBILE.md
@@ -73,6 +73,12 @@ status bar says so on every screen, and stays until the condition is gone:
| *This phone is no longer paired with your server…* | A phone that an earlier version of the app unpaired by itself after its token was refused. The address is gone. | **Pair again**, typing the address. |
| *On this phone only — not connected to a server* | Local mode, chosen at first launch or after Disconnect. Said quietly. | Nothing, or **Connect** to pair with a server. |
+Don't want the line? Settings → Appearance → **Show connection status** turns it off (it is on
+by default, and the setting travels with your profile). A phone kept local on purpose then shows
+nothing at all. On a phone with a server, a problem — offline, an error, a refused phone, or
+changes still waiting after a few seconds — puts a small orange dot on the **Home** tab and on
+the Settings gear instead; Settings → Server & sync says what it is.
+
In every one of these states the phone keeps its data and every change you make. Pairing
again with the **same account** merges what the phone kept with what the server has — new
workouts from both sides, the later edit of each routine, the newer copy's settings — and
diff --git a/frontend/src/components/SyncBanner.jsx b/frontend/src/components/SyncBanner.jsx
index 24026d434..8bc672efe 100644
--- a/frontend/src/components/SyncBanner.jsx
+++ b/frontend/src/components/SyncBanner.jsx
@@ -13,7 +13,8 @@ export const PENDING_GRACE_MS = 5000
/* The connection, always in view while the app is not connected to a server: offline, the server
unreachable or answering with an error (its HTTP code, for whoever runs it), a server that no
longer accepts this device, an answer that is not openGym's, and no server at all — a phone
- kept local, a guest in a browser. It cannot be dismissed; it goes when the condition does.
+ kept local, a guest in a browser. It cannot be dismissed; it goes when the condition does — or
+ when Settings → "Show connection status" is off, and then a dot on Home says a problem is there.
The first ones say what is wrong and that the changes are kept here, with the one thing to do
about it (retry, pair again, sign in); the deliberate local setup only says so, quietly.
@@ -21,15 +22,15 @@ export const PENDING_GRACE_MS = 5000
tab bar, the timer and every sheet. Its height goes into --conn on the root, which the page's
top padding and those headers add in, so it takes its own room instead of covering a control.
The public demo has no server by design and says so itself; it never shows there. */
-export default function SyncBanner() {
- const nav = useNavigate()
+// What the indicator would say right now, and whether it would say it: shared by the banner and
+// by the dot that stands in for it when the banner is switched off (useConnectionTrouble).
+function useConnection() {
const user = useStore(s => s.user)
const sync = useStore(s => s.sync)
const guest = useStore(s => s.isGuest())
const onboarding = useStore(s => s.needsMobileOnboarding)
const online = useOnline()
const [waited, setWaited] = useState(false)
- const row = useRef(null)
const status = sync?.status
useEffect(() => {
setWaited(false)
@@ -42,6 +43,32 @@ export default function SyncBanner() {
// Signed out on the web, the sign-in screen is the whole app: it hears only that the server
// ended the session, and that the changes are still here.
const show = !DEMO && !onboarding && !!view?.banner && (!!user || guest || status === 'auth') && (status !== 'pending' || waited)
+ return { view, show, user, status }
+}
+
+// "Show connection status" (#369, #330): on by default, and an older profile without the key
+// reads as on. Off hides the banner — for a phone kept local on purpose it is a line that never
+// goes — but a sync that is stuck still has to be noticed somewhere.
+export const showsConnection = S => S?.connStatus !== false
+
+/* True while the banner is switched off and the connection has a problem worth seeing: offline,
+ the server unreachable or answering with an error, refusing this device, a sign-in question
+ still open, or changes waiting past the grace period. Never for a device with no server at all
+ (a phone kept local, a guest): that is a choice, not a fault. The Home tab and the Settings
+ gear carry a dot for it. */
+export function useConnectionTrouble() {
+ const on = useStore(s => showsConnection(s.S))
+ const { view, show } = useConnection()
+ return !on && show && (view.tone === 'off' || view.tone === 'bad' || view.tone === 'wait')
+}
+
+export default function SyncBanner() {
+ const nav = useNavigate()
+ const on = useStore(s => showsConnection(s.S))
+ const conn = useConnection()
+ const { view, user, status } = conn
+ const show = conn.show && on
+ const row = useRef(null)
useLayoutEffect(() => {
const root = document.documentElement
diff --git a/frontend/src/components/SyncBanner.test.jsx b/frontend/src/components/SyncBanner.test.jsx
index 2fa4ec48d..4a8735ae0 100644
--- a/frontend/src/components/SyncBanner.test.jsx
+++ b/frontend/src/components/SyncBanner.test.jsx
@@ -2,7 +2,7 @@
import React, { act } from 'react'
import { createRoot } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-import SyncBanner, { PENDING_GRACE_MS } from './SyncBanner.jsx'
+import SyncBanner, { PENDING_GRACE_MS, useConnectionTrouble } from './SyncBanner.jsx'
import { connectionView } from './ServerSync.jsx'
globalThis.IS_REACT_ACT_ENVIRONMENT = true
@@ -14,12 +14,12 @@ globalThis.IS_REACT_ACT_ENVIRONMENT = true
waiting for its push does not flash it. The store is a stand-in: its `sync` is what each test
sets; ServerSync.jsx (the words and the actions) is the real one. */
const mocks = vi.hoisted(() => {
- const state = { MOBILE: false, DEMO: false, webauthn: true, user: null, guest: false, onboarding: false, sync: null, sheets: [], navs: [] }
+ const state = { MOBILE: false, DEMO: false, webauthn: true, user: null, guest: false, onboarding: false, sync: null, S: {}, sheets: [], navs: [] }
state.toast = vi.fn()
state.syncNow = vi.fn(async () => state.sync)
state.passkeyLogin = vi.fn(async () => ({ id: 'u1', name: 'andi' }))
state.snapshot = () => ({
- user: state.user, sync: state.sync, needsMobileOnboarding: state.onboarding,
+ S: state.S, user: state.user, sync: state.sync, needsMobileOnboarding: state.onboarding,
isGuest: () => state.guest, syncNow: state.syncNow,
setUser: vi.fn(), adoptProfile: vi.fn(async () => ({})),
})
@@ -56,7 +56,7 @@ const network = on => {
let host, root
beforeEach(() => {
network(true)
- Object.assign(mocks, { MOBILE: false, DEMO: false, webauthn: true, user: { id: 'u1', name: 'andi' }, guest: false, onboarding: false, sync: sync('ok') })
+ Object.assign(mocks, { MOBILE: false, DEMO: false, webauthn: true, user: { id: 'u1', name: 'andi' }, guest: false, onboarding: false, sync: sync('ok'), S: {} })
mocks.sheets.length = 0
mocks.navs.length = 0
mocks.toast.mockClear(); mocks.syncNow.mockClear(); mocks.passkeyLogin.mockClear()
@@ -305,3 +305,75 @@ describe('a change waiting while the server is reachable', () => {
expect(conn()).toBe('')
})
})
+
+// Settings → "Show connection status" (#369, #330): off hides the bar in every state; a problem
+// then shows as a dot (useConnectionTrouble), and a device with no server never gets one.
+describe('with the connection status switched off', () => {
+ const Probe = () => <i className="probe" data-trouble={String(useConnectionTrouble())} />
+ const both = () => act(() => root.render(<><SyncBanner /><Probe /></>))
+ const trouble = () => host.querySelector('.probe').dataset.trouble === 'true'
+
+ it('hides the bar whatever it would say, and gives the page its height back', () => {
+ for (const [st, extra, who] of [
+ ['offline', { pending: true }, {}], ['error', { lastError: { status: 502 } }, {}], ['auth', {}, {}], ['held', {}, {}],
+ ['local', { server: null }, { MOBILE: true, user: null, guest: true }], ['local', {}, { user: null, guest: true }],
+ ]) {
+ Object.assign(mocks, { MOBILE: false, user: { id: 'u1', name: 'andi' }, guest: false }, who, { sync: sync(st, extra), S: { connStatus: true } })
+ both()
+ expect(bar(), st).not.toBeNull()
+ expect(conn(), st).not.toBe('')
+ mocks.S = { connStatus: false }
+ both()
+ expect(bar(), st).toBeNull()
+ expect(conn(), st).toBe('')
+ }
+ })
+
+ it('an older profile without the setting still shows it', () => {
+ mocks.S = {}
+ mocks.sync = sync('offline', { pending: true })
+ both()
+ expect(bar()).not.toBeNull()
+ expect(trouble()).toBe(false)
+ })
+
+ it('a dot for offline, an error, a refusal and an open sign-in question', () => {
+ mocks.S = { connStatus: false }
+ for (const st of ['offline', 'error', 'auth', 'held']) {
+ mocks.sync = sync(st, st === 'error' ? { lastError: { status: 500 } } : {})
+ both()
+ expect(trouble(), st).toBe(true)
+ }
+ mocks.sync = sync('ok')
+ both()
+ expect(trouble()).toBe(false)
+ })
+
+ it('a change waiting gets the dot only after the grace period', () => {
+ vi.useFakeTimers()
+ mocks.S = { connStatus: false }
+ mocks.sync = sync('pending', { pending: true })
+ both()
+ expect(trouble()).toBe(false)
+ act(() => { vi.advanceTimersByTime(PENDING_GRACE_MS + 100) })
+ expect(trouble()).toBe(true)
+ })
+
+ it('never for a phone kept local or a guest: no server is a choice, not a fault', () => {
+ mocks.S = { connStatus: false }
+ Object.assign(mocks, { MOBILE: true, user: null, guest: true, sync: sync('local', { server: null }) })
+ both()
+ expect(trouble()).toBe(false)
+ Object.assign(mocks, { MOBILE: false, user: null, guest: true, sync: sync('local') })
+ both()
+ expect(trouble()).toBe(false)
+ })
+
+ it('no dot while the bar is on: it already says so', () => {
+ mocks.S = { connStatus: true }
+ mocks.sync = sync('offline', { pending: true })
+ both()
+ expect(bar()).not.toBeNull()
+ expect(trouble()).toBe(false)
+ })
+})
diff --git a/frontend/src/components/TabBar.jsx b/frontend/src/components/TabBar.jsx
index 61801b6bf..21d706cf7 100644
--- a/frontend/src/components/TabBar.jsx
+++ b/frontend/src/components/TabBar.jsx
@@ -4,15 +4,16 @@ import { effectiveRoutineIds, effectiveRoutines } from '../lib/history.js'
import { todayISO } from '../lib/format.js'
import { t } from '../lib/i18n.js'
import Icon from './Icon.jsx'
+import { useConnectionTrouble } from './SyncBanner.jsx'
// Module scope, not TabBar's render body. Declared inside it, `Tab` was a new function on every
// render, so React saw a different component type each time and threw the button away and built a
// fresh one — on a bar that is fixed on screen, and once a second for the whole of a rest. The
// state it took with it is the DOM node itself: focus, the :active tint, any in-flight transition.
-function Tab({ active, icon, label, onClick }) {
+function Tab({ active, icon, label, onClick, dot }) {
return (
- <button className={active ? 'on' : ''} onClick={onClick}>
- <Icon name={icon} /><span>{label}</span>
+ <button className={active ? 'on' : ''} onClick={onClick} aria-label={dot ? label + ', ' + t('Connection problem') : undefined}>
+ <span className="tab-ic"><Icon name={icon} />{dot && <span className="tab-dot" aria-hidden="true" />}</span><span>{label}</span>
</button>
)
}
@@ -23,6 +24,9 @@ export default function TabBar({ onStart }) {
const S = useStore(s => s.S)
const user = useStore(s => s.user)
const isGuest = useStore(s => s.isGuest())
+ // With the connection banner switched off, a sync problem shows as a dot on Home, the tab
+ // Settings lives under (#369, #330).
+ const trouble = useConnectionTrouble()
if (!user && !isGuest) return null
const cur = loc.pathname.split('/')[1] || 'home'
const on = k => cur === k || (cur === 'history' && k === 'stats') || (cur === 'settings' && k === 'home') || (cur === 'muscles' && k === 'library') || (cur === 'structural-balance' && k === 'stats')
@@ -38,7 +42,7 @@ export default function TabBar({ onStart }) {
return (
<nav id="tabbar">
- <Tab active={on('home')} icon="house" label={t('Home')} onClick={() => nav('/home')} />
+ <Tab active={on('home')} icon="house" label={t('Home')} dot={trouble} onClick={() => nav('/home')} />
<Tab active={on('plan')} icon="calendar" label={t('Plan')} onClick={() => nav('/plan')} />
{/* On the workout screen itself there is nothing to resume, so the button reads as the
tab it is and stays lit (#29); anywhere else it brings you back to the exercise you
diff --git a/frontend/src/components/TabBar.test.jsx b/frontend/src/components/TabBar.test.jsx
index 7ee4250f5..f16908cb2 100644
--- a/frontend/src/components/TabBar.test.jsx
+++ b/frontend/src/components/TabBar.test.jsx
@@ -60,3 +60,23 @@ describe('the tab bar across a store write', () => {
expect(tabs()[0].className).toBe('on')
})
})
+
+// Settings → "Show connection status" off (#369, #330): a stuck sync shows as a dot on Home, the
+// tab Settings opens from, and the tab's name says it.
+describe('the connection dot on Home', () => {
+ const home = () => tabs()[0]
+ it('is there for a sync problem only while the banner is switched off', () => {
+ const original = useStore.getState().sync
+ try {
+ useStore.setState({ sync: { status: 'error', lastError: { status: 502 }, pending: true } })
+ act(() => { root.render(<TabBar onStart={() => {}} />) })
+ expect(home().querySelector('.tab-dot')).toBeNull()
+ act(() => { useStore.getState().update(s => { s.connStatus = false }, false) })
+ expect(home().querySelector('.tab-dot')).not.toBeNull()
+ expect(home().getAttribute('aria-label')).toBe('Home, Connection problem')
+ act(() => { useStore.setState({ sync: { status: 'ok', lastError: null, pending: false } }) })
+ expect(home().querySelector('.tab-dot')).toBeNull()
+ expect(home().getAttribute('aria-label')).toBeNull()
+ } finally { useStore.setState({ sync: original }) }
+ })
+})
diff --git a/frontend/src/index.css b/frontend/src/index.css
index a167187e5..bc9ca9e5f 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -400,6 +400,14 @@ h4.sec{
#tabbar button .icn{font-size:25px;--icon-stroke:1.65;color:var(--label)}
#tabbar button.on{color:var(--acc)}
#tabbar button.on .icn{--icon-stroke:2;color:inherit;opacity:1}
+/* A connection problem while the banner is switched off (Settings → Show connection status):
+ a dot on the Home tab and on the Settings gear. */
+#tabbar .tab-ic{position:relative;display:inline-flex}
+.tab-dot{
+ position:absolute;top:-1px;right:-3px;width:8px;height:8px;border-radius:50%;
+ background:var(--orange);box-shadow:0 0 0 2px var(--bg-el);pointer-events:none;
+}
+.iconbtn .tab-dot{top:5px;right:5px;box-shadow:0 0 0 2px var(--bg)}
#tabbar button.start{margin-top:-24px}
#tabbar button.start .cir{
width:52px;height:52px;border-radius:50%;background:var(--acc);color:var(--on-acc);
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index 101ee5a86..abb5d4d74 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1721,4 +1721,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'لا شيء لتكراره — لم تعد تمارينه موجودة.',
'{0} exercise no longer exists and was left out.': 'لم يعد {0} تمرين موجودًا وتم تركه.',
'{0} exercises no longer exist and were left out.': 'لم تعد {0} تمارين موجودة وتم تركها.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'إظهار حالة الاتصال',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'عند الإيقاف: يُخفى الشريط في الأعلى. تبقى نقطة على الرئيسية تنبّهك عندما تتعثر المزامنة.',
+ 'Connection problem': 'مشكلة في الاتصال',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index a1697e1c0..3f166b520 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1688,4 +1688,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'Nichts zu wiederholen — seine Übungen gibt es nicht mehr.',
'{0} exercise no longer exists and was left out.': '{0} Übung gibt es nicht mehr und wurde ausgelassen.',
'{0} exercises no longer exist and were left out.': '{0} Übungen gibt es nicht mehr und wurden ausgelassen.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Verbindungsstatus anzeigen',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Aus: Die Leiste oben ist ausgeblendet. Ein Punkt auf Start warnt trotzdem, wenn die Synchronisierung hängt.',
+ 'Connection problem': 'Verbindungsproblem',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 376e8b3ad..e785a924d 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1668,4 +1668,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'Nada que repetir: sus ejercicios ya no existen.',
'{0} exercise no longer exists and was left out.': '{0} ejercicio ya no existe y se ha omitido.',
'{0} exercises no longer exist and were left out.': '{0} ejercicios ya no existen y se han omitido.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Mostrar el estado de la conexión',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Desactivado: la barra de arriba se oculta. Un punto en Inicio sigue avisando cuando la sincronización se atasca.',
+ 'Connection problem': 'Problema de conexión',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 1517c6dbe..2f2b00402 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1668,4 +1668,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'Rien à refaire — ses exercices n’existent plus.',
'{0} exercise no longer exists and was left out.': '{0} exercice n’existe plus et a été laissé de côté.',
'{0} exercises no longer exist and were left out.': '{0} exercices n’existent plus et ont été laissés de côté.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Afficher l’état de la connexion',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Désactivé : la barre du haut est masquée. Un point sur Accueil prévient quand même si la synchronisation est bloquée.',
+ 'Connection problem': 'Problème de connexion',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 64d49b3ac..4d2fd863b 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1668,4 +1668,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'दोहराने को कुछ नहीं — इसके एक्सरसाइज़ अब मौजूद नहीं हैं।',
'{0} exercise no longer exists and was left out.': '{0} एक्सरसाइज़ अब मौजूद नहीं है और छोड़ दी गई।',
'{0} exercises no longer exist and were left out.': '{0} एक्सरसाइज़ अब मौजूद नहीं हैं और छोड़ दी गईं।',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'कनेक्शन की स्थिति दिखाएँ',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'बंद: ऊपर की पट्टी छिप जाती है। सिंक अटकने पर होम पर एक बिंदु फिर भी चेतावनी देता है।',
+ 'Connection problem': 'कनेक्शन में समस्या',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 272e1c1cc..9a467ae4e 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1671,4 +1671,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'Nincs mit megismételni — a gyakorlatai már nem léteznek.',
'{0} exercise no longer exists and was left out.': '{0} gyakorlat már nem létezik, kimaradt.',
'{0} exercises no longer exist and were left out.': '{0} gyakorlat már nem létezik, kimaradtak.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Kapcsolat állapotának mutatása',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Kikapcsolva: a felső sáv rejtve marad. Ha a szinkronizálás elakad, egy pont a Kezdőlapon továbbra is jelez.',
+ 'Connection problem': 'Kapcsolati probléma',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 0f674ffc2..2bc78933e 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1668,4 +1668,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'Niente da ripetere: i suoi esercizi non esistono più.',
'{0} exercise no longer exists and was left out.': '{0} esercizio non esiste più ed è stato tralasciato.',
'{0} exercises no longer exist and were left out.': '{0} esercizi non esistono più e sono stati tralasciati.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Mostra lo stato della connessione',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Disattivato: la barra in alto è nascosta. Un punto su Home avvisa comunque quando la sincronizzazione si blocca.',
+ 'Connection problem': 'Problema di connessione',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 71c36c5cc..216da4f57 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1668,4 +1668,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': '반복할 것이 없습니다 — 이 운동의 종목이 더 이상 없습니다.',
'{0} exercise no longer exists and was left out.': '운동 {0}개가 더 이상 없어 제외했습니다.',
'{0} exercises no longer exist and were left out.': '운동 {0}개가 더 이상 없어 제외했습니다.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': '연결 상태 표시',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': '끄면 위쪽 막대가 숨겨집니다. 동기화가 멈추면 홈의 점이 계속 알려 줍니다.',
+ 'Connection problem': '연결 문제',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index a4d1a1708..f90326d97 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1668,4 +1668,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'Nie ma czego powtórzyć — jego ćwiczenia już nie istnieją.',
'{0} exercise no longer exists and was left out.': '{0} ćwiczenie już nie istnieje i zostało pominięte.',
'{0} exercises no longer exist and were left out.': 'Ćwiczenia, których już nie ma, zostały pominięte: {0}.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Pokazuj stan połączenia',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Wyłączone: pasek u góry jest ukryty. Kropka na ekranie Start nadal ostrzega, gdy synchronizacja utknie.',
+ 'Connection problem': 'Problem z połączeniem',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index d3eb4f69e..2dd70898e 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -1012,6 +1012,10 @@ export const PT_BR_OVERRIDES = {
'Nothing to repeat — its exercises no longer exist.': 'Nada para repetir — os exercícios dele não existem mais.',
'{0} exercise no longer exists and was left out.': '{0} exercício não existe mais e ficou de fora.',
'{0} exercises no longer exist and were left out.': '{0} exercícios não existem mais e ficaram de fora.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Mostrar o status da conexão',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Desligado: a barra no topo fica oculta. Um ponto no Início continua avisando quando a sincronização fica parada.',
+ 'Connection problem': 'Problema de conexão',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 39b00eb44..866891ebf 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1668,4 +1668,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'Nada para repetir — os exercícios dele já não existem.',
'{0} exercise no longer exists and was left out.': '{0} exercício já não existe e ficou de fora.',
'{0} exercises no longer exist and were left out.': '{0} exercícios já não existem e ficaram de fora.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Mostrar o estado da ligação',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Desligado: a barra no topo fica oculta. Um ponto no Início continua a avisar quando a sincronização fica parada.',
+ 'Connection problem': 'Problema de ligação',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 680079c83..d8e6da60e 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1668,4 +1668,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'Нечего повторять — его упражнений больше нет.',
'{0} exercise no longer exists and was left out.': '{0} упражнения больше нет, оно пропущено.',
'{0} exercises no longer exist and were left out.': 'Упражнений, которых больше нет, пропущено: {0}.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Показывать состояние подключения',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Выкл.: полоса сверху скрыта. Точка на «Главной» всё равно предупредит, если синхронизация застряла.',
+ 'Connection problem': 'Проблема с подключением',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 3aed22d85..74fc09e3d 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1679,4 +1679,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'ไม่มีอะไรให้ทำซ้ำ — ท่าในการฝึกนี้ไม่มีอยู่แล้ว',
'{0} exercise no longer exists and was left out.': 'ท่า {0} ท่าไม่มีอยู่แล้วและถูกข้ามไป',
'{0} exercises no longer exist and were left out.': 'ท่า {0} ท่าไม่มีอยู่แล้วและถูกข้ามไป',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'แสดงสถานะการเชื่อมต่อ',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'ปิด: แถบด้านบนจะถูกซ่อน แต่จุดบนหน้าหลักยังเตือนเมื่อการซิงค์ค้าง',
+ 'Connection problem': 'การเชื่อมต่อมีปัญหา',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 441a936b3..83385a791 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1668,4 +1668,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'Tekrarlanacak bir şey yok — egzersizleri artık yok.',
'{0} exercise no longer exists and was left out.': '{0} egzersiz artık yok ve dışarıda bırakıldı.',
'{0} exercises no longer exist and were left out.': '{0} egzersiz artık yok ve dışarıda bırakıldı.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Bağlantı durumunu göster',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Kapalı: üstteki şerit gizlenir. Eşitleme takılırsa Ana sayfadaki bir nokta yine uyarır.',
+ 'Connection problem': 'Bağlantı sorunu',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index a99e32e27..b3267b31c 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1665,4 +1665,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': 'Нічого повторювати — його вправ більше немає.',
'{0} exercise no longer exists and was left out.': '{0} вправи більше немає, її пропущено.',
'{0} exercises no longer exist and were left out.': 'Вправ, яких більше немає, пропущено: {0}.',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': 'Показувати стан з’єднання',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': 'Вимк.: смугу вгорі приховано. Крапка на «Головній» однаково попередить, якщо синхронізація застрягла.',
+ 'Connection problem': 'Проблема зі з’єднанням',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 1445aa905..593ffac5d 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1668,4 +1668,8 @@ export default {
'Nothing to repeat — its exercises no longer exist.': '没有可重复的内容——其中的动作已不存在。',
'{0} exercise no longer exists and was left out.': '有 {0} 个动作已不存在,已略过。',
'{0} exercises no longer exist and were left out.': '有 {0} 个动作已不存在,已略过。',
+ // --- show connection status, and the dot when it is off (#369, #330) ---
+ 'Show connection status': '显示连接状态',
+ 'Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.': '关闭:隐藏顶部的提示栏。同步卡住时,“首页”上的小圆点仍会提醒你。',
+ 'Connection problem': '连接问题',
}
diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.js
index ba46ca8f2..7886fb1e4 100644
--- a/frontend/src/store/useStore.js
+++ b/frontend/src/store/useStore.js
@@ -153,6 +153,10 @@ export const DEF = {
// the session straight away; weight can still be logged from Home/Stats. Defaults on; an
// older profile without the key reads as on (`!== false`).
weighIn: true,
+ // The connection banner at the top (components/SyncBanner.jsx, #369/#330). Off hides it; a
+ // stuck sync then shows as a dot on Home instead. Defaults on; an older profile without the
+ // key reads as on (`!== false`).
+ connStatus: true,
// Where a planned session's reps come from (Settings → During a workout, lib/session-start.js):
// 'plan' opens at the routine's own sets × reps and lets history and progression decide the
// weight; 'last' carries the reps over from the last session, the way it always worked before.
diff --git a/frontend/src/views/Home.jsx b/frontend/src/views/Home.jsx
index 2e16b77fd..e3d6c07c8 100644
--- a/frontend/src/views/Home.jsx
+++ b/frontend/src/views/Home.jsx
@@ -7,6 +7,7 @@ import { t, dateLocale } from '../lib/i18n.js'
import { bwSheet, goalSheet, dayOverrideSheet, calendarSheet, startFlow, starterPlanSheet, bwDeltaColor, weighInsSheet } from '../sheets.jsx'
import LineChart from '../components/LineChart.jsx'
import Icon from '../components/Icon.jsx'
+import { useConnectionTrouble } from '../components/SyncBanner.jsx'
import { Button } from '../components/ui.jsx'
import { tappable } from '../lib/use-sheet-keyboard.js'
import { glyphOf } from '../lib/glyphs.js'
@@ -16,6 +17,8 @@ export default function Home() {
const nav = useNavigate()
const S = useStore(s => s.S)
const user = useStore(s => s.user)
+ // The banner switched off and the sync stuck: a dot on the gear (Settings → Show connection status).
+ const trouble = useConnectionTrouble()
const [weekOffset, setWeekOffset] = useState(0)
const today = new Date()
@@ -66,7 +69,7 @@ export default function Home() {
return <div className="narrow">
<div className="hdr">
<div><h1>{user ? t('Hi {0}', user.name) : 'openGym'}</h1><div className="sub">{today.toLocaleDateString(dateLocale(), { weekday: 'long', day: 'numeric', month: 'long' })}</div></div>
- <button className="iconbtn" onClick={() => nav('/settings')} aria-label={t('Settings')}><Icon name="gear" /></button>
+ <button className="iconbtn" onClick={() => nav('/settings')} aria-label={trouble ? t('Settings') + ', ' + t('Connection problem') : t('Settings')}><Icon name="gear" />{trouble && <span className="tab-dot" aria-hidden="true" />}</button>
</div>
<div className="card">
diff --git a/frontend/src/views/Settings.connstatus.test.jsx b/frontend/src/views/Settings.connstatus.test.jsx
new file mode 100644
index 000000000..fe18d499e
--- /dev/null
+++ b/frontend/src/views/Settings.connstatus.test.jsx
@@ -0,0 +1,96 @@
+// @vitest-environment happy-dom
+// Settings → "Show connection status" (#369, #330): in Appearance, where a phone kept local with
+// no account sees it too — Server & sync only renders for a signed-in profile.
+import React, { act } from 'react'
+import { createRoot } from 'react-dom/client'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import Settings from './Settings.jsx'
+import { bindUI } from '../components/ui.jsx'
+
+globalThis.IS_REACT_ACT_ENVIRONMENT = true
+
+const mocks = vi.hoisted(() => {
+ const state = { S: null, MOBILE: false }
+ state.snapshot = () => ({
+ S: state.S,
+ user: null,
+ update: mut => {
+ const next = structuredClone(state.S)
+ mut(next)
+ state.S = next
+ },
+ replaceState: vi.fn(), setUser: vi.fn(), pullState: vi.fn(), pushState: vi.fn(),
+ signOut: vi.fn(), signOutAll: vi.fn(), resetDemo: vi.fn(), disconnectServer: vi.fn(),
+ })
+ return state
+})
+vi.mock('../store/useStore.js', () => {
+ const useStore = selector => selector ? selector(mocks.snapshot()) : mocks.snapshot()
+ useStore.getState = mocks.snapshot
+ return { useStore, DEF: { reminder: { time: '17:30' } }, hasData: () => false }
+})
+vi.mock('../store/useUI.js', () => {
+ const snap = () => ({ toast: vi.fn(), openSheet: vi.fn() })
+ const useUI = selector => selector ? selector(snap()) : snap()
+ useUI.getState = snap
+ return { useUI }
+})
+vi.mock('react-router-dom', () => ({ useNavigate: () => () => {} }))
+vi.mock('../lib/api.js', () => ({
+ api: vi.fn(), webauthnOK: () => false, passkeyLogin: vi.fn(), passkeyRegister: vi.fn(), IS_ANDROID: false,
+}))
+vi.mock('../lib/push.js', () => ({ pushSupported: () => false, enablePush: vi.fn(), disablePush: vi.fn(), sendTestPush: vi.fn() }))
+vi.mock('../lib/wakelock.js', () => ({ wakeLockSupported: () => false }))
+vi.mock('../lib/mobile.js', () => ({ get MOBILE() { return mocks.MOBILE }, isAndroid: () => Promise.resolve(false), shareExport: vi.fn(), syncReminder: vi.fn() }))
+vi.mock('./MobileOnboarding.jsx', () => ({ ConnectSheet: () => null }))
+vi.mock('../sheets.jsx', () => ({
+ loadStarterPlan: vi.fn(), starterPlanSheet: vi.fn(), confirmSheet: vi.fn(), importFromApp: vi.fn(),
+ importFromHevy: vi.fn(), equipmentProfileSheet: vi.fn(),
+}))
+
+// The Settings view reads the build-time version constant at render time.
+globalThis.__APP_VERSION__ ??= 'test'
+
+// SelectRow opens its choices through the bound UI store; capture the sheet to render it here.
+let sheet = null
+bindUI({ getState: () => ({ openSheet: render => { sheet = render; return { close: () => {} } } }) })
+
+let host, root
+beforeEach(() => {
+ sheet = null
+ mocks.S = {
+ unit: 'kg', restSec: 90, restPauseSec: 15, sound: false, effort: 'none',
+ gifSize: 'full', workouts: [], routines: [], exWeights: {},
+ }
+ mocks.MOBILE = false
+ host = document.createElement('div')
+ document.body.appendChild(host)
+ root = createRoot(host)
+})
+afterEach(() => {
+ act(() => root.unmount())
+ host.remove()
+})
+
+const mount = () => act(() => root.render(<Settings />))
+const row = () => [...host.querySelectorAll('.lrow')].find(r => r.textContent.includes('Show connection status'))
+
+describe('Show connection status', () => {
+ it('is there with no account, on a phone kept local, and on by default', () => {
+ mocks.MOBILE = true
+ mount()
+ expect(row()).toBeTruthy()
+ expect(row().textContent).toContain('A dot on Home still warns when syncing is stuck.')
+ expect(row().querySelector('[role="switch"]').getAttribute('aria-checked')).toBe('true')
+ })
+
+ it('switches the profile setting off and on', () => {
+ mount()
+ act(() => { row().querySelector('[role="switch"]').click() })
+ expect(mocks.S.connStatus).toBe(false)
+ mount()
+ expect(row().querySelector('[role="switch"]').getAttribute('aria-checked')).toBe('false')
+ act(() => { row().querySelector('[role="switch"]').click() })
+ expect(mocks.S.connStatus).toBe(true)
+ })
+})
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index d04cc7246..8cc6b7d56 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -530,6 +530,12 @@ export default function Settings() {
onChange={v => update(s => { s.body = v })}
/>
</Row>
+ {/* The bar at the top that says the app is offline, kept local, or not synced (#369, #330).
+ Here and not under Server & sync, which a phone kept local never shows. */}
+ {!DEMO && <Row icon="cloud" iconTint="var(--blue)" title={t('Show connection status')}
+ subtitle={t('Off: the bar at the top is hidden. A dot on Home still warns when syncing is stuck.')}>
+ <Switch checked={S.connStatus !== false} onChange={v => update(s => { s.connStatus = v })} />
+ </Row>}
<div className="lrow" style={{ flexDirection: 'column', alignItems: 'stretch', gap: 12, paddingTop: 13, paddingBottom: 14 }}>
<span className="lrow-t">{t('Accent color')}</span>
<div className="swatches">