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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Settings: guests see guest mode once and no promise of profile sync
Duarte Santos6b22c3a98ae5
diff --git a/frontend/src/views/Settings.connstatus.test.jsx b/frontend/src/views/Settings.connstatus.test.jsxindex bb1454992..e56f3e667 100644--- a/frontend/src/views/Settings.connstatus.test.jsx+++ b/frontend/src/views/Settings.connstatus.test.jsx@@ -10,10 +10,10 @@ import { bindUI } from '../components/ui.jsx'globalThis.IS_REACT_ACT_ENVIRONMENT = trueconst mocks = vi.hoisted(() => {- const state = { S: null, MOBILE: false }+ const state = { S: null, MOBILE: false, user: null }state.snapshot = () => ({S: state.S,- user: null,+ user: state.user,update: mut => {const next = structuredClone(state.S)mut(next)@@ -63,6 +63,7 @@ beforeEach(() => {gifSize: 'full', workouts: [], routines: [], exWeights: {},}mocks.MOBILE = false+ mocks.user = nullhost = document.createElement('div')document.body.appendChild(host)root = createRoot(host)@@ -94,3 +95,23 @@ describe('Show connection status', () => {expect(mocks.S.connStatus).toBe(true)})})++describe('guest footers', () => {+ const footers = () => [...host.querySelectorAll('.sect-f')].map(f => f.textContent)++ it('Look & Home does not promise a guest that anything syncs with a profile', () => {+ mount()+ expect(host.textContent).not.toContain('synced with your profile')+ mocks.user = { id: 'u1' }+ act(() => root.render(<Settings key="in" page="look" />))+ expect(host.textContent).toContain('synced with your profile')+ })++ it('Account says guest mode once: the banner says it, the footer only when the banner is off', () => {+ act(() => root.render(<Settings page="account" />))+ expect(footers().filter(f => f.includes('Guest mode'))).toEqual([])+ mocks.S = { ...mocks.S, connStatus: false }+ act(() => root.render(<Settings key="off" page="account" />))+ expect(footers().filter(f => f.includes('Guest mode'))).toHaveLength(1)+ })+})diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsxindex a4adca325..27c26de1a 100644--- a/frontend/src/views/Settings.jsx+++ b/frontend/src/views/Settings.jsx@@ -31,6 +31,7 @@ import { REST_MAX, REST_PAUSE_MIN, REST_PAUSE_MAX, fmtRest, fmtDuration } from 'import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet, plateInventorySheet, menuSheet } from '../sheets.jsx'import Icon from '../components/Icon.jsx'import { durationSheet } from '../components/DurationWheel.jsx'+import { showsConnection } from '../components/SyncBanner.jsx'import BackupFolderRow, { useBackupFolder, autoBackupSubtitle } from '../components/BackupFolderRow.jsx'import { ServerSyncSection, KeptChangesRows, leaveServer, connectServer, passkeySignIn } from '../components/ServerSync.jsx'import { passwordOn, PasswordRow, openPasswordSignIn, openPasswordRegister } from '../components/PasswordAuth.jsx'@@ -679,7 +680,7 @@ export default function Settings({ page = null, find = null, via = null }) {equipment: () => <EquipmentCard S={S} update={update} />,look: () => <>- <Section footer={DEMO || MOBILE ? undefined : t('synced with your profile')}>+ <Section footer={DEMO || MOBILE || !user ? undefined : t('synced with your profile')}><Row icon="moon" iconTint="var(--indigo)" title={t('Theme')}><SegmentedclassName="seg-inline"@@ -849,7 +850,8 @@ export default function Settings({ page = null, find = null, via = null }) {<KeptChangesRows /></>}</Section>}- {!user && !DEMO && !MOBILE && <p className="sect-f" style={{ marginTop: -18, marginBottom: 22 }}>{t('Guest mode: your data lives only in this browser.')}</p>}+ {/* The connection banner already says this to a guest; the line is for when it is switched off. */}+ {!user && !DEMO && !MOBILE && !showsConnection(S) && <p className="sect-f" style={{ marginTop: -18, marginBottom: 22 }}>{t('Guest mode: your data lives only in this browser.')}</p>}</>,}