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
Remove dead frontend code nothing calls anymore
Duarte Santos8dbf5cf8455e
diff --git a/frontend/src/components/NumField.jsx b/frontend/src/components/NumField.jsxdeleted file mode 100644index 5add9d960..000000000--- a/frontend/src/components/NumField.jsx+++ /dev/null@@ -1,3 +0,0 @@-// Kept as a module so existing imports keep working — the implementation now-// lives in the shared control set.-export { NumberField as default } from './ui.jsx'diff --git a/frontend/src/lib/channel.js b/frontend/src/lib/channel.jsindex ed1e3f8da..29009eb4b 100644--- a/frontend/src/lib/channel.js+++ b/frontend/src/lib/channel.js@@ -29,4 +29,3 @@ export async function selfUpdates() {return (await getChannel()) === 'sideload'}-export function resetChannel() { channelP = null }diff --git a/frontend/src/lib/coach-api.js b/frontend/src/lib/coach-api.jsindex 7680ea282..3d08e82e7 100644--- a/frontend/src/lib/coach-api.js+++ b/frontend/src/lib/coach-api.js@@ -95,20 +95,6 @@ export const resolvePending = async body => DEMO ? (await demo()).demoResolve()export const forgetCoach = async () => DEMO ? (await demo()).demoResolve() : LOCAL() ? (await local()).localForget() : api('/api/coach/forget', { method: 'POST', body: '{}' })export const disclosure = async () => DEMO ? (await demo()).demoDisclosure() : LOCAL() ? (await local()).localDisclosure() : api('/api/coach/disclosure')-/* Whose provider account this profile is about to spend. Its own call because the constraint is- that the Coach screen states it too, not just the admin card — and because in instance mode a- second profile is refused outright, which is something the user has to be able to read before- they ask for anything rather than after a job is turned down. */-export const coachAccount = async () =>- DEMO ? { mode: 'instance', provider: 'demo', providerLabel: 'Demo', account: null, connected: true, reason: null, message: null }- : LOCAL() ? { mode: 'device', provider: useStore.getState().coachLocal.provider, providerLabel: null, account: null, connected: true, reason: null, message: null }- : api('/api/coach/account')--/* Admin-only. The token is write-only from the client's side: it goes up once and is never- read back, so there is deliberately no "show me the current credential" call to pair with it. */-export const connectCredential = body => api('/api/admin/coach/connect', { method: 'POST', body: JSON.stringify(body) })-export const disconnectCredential = () => api('/api/admin/coach/disconnect', { method: 'POST', body: '{}' })-/*** Live job/proposal state.*diff --git a/frontend/src/lib/measurements.js b/frontend/src/lib/measurements.jsindex 0c26c6117..555adaaa6 100644--- a/frontend/src/lib/measurements.js+++ b/frontend/src/lib/measurements.js@@ -111,11 +111,6 @@ export function measurementValue(entry, key) {return valid((entry.other || []).find(o => o.id === key.slice(6))?.value)}-export function measurementLabel(key, custom = []) {- if (key.startsWith('other:')) return custom.find(c => c.id === key.slice(6))?.name || 'Other'- return MEASUREMENT_FIELDS.find(f => f.key === key)?.label || key-}-// Order comes from MEASUREMENT_FIELDS, not from measurementEnabled: that array is a set the// toggles append to, so reading it in stored order would move a field to the end of the logging// form the moment you switched it off and on again, interleaving the Torso/Arms/Legs groups.diff --git a/frontend/src/lib/media-sync.js b/frontend/src/lib/media-sync.jsindex 016a025d3..c631b2f64 100644--- a/frontend/src/lib/media-sync.js+++ b/frontend/src/lib/media-sync.js@@ -422,6 +422,3 @@ export const syncMedia = opts => inst().syncMedia(opts)export const fetchToStore = (hash, expect, opts) => inst().fetchToStore(hash, expect, opts)export const mayFetch = hash => inst().mayFetch(hash)export const localMediaGc = () => inst().localMediaGc()-export const settleMediaSync = () => inst().settle()-/** Tests only. */-export const _setSharedMediaSync = s => { shared = s }diff --git a/frontend/src/lib/muscles.js b/frontend/src/lib/muscles.jsindex 62240b0e7..d9f932d5b 100644--- a/frontend/src/lib/muscles.js+++ b/frontend/src/lib/muscles.js@@ -178,8 +178,6 @@ export function muscleGroupsOf(entry) {return out}-export const normalizeMuscleGroups = muscleGroupsOf-/** True when any requested group matches; an empty request is an intentionally unfiltered query. */export function matchesMuscleGroups(ex, requested) {const wanted = arrayOf(requested).map(canonicalMuscle).filter(Boolean)@@ -319,10 +317,6 @@ export function loadOfWeeklyPlan(S) {return load}-/** Load for a workout still in progress — the sets ticked so far. */-export const loadOfActive = active =>- loadOf((active?.entries || []).map(e => ({ id: e.id, ex: e.exercise || e, sets: (e.sets || []).filter(s => s.done && !isWarmupRow(s)).length })))-/*** Shade buckets 0–4 per muscle.*diff --git a/frontend/src/lib/nudge.js b/frontend/src/lib/nudge.jsindex 940852b61..5199010c6 100644--- a/frontend/src/lib/nudge.js+++ b/frontend/src/lib/nudge.js@@ -74,7 +74,6 @@ export function nudgeMinute(reminderTime) {const at = Math.max(EVENING, Number.isNaN(r) ? 0 : r + AFTER_REMINDER)return at > LATEST ? null : at}-export const NUDGE_LATEST_MINUTE = LATESTconst dayBefore = iso => { const d = new Date(iso + 'T12:00:00'); d.setDate(d.getDate() - 1); return isoOf(d) }const logged = (S, iso) => (S.workouts || []).some(w => w?.d === iso)diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 0ee471643..69ee9cc0e 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -30,7 +30,7 @@ import BodyMap from './components/BodyMap.jsx'import MuscleExplorer from './components/MuscleExplorer.jsx'import ExerciseViewToggle from './components/ExerciseViewToggle.jsx'import { sameMuscleFirst, swapMuscleOf } from './lib/similar-exercises.js'-import { exerciseMuscleSnapshot, loadOfWorkouts, MUSCLES, MUSCLE_NAME, muscleWeightsOf, normalizeMuscleGroups, hasExplicitMuscleMetadata, inMuscleOrder } from './lib/muscles.js'+import { exerciseMuscleSnapshot, loadOfWorkouts, MUSCLES, MUSCLE_NAME, muscleWeightsOf, muscleGroupsOf, hasExplicitMuscleMetadata, inMuscleOrder } from './lib/muscles.js'import { parseImport, mergeImport } from './lib/import-csv.js'import { importHevyData, HevyApiError, HEVY_DEV_SETTINGS, mergeHevyRoutines } from './lib/import-hevy.js'import { buildPlanBundle, parsePlan, mergePlan, printPlan, planPrintHTML } from './lib/plan-share.js'@@ -1197,12 +1197,12 @@ function CustomExForm({ existing, prefill, onDone, close }) {const [primaries, setPrimaries] = useState(() => {if (existing && Array.isArray(existing.primaries) && existing.primaries.length) return [...existing.primaries]if (existing?.bp === 'cardio') return ['cardiovascular system']- const norm = hasExplicitMuscleMetadata(existing || {}) ? normalizeMuscleGroups(existing || {}) : []+ const norm = hasExplicitMuscleMetadata(existing || {}) ? muscleGroupsOf(existing || {}) : []return norm.length ? [norm[0]] : []})const [secondaries, setSecondaries] = useState(() => {if (existing && Array.isArray(existing.primaries) && existing.primaries.length) return [...(existing.secondaries || [])]- const norm = hasExplicitMuscleMetadata(existing || {}) ? normalizeMuscleGroups(existing || {}) : []+ const norm = hasExplicitMuscleMetadata(existing || {}) ? muscleGroupsOf(existing || {}) : []return norm.slice(1)})// Every primary chip this sheet saw a tap on, in that order. `primaries` alone cannot say what the@@ -2293,9 +2293,7 @@ export const effortPickerSheet = (kind, value, onPick) =>ui().openSheet(close => <EffortPicker kind={kind} value={value} onPick={onPick} close={close} />)/* ============================ share / print / import a plan ============================ */-export const planToolsSheet = () => ui().openSheet(close => <PlanTools close={close} />)--// The three things the Plan menu and this sheet both do with a plan, so the two can never drift.+// What the Plan menu does with a plan: export it, print it, import a friend's.export const planHasRoutines = st => (st.routines || []).some(r => r.ex && r.ex.length)export async function exportPlanFile() {const st = S(), user = useStore.getState().user@@ -2326,32 +2324,6 @@ export function importPlanFile(f, onRead) {rd.readAsText(f)}-function PlanTools({ close }) {- const st = useStore(s => s.S)- const fileRef = useRef(null)- const hasRoutines = planHasRoutines(st)-- const exportFile = async () => { await exportPlanFile(); close() }- const pickFile = ev => {- const f = ev.target.files[0]; ev.target.value = ''- importPlanFile(f, close)- }-- return <>- <h3>{t('Share your plan')}</h3>- <div className="muted small" style={{ marginBottom: 16 }}>{t('Send your routines to a friend, or put your week on paper.')}</div>- <Button variant="primary" icon="share" onClick={exportFile} disabled={!hasRoutines}>{t('Export plan file')}</Button>- <div className="dim small" style={{ margin: '7px 2px 0', lineHeight: 1.4 }}>{t('A small file a friend can import into their own openGym. Routines only, none of your workouts or weigh-ins.')}</div>- <div style={{ height: 12 }} />- <Button variant="tinted" icon="note" onClick={() => { close(); printWholePlan() }} disabled={!hasRoutines}>{t('Print / Save as PDF')}</Button>- <div className="dim small" style={{ margin: '7px 2px 0', lineHeight: 1.4 }}>{t('A clean printout, one page per plan. No exercise ever gets split across pages.')}</div>- {!hasRoutines && <div className="dim small" style={{ margin: '12px 2px 0' }}>{t('Add an exercise to a routine first. An empty plan has nothing to share.')}</div>}- <h4 className="sec">{t('Got a plan from a friend?')}</h4>- <Button variant="ghost" icon="download" onClick={() => fileRef.current?.click()}>{t('Import a plan file')}</Button>- <input ref={fileRef} type="file" accept="application/json,.json" onChange={pickFile} hidden />- </>-}-export const planImportSheet = bundle => ui().openSheet(close => <PlanImport bundle={bundle} close={close} />)function PlanImport({ bundle, close }) {