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
History: preview the share card, with the session's muscle map as an option
Claude33abe9828bca
diff --git a/frontend/src/index.css b/frontend/src/index.cssindex f412a83b0..1db4a4cb5 100644--- a/frontend/src/index.css+++ b/frontend/src/index.css@@ -1571,6 +1571,11 @@ body.no-tabbar #timer.working{box-shadow:inset 0 var(--hair) 0 var(--acc),0 -10p}.hm-legend .hm-c{width:10px;height:10px}+/* "Share as image" (#453): the card as it will be sent, at the sheet's width. The placeholder+ holds a portrait card's shape so nothing below it jumps when the picture lands. */+.share-card{margin:0 auto 14px;max-width:420px}+.share-card img{display:block;width:100%;max-height:56vh;object-fit:contain;border-radius:16px;box-shadow:0 6px 24px rgba(0,0,0,.28)}+.share-card-ph{aspect-ratio:4/5;max-height:56vh;margin:0 auto;border-radius:16px;background:var(--surface-2);display:flex;align-items:center;justify-content:center;text-align:center;padding:16px}/* --- muscle map --- *//* Reuses the .hm-c level ramp above, so one accent scale means one thing app-wide. *//* An untrained muscle is derived from the text colour rather than a fixed surface, sodiff --git a/frontend/src/lib/workout-card.js b/frontend/src/lib/workout-card.jsindex 1c9d06cf2..9206fb86a 100644--- a/frontend/src/lib/workout-card.js+++ b/frontend/src/lib/workout-card.js@@ -1,15 +1,17 @@// A finished workout as a picture, for "Share as image" in its detail sheet (#453): plain text// loses its layout in most chat apps, a card keeps it. Three steps, so the part that decides what// the card says and where it goes is testable without a canvas:-// workoutCardModel — what the card says: name, date, duration, sets, volume, new bests-// layoutWorkoutCard — where each line goes, given a way to measure text+// workoutCardModel — what the card says: name, date, duration, sets, volume, new bests and+// how hard each muscle was worked+// layoutWorkoutCard — where everything goes, given a way to measure text// drawWorkoutCard — paints a layout onto a 2D canvas context// Nothing here stores anything; the workout is read, never written.import { sessionSections, workoutVolume, workoutDuration, workoutDay, doneUnits } from './history.js'import { EXIDX } from './exercises.js'import { isWarmupRow } from './workout-model.js'-import { fmtDate, fmtVol, durPart, capWords } from './format.js'-import { t, tn, exerciseNameClass } from './i18n-core.js'+import { MUSCLES, INERT, levelsOf, loadOfWorkouts } from './muscles.js'+import { fmtDate, fmtDur, fmtNum, fmtVol, capWords } from './format.js'+import { t, exerciseNameClass } from './i18n-core.js'export const CARD_WIDTH = 1080const PAD = 88@@ -18,12 +20,16 @@ const MIN_HEIGHT = 720// past a phone screen is not glanceable any more.export const MAX_RECORDS = 6const TITLE_LINES = 2+const STAT_SIZE = 56+const MAP_MAX_HEIGHT = 560/*** What the card says. `unit` is the profile's, `nameOf(entry)` the exercise's display name — the* same pair "Copy as text" takes (workoutText). Sets are work sets, as the volume is: warm-ups are* left out of both, the way they are left out of records and progression everywhere else. A- * per-side set counts once per side, as the workout screen counts it.+ * per-side set counts once per side, as the workout screen counts it. `levels` is the finish+ * summary's muscle map for this one session (levelsOf over loadOfWorkouts), null when no set+ * reached a muscle the map can show — a card of only cardio has nothing to shade.*/export function workoutCardModel(w, { unit, nameOf }) {const entries = w.entries || []@@ -39,11 +45,19 @@ export function workoutCardModel(w, { unit, nameOf }) {records.push({ id: entry.id, name: exerciseNameClass(EXIDX[entry.id]) ? capWords(name) : name })}const day = workoutDay(w)+ const ms = workoutDuration(w)+ const levels = levelsOf(loadOfWorkouts([w]))return {title: w.name || '',date: day ? fmtDate(day, true, true) : '',- facts: [...durPart(workoutDuration(w)), tn('{0} set', '{0} sets', sets), fmtVol(w.vol ?? workoutVolume(w), unit)],+ // Imported history has no clock: an unknown duration is left out rather than shown as 0.+ stats: [+ ...(ms >= 60000 ? [{ label: t('Duration'), value: fmtDur(ms) }] : []),+ { label: t('Sets'), value: fmtNum(sets) },+ { label: t('Volume'), value: fmtVol(w.vol ?? workoutVolume(w), unit) },+ ],records: records.map(r => r.name),+ levels: MUSCLES.some(m => levels[m] > 0) ? levels : null,}}@@ -70,35 +84,96 @@ function ellipsize(text, width, measure) {return s.trimEnd() + '…'}+// The largest size up to `max` at which `text` fits `width`: a 12,345.5 kg volume shrinks to fit+// its tile rather than running into the next one.+function fitSize(text, width, measure, weight, max, min = 28) {+ let size = max+ while (size > min && measure(text, weight, size) > width) size -= 2+ return size+}+/*** Where everything goes. `measure(text, weight, size)` returns a width in pixels — the canvas's* measureText in the app, a fake in the tests. `rtl` mirrors the card for Arabic: text anchors- * at the right edge and the trophy sits to the right of its line. Returns the canvas size and a- * flat list of items for drawWorkoutCard; an item carries its size and weight, the font family is- * the drawer's.+ * at the right edge, the tiles run right to left and the trophy sits to the right of its line.+ * `map` is `{ aspect }`, one body view's height over its width, to include the muscle map, or+ * null to leave it out; a model without levels has none either way. Returns the canvas size and+ * a flat list of items for drawWorkoutCard; a text item carries its size and weight, the font+ * family is the drawer's.*/-export function layoutWorkoutCard(model, { measure, rtl = false, width = CARD_WIDTH }) {+export function layoutWorkoutCard(model, { measure, rtl = false, width = CARD_WIDTH, map = null }) {const items = []const inner = width - PAD * 2const start = rtl ? width - PAD : PADconst dir = rtl ? -1 : 1let y = PAD- const text = (str, size, weight, color, x = start) => {- items.push({ kind: 'text', text: str, x, y: y + size, size, weight, color })+ const text = (str, size, weight, color, x = start, extra) => {+ items.push({ kind: 'text', text: str, x, y: y + size, size, weight, color, ...extra })y += Math.round(size * 1.3)}items.push({ kind: 'bar', x: start, y, w: 96 * dir, h: 10 })- y += 10 + 56+ y += 10 + 52for (const line of wrapText(model.title, inner, s => measure(s, 700, 76), TITLE_LINES)) text(line, 76, 700, 'label')- if (model.date) { y += 8; text(model.date, 40, 400, 'label2') }- y += 40- for (const line of wrapText(model.facts.join(' · '), inner, s => measure(s, 600, 46), 2)) text(line, 46, 600, 'label')+ if (model.date) { y += 4; text(model.date, 38, 400, 'label2') }++ // The numbers as tiles, the way the finish summary shows them.+ y += 36+ const gap = 20+ const n = model.stats.length+ const tileW = (inner - gap * (n - 1)) / n+ const tileH = 150+ model.stats.forEach((stat, i) => {+ const x = rtl ? width - PAD - (i + 1) * tileW - i * gap : PAD + i * (tileW + gap)+ const textX = rtl ? x + tileW - 28 : x + 28+ const room = tileW - 56+ items.push({ kind: 'tile', x, y, w: tileW, h: tileH })+ const [label] = wrapText(stat.label, room, s => measure(s, 500, 28), 1)+ items.push({ kind: 'text', text: label, x: textX, y: y + 28 + 28, size: 28, weight: 500, color: 'label2' })+ const size = fitSize(stat.value, room, measure, 700, STAT_SIZE)+ items.push({ kind: 'text', text: stat.value, x: textX, y: y + tileH - 32, size, weight: 700, color: 'label' })+ })+ y += tileH++ // Front and back side by side, as large as the width allows without running past a phone+ // screen, with the finish summary's five-step legend under them.+ if (map && model.levels) {+ y += 48+ const viewGap = 40+ let viewW = (inner - viewGap) / 2+ let viewH = viewW * map.aspect+ if (viewH > MAP_MAX_HEIGHT) { viewH = MAP_MAX_HEIGHT; viewW = viewH / map.aspect }+ const left = (width - (viewW * 2 + viewGap)) / 2+ items.push({ kind: 'map', view: 'front', x: left, y, w: viewW, h: viewH })+ items.push({ kind: 'map', view: 'back', x: left + viewW + viewGap, y, w: viewW, h: viewH })+ y += viewH + 32+ const sw = 26+ const swGap = 8+ const less = t('Less')+ const more = t('More')+ const labelGap = 16+ const total = measure(less, 400, 28) + labelGap + 5 * sw + 4 * swGap + labelGap + measure(more, 400, 28)+ let x = (width - total) / 2+ // Read the way the language reads: "Less" first on the reading side, the ramp toward "More".+ const parts = rtl ? [more, 4, 3, 2, 1, 0, less] : [less, 0, 1, 2, 3, 4, more]+ for (const part of parts) {+ if (typeof part === 'number') {+ items.push({ kind: 'swatch', x, y, size: sw, level: part })+ x += sw + (parts.indexOf(part) === parts.length - 2 ? labelGap : swGap)+ } else {+ const w = measure(part, 400, 28)+ // Drawn left-anchored whatever the direction, so the row lands where it was measured.+ items.push({ kind: 'text', text: part, x, y: y + sw - 3, size: 28, weight: 400, color: 'label2', anchor: 'left' })+ x += w + labelGap+ }+ }+ y += sw+ }if (model.records.length) {- y += 56- text(t('New personal records'), 36, 600, 'acc')- y += 12+ y += 52+ text(t('New personal records'), 34, 600, 'acc')+ y += 10const icon = 44const indent = icon + 22const shown = model.records.length > MAX_RECORDS ? model.records.slice(0, MAX_RECORDS - 1) : model.records@@ -112,11 +187,57 @@ export function layoutWorkoutCard(model, { measure, rtl = false, width = CARD_WI}y += 64- const height = Math.max(MIN_HEIGHT, y + 34 + PAD)+ const height = Math.max(MIN_HEIGHT, Math.round(y + 34 + PAD))items.push({ kind: 'text', text: 'openGym', x: start, y: height - PAD, size: 34, weight: 700, color: 'acc' })return { width, height, rtl, items }}+/* ---------- colours ---------- */++// "#rgb", "#rrggbb", "rgb(…)" or "rgba(…)" as [r, g, b, a]; null for anything else.+export function parseColor(value) {+ const s = String(value || '').trim()+ let m = s.match(/^#([0-9a-f]{3,8})$/i)+ if (m) {+ let h = m[1]+ if (h.length === 3 || h.length === 4) h = [...h].map(c => c + c).join('')+ if (h.length !== 6 && h.length !== 8) return null+ const n = i => parseInt(h.slice(i, i + 2), 16)+ return [n(0), n(2), n(4), h.length === 8 ? n(6) / 255 : 1]+ }+ m = s.match(/^rgba?\(([^)]+)\)$/i)+ if (!m) return null+ const parts = m[1].split(/[\s,/]+/).filter(Boolean).map(p => (p.endsWith('%') ? parseFloat(p) / 100 : parseFloat(p)))+ if (parts.length < 3 || parts.some(Number.isNaN)) return null+ return [parts[0], parts[1], parts[2], parts.length > 3 ? parts[3] : 1]+}+// CSS color-mix(in srgb, a p%, b): p of `a` over the rest of `b`, as an rgb() string. A canvas+// is handed plain rgb, so the card does not depend on how a WebView parses color-mix().+export function mixColor(a, b, p) {+ const x = parseColor(a)+ const y = parseColor(b)+ if (!x || !y) return x ? a : b+ const ch = i => Math.round(x[i] * p + y[i] * (1 - p))+ return `rgb(${ch(0)}, ${ch(1)}, ${ch(2)})`+}+/**+ * The muscle map's fills for the card, worked out the way index.css works them out for .bodymap:+ * the silhouette and an untouched muscle as a little label over the surface, levels 1–4 as more+ * and more accent over that. A semi-transparent label (the light theme's) is flattened onto the+ * surface first.+ */+export function mapColors({ label, surface, acc }) {+ const lab = parseColor(label)+ const flat = lab && lab[3] < 1 ? mixColor(`rgb(${lab[0]}, ${lab[1]}, ${lab[2]})`, surface, lab[3]) : label+ const base = mixColor(flat, surface, 0.11)+ return {+ sil: mixColor(flat, surface, 0.18),+ levels: [base, mixColor(acc, base, 0.32), mixColor(acc, base, 0.56), mixColor(acc, base, 0.78), acc],+ }+}++/* ---------- drawing ---------- */+// The trophy from components/Icon.jsx, on its 24×24 grid, so the card and the app agree.const TROPHY = ['M7.6 4h8.8v4.6a4.4 4.4 0 0 1-8.8 0Z',@@ -124,26 +245,44 @@ const TROPHY = []export const CARD_FONT = "-apple-system,BlinkMacSystemFont,'SF Pro Text','Segoe UI',Roboto,system-ui,sans-serif"+/** One body view's height over its width, from its `vb` ("minX minY width height"). */+export const viewAspect = view => {+ const [, , w, h] = String(view?.vb || '').split(/\s+/).map(Number)+ return w > 0 && h > 0 ? h / w : 1.76+}+/**- * Paint a layout. `colors` holds bg, surface, label, label2 and acc as CSS colours — the app's- * current theme and accent, read off the root element by the caller.+ * Paint a layout. `colors` holds bg, surface, tile, label, label2 and acc as CSS colours — the+ * app's current theme and accent, read off the root element by the caller. `map`, when the+ * layout has a map in it, is `{ body, levels }`: body-paths.js geometry for the profile's body+ * ({ front, back }) and the model's levels.*/-export function drawWorkoutCard(ctx, layout, colors, family = CARD_FONT) {+export function drawWorkoutCard(ctx, layout, colors, map = null, family = CARD_FONT) {const { width, height, rtl, items } = layout+ const shades = mapColors(colors)ctx.fillStyle = colors.bgctx.fillRect(0, 0, width, height)const inset = 36ctx.fillStyle = colors.surfaceroundRect(ctx, inset, inset, width - inset * 2, height - inset * 2, 48)ctx.fill()- ctx.direction = rtl ? 'rtl' : 'ltr'- ctx.textAlign = 'start'ctx.textBaseline = 'alphabetic'for (const item of items) {if (item.kind === 'bar') {ctx.fillStyle = colors.accroundRect(ctx, Math.min(item.x, item.x + item.w), item.y, Math.abs(item.w), item.h, item.h / 2)ctx.fill()+ } else if (item.kind === 'tile') {+ ctx.fillStyle = colors.tile || colors.bg+ roundRect(ctx, item.x, item.y, item.w, item.h, 28)+ ctx.fill()+ } else if (item.kind === 'swatch') {+ ctx.fillStyle = shades.levels[item.level]+ roundRect(ctx, item.x, item.y, item.size, item.size, 7)+ ctx.fill()+ } else if (item.kind === 'map') {+ const view = map?.body?.[item.view]+ if (view) drawView(ctx, view, item, map.levels, shades)} else if (item.kind === 'trophy') {ctx.save()ctx.translate(item.x, item.y)@@ -155,12 +294,28 @@ export function drawWorkoutCard(ctx, layout, colors, family = CARD_FONT) {for (const d of TROPHY) ctx.stroke(new Path2D(d))ctx.restore()} else {+ ctx.direction = item.anchor === 'left' ? 'ltr' : rtl ? 'rtl' : 'ltr'+ ctx.textAlign = item.anchor === 'left' ? 'left' : 'start'ctx.fillStyle = colors[item.color] || colors.labelctx.font = `${item.weight} ${item.size}px ${family}`ctx.fillText(item.text, item.x, item.y)}}}+function drawView(ctx, view, box, levels, shades) {+ const [minX, minY, vw, vh] = String(view.vb).split(/\s+/).map(Number)+ ctx.save()+ ctx.translate(box.x, box.y)+ ctx.scale(box.w / vw, box.h / vh)+ ctx.translate(-minX, -minY)+ ctx.fillStyle = shades.sil+ for (const slug of INERT) for (const d of view.p[slug] || []) ctx.fill(new Path2D(d))+ for (const slug of MUSCLES) {+ ctx.fillStyle = shades.levels[levels?.[slug] || 0]+ for (const d of view.p[slug] || []) ctx.fill(new Path2D(d))+ }+ ctx.restore()+}function roundRect(ctx, x, y, w, h, r) {ctx.beginPath()ctx.moveTo(x + r, y)diff --git a/frontend/src/lib/workout-card.test.js b/frontend/src/lib/workout-card.test.jsindex adaa6a2f9..136e9544b 100644--- a/frontend/src/lib/workout-card.test.js+++ b/frontend/src/lib/workout-card.test.js@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest'-import { workoutCardModel, layoutWorkoutCard, wrapText, MAX_RECORDS, CARD_WIDTH } from './workout-card.js'+import { workoutCardModel, layoutWorkoutCard, wrapText, parseColor, mixColor, mapColors, viewAspect, MAX_RECORDS, CARD_WIDTH } from './workout-card.js'import { fmtDate } from './format.js'// #453: a finished workout shared as a picture. A fake measure stands in for the canvas — every@@ -26,13 +26,15 @@ describe('workoutCardModel', () => {],}+ const stat = m => m.stats.map(s => s.label + ' ' + s.value)+it('says the name, the dated day, duration, work sets and volume', () => {const m = workoutCardModel(w, { unit: 'kg', nameOf })expect(m.title).toBe('Push')expect(m.date).toBe(fmtDate('2026-09-03', true, true))// 2 bench work sets (the warm-up and the unticked set are not counted), 1 curl, and the// per-side lunge set once per side.- expect(m.facts).toEqual(['58 min', '5 sets', '1,790 kg'])+ expect(stat(m)).toEqual(['Duration 58 min', 'Sets 5', 'Volume 1,790 kg'])})it('lists each new best once, in the order the workout lists the exercises, title-cased', () => {@@ -43,9 +45,23 @@ describe('workoutCardModel', () => {const imported = { ...w, start: undefined, end: undefined, vol: undefined, prs: undefined }const m = workoutCardModel(imported, { unit: 'lb', nameOf })// 60×8 + 60×6 bench, 12×10 curl, 10×8 a side on the lunge; the warm-up adds nothing.- expect(m.facts).toEqual(['5 sets', '1,120 lb'])+ expect(stat(m)).toEqual(['Sets 5', 'Volume 1,120 lb'])expect(m.records).toEqual([])})++ it('carries the session\'s muscle map, shaded against its own hardest-worked muscle', () => {+ const bench = { ...w, entries: [{ id: '0025', target: { mode: 'reps' }, sets: [+ { w: 40, r: 8, done: true, phase: 'warmup' }, { w: 60, r: 8, done: true }, { w: 60, r: 8, done: false },+ ] }] }+ const { levels } = workoutCardModel(bench, { unit: 'kg', nameOf })+ expect(levels.chest).toBe(4)+ expect(levels.triceps).toBeGreaterThan(0)+ expect(levels.quadriceps).toBe(0)+ })++ it('has no muscle map when no set reached a muscle the map shows', () => {+ expect(workoutCardModel(w, { unit: 'kg', nameOf }).levels).toBeNull()+ })})describe('wrapText', () => {@@ -72,31 +88,78 @@ describe('wrapText', () => {})describe('layoutWorkoutCard', () => {- const model = { title: 'Push', date: 'Thu, 3 Sep 2026', facts: ['58 min', '5 sets', '1,790 kg'], records: ['Barbell Bench Press'] }+ const model = {+ title: 'Push', date: 'Thu, 3 Sep 2026',+ stats: [{ label: 'Duration', value: '58 min' }, { label: 'Sets', value: '5' }, { label: 'Volume', value: '1,790 kg' }],+ records: ['Barbell Bench Press'],+ levels: { chest: 4 },+ }const texts = layout => layout.items.filter(i => i.kind === 'text').map(i => i.text)+ const kinds = (layout, kind) => layout.items.filter(i => i.kind === kind)+ const map = { aspect: 1280 / 727 }- it('stacks the title, date, facts, records and the openGym footer, top to bottom', () => {+ it('stacks the title, date, stat tiles, records and the openGym footer, top to bottom', () => {const layout = layoutWorkoutCard(model, { measure })expect(layout.width).toBe(CARD_WIDTH)- expect(texts(layout)).toEqual(['Push', 'Thu, 3 Sep 2026', '58 min · 5 sets · 1,790 kg', 'New personal records', 'Barbell Bench Press', 'openGym'])- const ys = layout.items.filter(i => i.kind === 'text').map(i => i.y)+ expect(texts(layout)).toEqual(['Push', 'Thu, 3 Sep 2026', 'Duration', '58 min', 'Sets', '5', 'Volume', '1,790 kg', 'New personal records', 'Barbell Bench Press', 'openGym'])+ expect(kinds(layout, 'tile')).toHaveLength(3)+ expect(kinds(layout, 'trophy')).toHaveLength(1)+ const ys = layout.items.filter(i => i.kind === 'text' && !['Sets', '5', 'Volume', '1,790 kg'].includes(i.text)).map(i => i.y)expect([...ys].sort((a, b) => a - b)).toEqual(ys)- expect(layout.items.filter(i => i.kind === 'trophy')).toHaveLength(1)expect(Math.max(...ys)).toBeLessThan(layout.height)})+ it('lays the tiles out side by side, equal and inside the card', () => {+ const tiles = kinds(layoutWorkoutCard(model, { measure }), 'tile')+ expect(new Set(tiles.map(t => t.w)).size).toBe(1)+ expect(new Set(tiles.map(t => t.y)).size).toBe(1)+ for (let i = 1; i < tiles.length; i++) expect(tiles[i].x).toBeGreaterThan(tiles[i - 1].x + tiles[i - 1].w)+ expect(tiles[2].x + tiles[2].w).toBeLessThanOrEqual(CARD_WIDTH)+ })++ it('shrinks a number too wide for its tile instead of running into the next one', () => {+ const big = { ...model, stats: [...model.stats.slice(0, 2), { label: 'Volume', value: '123,456,789.5 kg' }] }+ const layout = layoutWorkoutCard(big, { measure })+ const tile = kinds(layout, 'tile')[2]+ const value = layout.items.find(i => i.text === '123,456,789.5 kg')+ expect(value.size).toBeLessThan(56)+ expect(value.x + measure(value.text, value.weight, value.size)).toBeLessThanOrEqual(tile.x + tile.w)+ })+it('keeps every line inside the card', () => {const long = { ...model, title: 'A very long routine name that will never fit on one line of the card at all', records: ['an exercise with a name far too long to fit on one line of the card'] }- const layout = layoutWorkoutCard(long, { measure })+ const layout = layoutWorkoutCard(long, { measure, map })for (const item of layout.items.filter(i => i.kind === 'text')) {expect(item.x + measure(item.text, item.weight, item.size), item.text).toBeLessThanOrEqual(layout.width)}})+ it('adds the front and back of the body, centred, with a less-to-more legend, when asked', () => {+ const without = layoutWorkoutCard(model, { measure })+ const layout = layoutWorkoutCard(model, { measure, map })+ expect(kinds(without, 'map')).toHaveLength(0)+ const [front, back] = kinds(layout, 'map')+ expect([front.view, back.view]).toEqual(['front', 'back'])+ expect(front.h / front.w).toBeCloseTo(map.aspect)+ expect(front.x - 0).toBeCloseTo(CARD_WIDTH - (back.x + back.w))+ expect(kinds(layout, 'swatch').map(s => s.level)).toEqual([0, 1, 2, 3, 4])+ expect(texts(layout)).toEqual(expect.arrayContaining(['Less', 'More']))+ expect(layout.height).toBeGreaterThan(without.height)+ // The map sits between the tiles and the records.+ const tilesEnd = Math.max(...kinds(layout, 'tile').map(t => t.y + t.h))+ const records = layout.items.find(i => i.text === 'New personal records')+ expect(front.y).toBeGreaterThan(tilesEnd)+ expect(records.y).toBeGreaterThan(front.y + front.h)+ })++ it('leaves the map out of a card whose workout has none, even when asked', () => {+ expect(kinds(layoutWorkoutCard({ ...model, levels: null }, { measure, map }), 'map')).toHaveLength(0)+ })+it('counts the new bests past the limit instead of growing without end', () => {const many = { ...model, records: Array.from({ length: 9 }, (_, i) => 'lift ' + i) }const layout = layoutWorkoutCard(many, { measure })- expect(layout.items.filter(i => i.kind === 'trophy')).toHaveLength(MAX_RECORDS - 1)+ expect(kinds(layout, 'trophy')).toHaveLength(MAX_RECORDS - 1)expect(texts(layout)).toContain('and 4 more')})@@ -106,13 +169,52 @@ describe('layoutWorkoutCard', () => {expect(layout.items.some(i => i.kind === 'trophy')).toBe(false)})- it('mirrors for a right-to-left language: lines start at the right edge', () => {- const ltr = layoutWorkoutCard(model, { measure })- const rtl = layoutWorkoutCard(model, { measure, rtl: true })+ it('mirrors for a right-to-left language: lines start at the right edge, tiles run right to left', () => {+ const ltr = layoutWorkoutCard(model, { measure, map })+ const rtl = layoutWorkoutCard(model, { measure, map, rtl: true })expect(rtl.rtl).toBe(true)const title = l => l.items.find(i => i.text === 'Push')expect(title(rtl).x).toBe(rtl.width - title(ltr).x)- const trophy = l => l.items.find(i => i.kind === 'trophy')- expect(trophy(rtl).x).toBeGreaterThan(rtl.width / 2)+ expect(kinds(rtl, 'trophy')[0].x).toBeGreaterThan(rtl.width / 2)+ const first = l => kinds(l, 'tile')[0]+ expect(first(rtl).x + first(rtl).w).toBeCloseTo(rtl.width - first(ltr).x)+ expect(kinds(rtl, 'swatch').map(s => s.level)).toEqual([4, 3, 2, 1, 0])+ })+})++describe('card colours', () => {+ it('reads hex and rgb colours, and nothing else', () => {+ expect(parseColor('#fff')).toEqual([255, 255, 255, 1])+ expect(parseColor('#30d158')).toEqual([48, 209, 88, 1])+ expect(parseColor('rgba(235,235,245,.6)')).toEqual([235, 235, 245, 0.6])+ expect(parseColor('rgb(10 20 30 / 50%)')).toEqual([10, 20, 30, 0.5])+ expect(parseColor('var(--acc)')).toBeNull()+ })++ it('mixes the way CSS color-mix(in srgb) does', () => {+ expect(mixColor('#ffffff', '#000000', 0.5)).toBe('rgb(128, 128, 128)')+ expect(mixColor('#30d158', '#1c1c1e', 1)).toBe('rgb(48, 209, 88)')+ // An unreadable colour falls back to the other one rather than to black.+ expect(mixColor('nonsense', '#1c1c1e', 0.5)).toBe('#1c1c1e')+ })++ it('shades the map from the surface towards the accent, five steps, as the app does', () => {+ const { sil, levels } = mapColors({ label: '#ffffff', surface: '#000000', acc: '#ff0000' })+ expect(sil).toBe('rgb(46, 46, 46)')+ expect(levels[0]).toBe('rgb(28, 28, 28)')+ expect(levels[4]).toBe('#ff0000')+ const reds = levels.slice(0, 4).map(c => parseColor(c)[0])+ expect([...reds].sort((a, b) => a - b)).toEqual(reds)+ })++ it('flattens a see-through label onto the surface first, as the light theme needs', () => {+ const { levels } = mapColors({ label: 'rgba(0,0,0,.5)', surface: '#ffffff', acc: '#0000ff' })+ // Half-black over white is mid-grey; 11 % of that over white.+ expect(levels[0]).toBe('rgb(241, 241, 241)')+ })++ it('reads a body view\'s height over its width from its viewBox', () => {+ expect(viewAspect({ vb: '0 95 727 1280' })).toBeCloseTo(1280 / 727)+ expect(viewAspect({})).toBeGreaterThan(1)})})diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex c58430cd2..152411c79 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -1439,6 +1439,11 @@ export default {'Image saved': 'تم حفظ الصورة','New personal records': 'أرقام شخصية جديدة','and {0} more': 'و{0} أخرى',+ 'Share workout': 'مشاركة التمرين',+ 'Share': 'مشاركة',+ 'Muscle map': 'خريطة العضلات',+ 'Show which muscles this workout trained.': 'أظهر العضلات التي درّبها هذا التمرين.',+ 'Preview of the image to share': 'معاينة الصورة المراد مشاركتها','Log this workout': 'سجّل هذا التمرين','Mark all sets done': 'تحديد كل المجموعات كمكتملة','All weigh-ins': 'كل قياسات الوزن',diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex 422fc2f57..4f8d65ee0 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -1537,6 +1537,11 @@ export default {'Image saved': 'Bild gespeichert','New personal records': 'Neue persönliche Rekorde','and {0} more': 'und {0} weitere',+ 'Share workout': 'Training teilen',+ 'Share': 'Teilen',+ 'Muscle map': 'Muskelkarte',+ 'Show which muscles this workout trained.': 'Zeigt, welche Muskeln dieses Training beansprucht hat.',+ 'Preview of the image to share': 'Vorschau des Bildes zum Teilen',// --- a missed day logged afterwards (#284) ---'Log this workout': 'Dieses Training eintragen','Mark all sets done': 'Alle Sätze abhaken',diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex e0a76343a..b851dce81 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -1517,6 +1517,11 @@ export default {'Image saved': 'Imagen guardada','New personal records': 'Nuevos récords personales','and {0} more': 'y {0} más',+ 'Share workout': 'Compartir entrenamiento',+ 'Share': 'Compartir',+ 'Muscle map': 'Mapa muscular',+ 'Show which muscles this workout trained.': 'Muestra qué músculos trabajó este entrenamiento.',+ 'Preview of the image to share': 'Vista previa de la imagen para compartir',// --- a missed day logged afterwards (#284) ---'Log this workout': 'Registrar este entrenamiento','Mark all sets done': 'Marcar todas las series como hechas',diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 3cadeb278..3e48b3cc0 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -1517,6 +1517,11 @@ export default {'Image saved': 'Image enregistrée','New personal records': 'Nouveaux records personnels','and {0} more': 'et {0} de plus',+ 'Share workout': 'Partager la séance',+ 'Share': 'Partager',+ 'Muscle map': 'Carte musculaire',+ 'Show which muscles this workout trained.': 'Montre les muscles travaillés pendant cette séance.',+ 'Preview of the image to share': 'Aperçu de l’image à partager',// --- a missed day logged afterwards (#284) ---'Log this workout': 'Enregistrer cette séance','Mark all sets done': 'Cocher toutes les séries',diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 16bbd1781..1ab8d890d 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -1517,6 +1517,11 @@ export default {'Image saved': 'छवि सहेजी गई','New personal records': 'नए व्यक्तिगत रिकॉर्ड','and {0} more': 'और {0} अन्य',+ 'Share workout': 'वर्कआउट साझा करें',+ 'Share': 'साझा करें',+ 'Muscle map': 'मांसपेशी मानचित्र',+ 'Show which muscles this workout trained.': 'दिखाएँ कि इस वर्कआउट में किन मांसपेशियों पर काम हुआ।',+ 'Preview of the image to share': 'साझा की जाने वाली छवि का पूर्वावलोकन',// --- a missed day logged afterwards (#284) ---'Log this workout': 'यह वर्कआउट दर्ज करें','Mark all sets done': 'सभी सेट पूरे मार्क करें',diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex 94848dbf7..6f96bfa33 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -1520,6 +1520,11 @@ export default {'Image saved': 'Kép mentve','New personal records': 'Új egyéni csúcsok','and {0} more': 'és még {0}',+ 'Share workout': 'Edzés megosztása',+ 'Share': 'Megosztás',+ 'Muscle map': 'Izomtérkép',+ 'Show which muscles this workout trained.': 'Megmutatja, mely izmokat dolgoztatta meg ez az edzés.',+ 'Preview of the image to share': 'A megosztandó kép előnézete',// --- a missed day logged afterwards (#284) ---'Log this workout': 'Az edzés rögzítése','Mark all sets done': 'Összes sorozat késznek jelölése',diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 944fe09d9..ee49ec0fa 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -1517,6 +1517,11 @@ export default {'Image saved': 'Immagine salvata','New personal records': 'Nuovi record personali','and {0} more': 'e altri {0}',+ 'Share workout': 'Condividi allenamento',+ 'Share': 'Condividi',+ 'Muscle map': 'Mappa muscolare',+ 'Show which muscles this workout trained.': 'Mostra quali muscoli ha allenato questa sessione.',+ 'Preview of the image to share': 'Anteprima dell’immagine da condividere',// --- a missed day logged afterwards (#284) ---'Log this workout': 'Registra questo allenamento','Mark all sets done': 'Segna tutte le serie come fatte',diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex 6b1965863..bcb4aae10 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -1517,6 +1517,11 @@ export default {'Image saved': '이미지를 저장했습니다','New personal records': '새 개인 기록','and {0} more': '외 {0}개',+ 'Share workout': '운동 공유',+ 'Share': '공유',+ 'Muscle map': '근육 지도',+ 'Show which muscles this workout trained.': '이번 운동에서 사용한 근육을 보여 줍니다.',+ 'Preview of the image to share': '공유할 이미지 미리보기',// --- a missed day logged afterwards (#284) ---'Log this workout': '이 운동 기록','Mark all sets done': '모든 세트 완료로 표시',diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex bcf3645ce..18d38f75c 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -1517,6 +1517,11 @@ export default {'Image saved': 'Obraz zapisany','New personal records': 'Nowe rekordy życiowe','and {0} more': 'i {0} więcej',+ 'Share workout': 'Udostępnij trening',+ 'Share': 'Udostępnij',+ 'Muscle map': 'Mapa mięśni',+ 'Show which muscles this workout trained.': 'Pokazuje, które mięśnie pracowały w tym treningu.',+ 'Preview of the image to share': 'Podgląd obrazu do udostępnienia',// --- a missed day logged afterwards (#284) ---'Log this workout': 'Zapisz ten trening','Mark all sets done': 'Oznacz wszystkie serie jako zrobione',diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex 1f5b01cef..4ed27d6d1 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -1218,6 +1218,11 @@ export const PT_BR_OVERRIDES = {'Image saved': 'Imagem salva','New personal records': 'Novos recordes pessoais','and {0} more': 'e mais {0}',+ 'Share workout': 'Compartilhar treino',+ 'Share': 'Compartilhar',+ 'Muscle map': 'Mapa muscular',+ 'Show which muscles this workout trained.': 'Mostra quais músculos este treino trabalhou.',+ 'Preview of the image to share': 'Prévia da imagem para compartilhar',}export default { ...pt, ...PT_BR_OVERRIDES }diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 345e75448..2f9ee9a42 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -1517,6 +1517,11 @@ export default {'Image saved': 'Imagem guardada','New personal records': 'Novos recordes pessoais','and {0} more': 'e mais {0}',+ 'Share workout': 'Partilhar treino',+ 'Share': 'Partilhar',+ 'Muscle map': 'Mapa muscular',+ 'Show which muscles this workout trained.': 'Mostra que músculos este treino trabalhou.',+ 'Preview of the image to share': 'Pré-visualização da imagem a partilhar',// --- a missed day logged afterwards (#284) ---'Log this workout': 'Registar este treino','Mark all sets done': 'Marcar todas as séries como feitas',diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 926542698..ecc5ba235 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -1486,6 +1486,11 @@ export default {'Image saved': 'Изображение сохранено','New personal records': 'Новые личные рекорды','and {0} more': 'и ещё {0}',+ 'Share workout': 'Поделиться тренировкой',+ 'Share': 'Поделиться',+ 'Muscle map': 'Карта мышц',+ 'Show which muscles this workout trained.': 'Показывает, какие мышцы работали на этой тренировке.',+ 'Preview of the image to share': 'Предпросмотр изображения',// --- a missed day logged afterwards (#284) ---'Log this workout': 'Записать эту тренировку','Mark all sets done': 'Отметить все подходы выполненными',diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 026fc972d..b4639c0fa 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -1528,6 +1528,11 @@ export default {'Image saved': 'บันทึกรูปภาพแล้ว','New personal records': 'สถิติส่วนตัวใหม่','and {0} more': 'และอีก {0} รายการ',+ 'Share workout': 'แชร์การออกกำลังกาย',+ 'Share': 'แชร์',+ 'Muscle map': 'แผนที่กล้ามเนื้อ',+ 'Show which muscles this workout trained.': 'แสดงว่าการออกกำลังกายนี้ฝึกกล้ามเนื้อส่วนใดบ้าง',+ 'Preview of the image to share': 'ตัวอย่างรูปภาพที่จะแชร์',// --- a missed day logged afterwards (#284) ---'Log this workout': 'บันทึกการฝึกนี้','Mark all sets done': 'ทำเครื่องหมายทุกเซ็ตว่าเสร็จแล้ว',diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 2715021db..ab24c30cd 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -1517,6 +1517,11 @@ export default {'Image saved': 'Görsel kaydedildi','New personal records': 'Yeni kişisel rekorlar','and {0} more': 've {0} tane daha',+ 'Share workout': 'Antrenmanı paylaş',+ 'Share': 'Paylaş',+ 'Muscle map': 'Kas haritası',+ 'Show which muscles this workout trained.': 'Bu antrenmanın hangi kasları çalıştırdığını gösterir.',+ 'Preview of the image to share': 'Paylaşılacak görselin önizlemesi',// --- a missed day logged afterwards (#284) ---'Log this workout': 'Bu antrenmanı kaydet','Mark all sets done': 'Tüm setleri tamamlandı olarak işaretle',diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex ac876d5a4..392e3e34b 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -1383,6 +1383,11 @@ export default {'Image saved': 'Зображення збережено','New personal records': 'Нові особисті рекорди','and {0} more': 'і ще {0}',+ 'Share workout': 'Поділитися тренуванням',+ 'Share': 'Поділитися',+ 'Muscle map': 'Карта м’язів',+ 'Show which muscles this workout trained.': 'Показує, які м’язи працювали на цьому тренуванні.',+ 'Preview of the image to share': 'Попередній перегляд зображення','Log this workout': 'Записати це тренування','Mark all sets done': 'Позначити всі підходи виконаними','All weigh-ins': 'Усі зважування',diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex fcc3d5c05..1a779afdd 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -1501,6 +1501,11 @@ export default {'Image saved': '圖片已儲存','New personal records': '新個人紀錄','and {0} more': '以及另外 {0} 項',+ 'Share workout': '分享訓練',+ 'Share': '分享',+ 'Muscle map': '肌肉圖',+ 'Show which muscles this workout trained.': '顯示本次訓練鍛鍊了哪些肌肉。',+ 'Preview of the image to share': '待分享圖片的預覽',// --- a missed day logged afterwards (#284) ---'Log this workout': '補記本次訓練','Mark all sets done': '將所有組數標記為已完成',diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex 72c89bce7..5e6369c48 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -1517,6 +1517,11 @@ export default {'Image saved': '图片已保存','New personal records': '新个人纪录','and {0} more': '以及另外 {0} 项',+ 'Share workout': '分享训练',+ 'Share': '分享',+ 'Muscle map': '肌肉图',+ 'Show which muscles this workout trained.': '显示本次训练锻炼了哪些肌肉。',+ 'Preview of the image to share': '待分享图片的预览',// --- a missed day logged afterwards (#284) ---'Log this workout': '补记这次训练','Mark all sets done': '将所有组标为完成',diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 871177ee9..3cd711fee 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -54,7 +54,7 @@ import { editCompletedSession, editLeftEmpty, editedRecord, editChangesNothing }import { stampWorkout } from './lib/sync-merge.js'import { weeklyWeights } from './lib/bodyweight.js'import { workoutText } from './lib/workout-text.js'-import { workoutCardModel, layoutWorkoutCard, drawWorkoutCard, CARD_FONT } from './lib/workout-card.js'+import { workoutCardModel, layoutWorkoutCard, drawWorkoutCard, viewAspect, CARD_FONT } from './lib/workout-card.js'import { copyText } from './lib/clipboard.js'import { queueRemaining, pinState } from './lib/queue.js'@@ -2214,12 +2214,9 @@ function WorkoutDetail({ w, close }) {const rec = { ...(st.workouts.find(x => sameWorkout(x, w)) || w), note: note.trim() }toast(await copyText(workoutText(rec, { unit: st.unit, nameOf, speedUnit: speedUnitOf(st) })) ? t('Copied') : t('Could not copy'))}- const shareAsImage = async () => {+ const shareAsImage = () => {const rec = st.workouts.find(x => sameWorkout(x, w)) || w- let blob- try { blob = await workoutCardImage(rec, { unit: st.unit, nameOf }) } catch (e) { blob = null }- if (!blob) { toast(t('Could not create the image')); return }- await shareImage(blob, 'opengym-workout-' + (workoutDay(rec) || todayISO()) + '.png', rec.name || 'openGym')+ ui().openSheet(c2 => <ShareWorkoutImage w={rec} nameOf={nameOf} close={c2} />)}// A combined session's entries carry a `rid`; group them into per-routine sections in merge// order, with each section's supersets paired inside it (sessionSections, which "Copy as text"@@ -2304,19 +2301,69 @@ function WorkoutDetail({ w, close }) {</>}// "Share as image" (#453): the card lib/workout-card.js lays out, painted in the theme and accent-// the app is showing right now, as a PNG.-async function workoutCardImage(w, opts) {+// the app is showing right now, previewed before it goes anywhere. The muscle map is the finish+// summary's, for this one session; whether the card carries it is remembered with the profile.+function ShareWorkoutImage({ w, nameOf, close }) {+ const st = useStore(s => s.S)+ const update = useStore(s => s.update)+ const withMap = st.shareMap !== false+ const model = useMemo(() => workoutCardModel(w, { unit: st.unit, nameOf }), [w, st.unit])+ // The last picture stays up while the next one is drawn, so the toggle never blanks the sheet.+ const [img, setImg] = useState(null)+ const [busy, setBusy] = useState(false)+ const shown = useRef(null)+ useEffect(() => {+ let alive = true+ workoutCardImage(model, { map: withMap, body: st.body })+ .then(blob => {+ if (!alive) return+ if (!blob) { setImg(prev => ({ ...prev, failed: true })); return }+ if (shown.current) URL.revokeObjectURL(shown.current)+ shown.current = URL.createObjectURL(blob)+ setImg({ blob, url: shown.current })+ })+ .catch(() => { if (alive) setImg(prev => ({ ...prev, failed: true })) })+ return () => { alive = false }+ }, [model, withMap, st.body])+ useEffect(() => () => { if (shown.current) URL.revokeObjectURL(shown.current) }, [])+ const name = 'opengym-workout-' + (workoutDay(w) || todayISO()) + '.png'+ const share = async () => {+ setBusy(true)+ await shareImage(img.blob, name, w.name || 'openGym')+ setBusy(false)+ close()+ }+ return <>+ <h3>{t('Share workout')}</h3>+ <div className="share-card">+ {img?.url+ ? <img src={img.url} alt={t('Preview of the image to share')} />+ : img?.failed ? <div className="share-card-ph small muted">{t('Could not create the image')}</div>+ : <div className="share-card-ph" aria-hidden="true" />}+ </div>+ {model.levels && <div className="sect-b" style={{ marginBottom: 12 }}>+ <Row icon="figureStrength" iconTint="var(--acc)" title={t('Muscle map')} subtitle={t('Show which muscles this workout trained.')}>+ <Switch checked={withMap} aria-label={t('Muscle map')} onChange={v => update(s => { s.shareMap = v })} />+ </Row>+ </div>}+ <Button variant="primary" icon="share" disabled={!img?.blob || busy} onClick={share}>{t('Share')}</Button>+ </>+}+async function workoutCardImage(model, { map, body }) {const root = getComputedStyle(document.documentElement)const css = (name, fallback) => root.getPropertyValue(name).trim() || fallback- const colors = { bg: css('--bg', '#000'), surface: css('--surface', '#1c1c1e'), label: css('--label', '#fff'), label2: css('--label-2', '#999'), acc: css('--acc', '#30d158') }+ const colors = { bg: css('--bg', '#000'), surface: css('--surface', '#1c1c1e'), tile: css('--surface-2', '#2c2c2e'), label: css('--label', '#fff'), label2: css('--label-2', '#999'), acc: css('--acc', '#30d158') }+ // The body geometry is ~90 KB and lazy everywhere else too (components/BodyMap.jsx).+ const geometry = map && model.levels ? (await import('./lib/body-paths.js')).default : null+ const shape = geometry && (geometry[body] || geometry.male)const canvas = document.createElement('canvas')const ctx = canvas.getContext('2d')if (!ctx) return nullconst measure = (text, weight, size) => { ctx.font = `${weight} ${size}px ${CARD_FONT}`; return ctx.measureText(text).width }- const layout = layoutWorkoutCard(workoutCardModel(w, opts), { measure, rtl: document.documentElement.dir === 'rtl' })+ const layout = layoutWorkoutCard(model, { measure, rtl: document.documentElement.dir === 'rtl', map: shape ? { aspect: viewAspect(shape.front) } : null })canvas.width = layout.widthcanvas.height = layout.height- drawWorkoutCard(ctx, layout, colors)+ drawWorkoutCard(ctx, layout, colors, shape ? { body: shape, levels: model.levels } : null)return new Promise(resolve => canvas.toBlob(resolve, 'image/png'))}// The phone app goes through the OS share sheet the way a backup does; a browser that can sharediff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.jsindex 96842677b..25be78fe1 100644--- a/frontend/src/store/useStore.js+++ b/frontend/src/store/useStore.js@@ -183,6 +183,9 @@ 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,// 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.