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.

Merge PR #462 into v140-db: the guest's no-server line can be closed

Duarte Santos45c93294aae4
diff --cc frontend/src/components/SyncBanner.jsx
index 73046dc2e,06bdece13..96168fb5c
--- a/frontend/src/components/SyncBanner.jsx
+++ b/frontend/src/components/SyncBanner.jsx
@@@ -12,11 -13,12 +13,12 @@@ export const PENDING_GRACE_MS = 500
/* 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 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. Each says what is wrong and
- that the changes are kept here, with the one thing to do about it (retry, pair again, sign in).
- A phone kept local never sees it (#454): no server is a choice there, not a problem.
- 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. A problem 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 no-server line alone has an ×, which hides it for good (#454).
- 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.
++ longer accepts this device, an answer that is not openGym's, and a guest in a browser. A
++ problem 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 guest line alone
++ has an ×, which hides it for good (#454): no server is a choice there, not a fault. A phone kept
++ local never sees any of it. The others say what is wrong and that the changes are kept here,
++ with the one thing to do about it (retry, pair again, sign in).
Pinned under the status bar, above the page and the pinned workout and chat headers, below the
tab bar, the timer and every sheet. Its height goes into --conn on the root, which the page's
diff --cc frontend/src/components/SyncBanner.test.jsx
index ba5d9e0b3,1f6a6ff48..b61345406
--- a/frontend/src/components/SyncBanner.test.jsx
+++ b/frontend/src/components/SyncBanner.test.jsx
@@@ -259,6 -249,56 +260,49 @@@ describe('no server at all', () =>
})
})
+ // #454: a device kept local on purpose read "not connected to a server" on every screen, for good.
+ // The quiet line has an × that hides it; a problem with a server never gets one.
+ describe('hiding the no-server line', () => {
+ const close = () => host.querySelector('.conn-x')
+
- it('a phone kept local: the × hides the line for good and gives the page its height back, without connecting', () => {
++ it('a phone kept local never shows the line, so there is nothing to close (#454)', () => {
+ mocks.MOBILE = true
+ mocks.user = null
+ mocks.guest = true
+ mocks.sync = sync('local', { server: null })
+ render()
- expect(text()).toBe('On this phone only, not connected to a server')
- expect(close().getAttribute('aria-label')).toBe('Close')
- act(() => close().click())
- expect(mocks.update).toHaveBeenCalledTimes(1)
- expect(mocks.S.connLocal).toBe(false)
- expect(mocks.sheets).toHaveLength(0)
- render()
+ expect(bar()).toBeNull()
+ expect(conn()).toBe('')
+ })
+
- it('a guest in a browser: the same ×, and Settings is not opened by it', () => {
++ it('a guest in a browser: the × hides the line, and Settings is not opened by it', () => {
+ mocks.user = null
+ mocks.guest = true
+ mocks.sync = sync('local')
+ render()
+ act(() => close().click())
+ expect(mocks.navs).toEqual([])
+ render()
+ expect(bar()).toBeNull()
+ })
+
+ it('a profile without the key still shows the line', () => {
+ Object.assign(mocks, { user: null, guest: true, sync: sync('local'), S: {} })
+ render()
+ expect(bar()).not.toBeNull()
+ })
+
+ it('hidden, a problem with a server still shows, and has no × of its own', () => {
+ mocks.S = { connLocal: false }
+ for (const [st, extra] of [['offline', { pending: true }], ['error', { lastError: { status: 502 } }], ['auth', {}], ['held', {}]]) {
+ mocks.sync = sync(st, extra)
+ render()
+ expect(bar(), st).not.toBeNull()
+ expect(close(), st).toBeNull()
+ }
+ })
+ })
+
// Review of 771184c9: while a sign-in's question held sync, the screens said nothing at all.
describe('a sign-in waiting for its question', () => {
it('says nothing syncs until it is answered, and the tap runs Sync now, which asks it', () => {
diff --cc frontend/src/store/useStore.js
index 898d898d5,931621cdc..e48b16dea
--- a/frontend/src/store/useStore.js
+++ b/frontend/src/store/useStore.js
@@@ -191,9 -183,10 +191,13 @@@ export const DEF =
// stuck sync then shows as a dot on Home instead. Defaults on; an older profile without the
// key reads as on (`!== false`).
connStatus: true,
+ // Whether "Share as image" puts this session's muscle map on the card (sheets.jsx
+ // ShareWorkoutImage, #453). On by default; absent reads as on (`!== false`).
+ shareMap: true,
+ // The quiet line a device with no server shows ("On this phone only…", "Guest mode…", #454).
+ // That is a choice, not a fault, so its × hides it for good; a real problem still shows the bar.
+ // Defaults on; an older profile without the key reads as on (`!== false`).
+ connLocal: 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.