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
Progress photos for any day, several at once (#557)
Duarte Santos781eddac11a2
diff --git a/api/media.js b/api/media.jsindex cb2674d94..8b448b112 100644--- a/api/media.js+++ b/api/media.js@@ -82,7 +82,10 @@ export function mediaLimits(env = process.env) {// `workouts: true`: this server keeps the files a logged workout's `media` names (its GC walks// workouts[].media), so a signed-in client may offer attaching them. A server from before says// nothing, and the client offers them on custom exercises only.-export const mediaConfig = l => ({ imageMB: l.imageMB, gifMB: l.gifMB, videoMB: l.videoMB, videoSec: l.videoSec, quotaMB: l.quotaMB, workouts: true });+// `days: true`: it keeps the files of progress photos filed under a day (`dayPhotos`, a photo for+// a day without a workout, #557) too. An older server would sweep those, so the app files a photo+// under a day only where this says so.+export const mediaConfig = l => ({ imageMB: l.imageMB, gifMB: l.gifMB, videoMB: l.videoMB, videoSec: l.videoSec, quotaMB: l.quotaMB, workouts: true, days: true });/* ---------------------------------------------------------------- errors */@@ -300,6 +303,9 @@ export function referencedHashes(state) {if (!isObj(w) || !Array.isArray(w.media)) continue;for (const m of w.media) if (isObj(m)) ref(m);}+ // Progress photos filed under a day rather than a workout (frontend lib/day-photos.js):+ // dayPhotos[<hash>] = { d, m, _ts }, a cleared one only { _ts }.+ if (isObj(state.dayPhotos)) for (const e of Object.values(state.dayPhotos)) if (isObj(e) && isObj(e.m)) ref(e.m);return out;}diff --git a/api/openapi.yaml b/api/openapi.yamlindex 3de45e7be..713191645 100644--- a/api/openapi.yaml+++ b/api/openapi.yaml@@ -3651,7 +3651,14 @@ components:This instance keeps the files a logged workout's `media` list names too, not only acustom exercise's. Absent on an instance from before; the app then offers photos andvideos on custom exercises only.- example: { imageMB: 2, gifMB: 8, videoMB: 40, videoSec: 60, quotaMB: 200, workouts: true }+ days:+ type: boolean+ const: true+ description: >-+ This instance also keeps the files of progress photos filed under a day+ (`dayPhotos`, a photo for a day without a workout). Absent on an instance from+ before; the app then only adds photos to logged workouts there.+ example: { imageMB: 2, gifMB: 8, videoMB: 40, videoSec: 60, quotaMB: 200, workouts: true, days: true }MediaUsage:type: objectdiff --git a/api/sync-stamps.js b/api/sync-stamps.jsindex 7dd2485be..a8ea2e6d5 100644--- a/api/sync-stamps.js+++ b/api/sync-stamps.js@@ -64,12 +64,13 @@ const capStamps = m => {const OWN_MERGE = new Set(['_ts', '_rev', '_wid', '_wids', '_unstamped', '_prior', 'active', 'unit', 'unitSet', 'resetAt', 'resetIds', 'deleted', 'edited', 'undone', 'routineOrder','workouts', 'routines', 'customEx', 'equipProfiles', 'gymCards', 'bodyweight', 'measurements', 'favEx',- 'exWeights', 'balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells', 'dayNotes',+ 'exWeights', 'balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells', 'dayNotes', 'dayPhotos',]);const PER_KEY = new Set(['week', 'dayPlan', 'exNotes', 'barWeights']);// The maps whose every entry carries its own edit time (sync-merge.js STAMPED_MAPS): merged per-// key by the app, so never stamped here as a whole setting. dayNotes is a note per day off.-export const STAMPED_MAPS = ['balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells', 'dayNotes'];+// key by the app, so never stamped here as a whole setting. dayNotes is a note per day off,+// dayPhotos a progress photo filed under a day (#557), one entry per photo.+export const STAMPED_MAPS = ['balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells', 'dayNotes', 'dayPhotos'];const ENTRY_META = new Set(['id', '_ts', '_f', '_u']);const ENTRY_LISTS = ['routines', 'customEx', 'equipProfiles', 'gymCards', 'workouts'];diff --git a/api/test/fixtures/media-refs.json b/api/test/fixtures/media-refs.jsonindex 5b7d66139..19a024672 100644--- a/api/test/fixtures/media-refs.json+++ b/api/test/fixtures/media-refs.json@@ -1,5 +1,5 @@{- "about": "Which blob hashes a state references. api/media.js referencedHashes() and frontend/src/lib/media-refs.js referencedHashes() must both give `expect` (compared as sorted lists) for every `state` here: the server keeps and the client keeps exactly this set. Each of customEx[].media.hash, customEx[].media.poster.hash and the same two of every entry of workouts[].media counts on its own when it matches /^[0-9a-f]{64}$/ — deliberately looser than normalizeMediaRef, because this set decides what is kept.",+ "about": "Which blob hashes a state references. api/media.js referencedHashes() and frontend/src/lib/media-refs.js referencedHashes() must both give `expect` (compared as sorted lists) for every `state` here: the server keeps and the client keeps exactly this set. Each of customEx[].media.hash, customEx[].media.poster.hash the same two of every entry of workouts[].media and of every dayPhotos entry's `m` count on its own when it matches /^[0-9a-f]{64}$/ \u2014 deliberately looser than normalizeMediaRef, because this set decides what is kept.","referencedHashes": [{"name": "no state at all",@@ -869,6 +869,62 @@"workouts": []},"expect": []+ },+ {+ "name": "progress photos filed under a day (dayPhotos), a cleared one and junk among them",+ "state": {+ "dayPhotos": {+ "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd": {+ "d": "2026-10-02",+ "m": {+ "kind": "image",+ "hash": "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",+ "mime": "image/webp",+ "size": 1000,+ "width": 800,+ "height": 600,+ "at": 1,+ "poster": {+ "hash": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",+ "mime": "image/webp",+ "size": 100,+ "width": 480,+ "height": 360+ }+ },+ "_ts": 5+ },+ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": {+ "_ts": 6+ },+ "x": 3,+ "y": {+ "d": "2026-10-03",+ "m": {+ "kind": "image",+ "hash": "not-a-hash"+ },+ "_ts": 7+ }+ }+ },+ "expect": [+ "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",+ "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"+ ]+ },+ {+ "name": "dayPhotos that is not a map",+ "state": {+ "dayPhotos": [+ {+ "m": {+ "hash": "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"+ }+ }+ ]+ },+ "expect": []}]}diff --git a/api/test/server-media.test.js b/api/test/server-media.test.jsindex 3ebe160dd..721eec0b4 100644--- a/api/test/server-media.test.js+++ b/api/test/server-media.test.js@@ -414,7 +414,7 @@ test('folders are 0700 and files 0600, and an admin deleting the profile removestest('/api/config carries the caps; MEDIA_UPLOADS=0 takes the block and every route away', async t => {const on = await start(t, { MEDIA_QUOTA_MB: '100', MEDIA_VIDEO_MAX_SEC: '30' });const cfg = await (await fetch(`${on.api}/api/config`)).json();- assert.deepEqual(cfg.media, { imageMB: 2, gifMB: 8, videoMB: 40, videoSec: 30, quotaMB: 100, workouts: true }); // `workouts`: a logged workout may carry them too+ assert.deepEqual(cfg.media, { imageMB: 2, gifMB: 8, videoMB: 40, videoSec: 30, quotaMB: 100, workouts: true, days: true }); // `workouts`: a logged workout may carry them too; `days`: a photo filed under a day (#557)const off = await start(t, { MEDIA_UPLOADS: '0' });const cfgOff = await (await fetch(`${off.api}/api/config`)).json();diff --git a/frontend/src/lib/day-photos.js b/frontend/src/lib/day-photos.jsnew file mode 100644index 000000000..6e0bd9cae--- /dev/null+++ b/frontend/src/lib/day-photos.js@@ -0,0 +1,102 @@+// Progress photos filed under a day rather than a workout (#557): a photo for a day you did not+// train, or one taken on an earlier day and added later. A photo for a day that has a logged+// workout goes onto that workout as before (lib/workout-media.js); this is the place for the+// rest.+//+// S.dayPhotos = { '<hash>': { d: '2026-10-08', m: <MediaRef>, _ts }, … }+//+// One entry per photo, keyed by its file, with the time it was last written, the way day notes+// are kept per day (lib/day-notes.js): two devices that each added a photo keep both, and the+// same photo keeps its later version (lib/sync-merge.js mergeStampedMap, STAMPED_MAPS). Taking one+// away writes a stamped empty entry (`{ _ts }`), never a deleted key: a deleted key would come+// straight back from the other device's copy on the next sync. The field is optional: a profile+// that never filed a photo under a day has none, and nothing else in it changes.+//+// The files are kept like every other photo: media-refs.js stateMediaRefs and api/media.js+// referencedHashes walk dayPhotos too, so the sync uploads them, the backups carry them and the+// clean-ups leave them be. A server from before that would sweep them, so the app files a photo+// under a day only where the server says it keeps them (GET /api/config media.days), or where+// there is no server at all.+import { normalizeMediaRef, workoutMediaOf, WORKOUT_MEDIA_MAX } from './media-refs.js'+import { addWorkoutMedia } from './workout-media.js'++const isMap = v => !!v && typeof v === 'object' && !Array.isArray(v)+const ISO = /^\d{4}-\d{2}-\d{2}$/++/** One stored entry read back: { d, m } or null for a cleared or malformed one. */+export function readDayPhoto(entry) {+ if (!isMap(entry) || !ISO.test(String(entry.d || ''))) return null+ const m = normalizeMediaRef(entry.m)+ return m ? { d: entry.d, m } : null+}++/** Every photo filed under a day, as { hash, d, m }. */+export function dayPhotosOf(S) {+ const map = isMap(S?.dayPhotos) ? S.dayPhotos : {}+ const out = []+ for (const [hash, e] of Object.entries(map)) {+ const p = readDayPhoto(e)+ if (p && p.m.hash === hash) out.push({ hash, ...p })+ }+ return out+}++/** Whether a server keeps photos filed under a day: none at all (local), or one that says so. */+export const serverTakesDayPhotos = (user, config) => !user || (!!config && !!config.media && config.media.days === true)++/**+ * Files `ref` under day `d`. 'added', or why not: 'invalid' (no valid date or MediaRef), 'dup'+ * (that file is filed already). Mutates `state`, made for useStore's update().+ */+export function addDayPhoto(state, d, ref, now = Date.now()) {+ if (!ISO.test(String(d || ''))) return 'invalid'+ const m = normalizeMediaRef(ref)+ if (!m) return 'invalid'+ const map = isMap(state.dayPhotos) ? state.dayPhotos : {}+ if (readDayPhoto(map[m.hash])) return 'dup'+ state.dayPhotos = { ...map, [m.hash]: { d, m, _ts: now } }+ return 'added'+}++/** Takes the photo `hash` away (a stamped empty entry). Returns whether it was there. */+export function removeDayPhoto(state, hash, now = Date.now()) {+ const map = isMap(state.dayPhotos) ? state.dayPhotos : {}+ if (!readDayPhoto(map[hash])) return false+ state.dayPhotos = { ...map, [hash]: { _ts: now } }+ return true+}++/** The Undo of a removal: the entry as it was, stamped now. Returns whether it changed anything. */+export function restoreDayPhoto(state, hash, entry, now = Date.now()) {+ const p = readDayPhoto(entry)+ if (!p || p.m.hash !== hash) return false+ const map = isMap(state.dayPhotos) ? state.dayPhotos : {}+ if (readDayPhoto(map[hash])) return false+ state.dayPhotos = { ...map, [hash]: { d: p.d, m: p.m, _ts: now } }+ return true+}++/** The latest workout logged on day `d`, or null. */+export function workoutOn(S, d) {+ const day = (Array.isArray(S?.workouts) ? S.workouts : []).filter(w => w && w.d === d)+ return day.length ? day.reduce((a, b) => ((b.start || 0) > (a.start || 0) ? b : a)) : null+}++/**+ * Where a new progress photo for day `d` goes, and puts it there: onto that day's latest workout+ * while it has room ('workout'), else under the day ('day') when `canDay` (the server keeps those,+ * or there is none). 'no-room' when neither, 'dup' for a file already there, 'invalid' for a bad+ * date or ref. Mutates `state`.+ */+export function fileProgressPhoto(state, d, ref, { canDay = true, now = Date.now() } = {}) {+ const w = workoutOn(state, d)+ if (w && workoutMediaOf(w).length < WORKOUT_MEDIA_MAX) {+ const r = addWorkoutMedia(state, w, ref, now)+ if (r === 'added') return 'workout'+ if (r === 'dup' || r === 'invalid') return r+ }+ if (!canDay) return 'no-room'+ const r = addDayPhoto(state, d, ref, now)+ return r === 'added' ? 'day' : r+}+diff --git a/frontend/src/lib/day-photos.test.js b/frontend/src/lib/day-photos.test.jsnew file mode 100644index 000000000..c20527613--- /dev/null+++ b/frontend/src/lib/day-photos.test.js@@ -0,0 +1,94 @@+import { describe, expect, it } from 'vitest'+import { dayPhotosOf, readDayPhoto, addDayPhoto, removeDayPhoto, restoreDayPhoto, serverTakesDayPhotos, fileProgressPhoto, workoutOn } from './day-photos.js'+import { referencedHashes, referencedFiles, WORKOUT_MEDIA_MAX } from './media-refs.js'+import { mergeStates, STAMPED_MAPS } from './sync-merge.js'++/* Progress photos filed under a day (#557): an optional per-photo map beside the workouts, merged+ like day notes, its files kept like every other photo's. */+const H = n => String(n).repeat(64).slice(0, 64)+const photo = h => ({ kind: 'image', hash: h, mime: 'image/webp', size: 1000, width: 800, height: 600, at: 1 })+const state = (over = {}) => ({ unit: 'kg', workouts: [], routines: [], customEx: [], ...over })++describe('filing and removing', () => {+ it('adds under a day, refuses a bad date, a bad ref and the same file twice', () => {+ const S = state()+ expect(addDayPhoto(S, '2026-10-02', photo(H(1)), 5)).toBe('added')+ expect(S.dayPhotos[H(1)]).toEqual({ d: '2026-10-02', m: photo(H(1)), _ts: 5 })+ expect(addDayPhoto(S, '2026-10-02', photo(H(1)), 6)).toBe('dup')+ expect(addDayPhoto(S, 'yesterday', photo(H(2)), 6)).toBe('invalid')+ expect(addDayPhoto(S, '2026-10-02', { hash: 'x' }, 6)).toBe('invalid')+ expect(dayPhotosOf(S)).toEqual([{ hash: H(1), d: '2026-10-02', m: photo(H(1)) }])+ })+ it('a removal is a stamped empty entry, and Undo brings it back', () => {+ const S = state()+ addDayPhoto(S, '2026-10-02', photo(H(1)), 5)+ const entry = S.dayPhotos[H(1)]+ expect(removeDayPhoto(S, H(1), 9)).toBe(true)+ expect(S.dayPhotos[H(1)]).toEqual({ _ts: 9 })+ expect(dayPhotosOf(S)).toEqual([])+ expect(removeDayPhoto(S, H(1), 10)).toBe(false)+ expect(restoreDayPhoto(S, H(1), entry, 11)).toBe(true)+ expect(S.dayPhotos[H(1)]).toEqual({ d: '2026-10-02', m: photo(H(1)), _ts: 11 })+ })+ it('reads junk as nothing', () => {+ expect(dayPhotosOf({ dayPhotos: [1] })).toEqual([])+ expect(dayPhotosOf({ dayPhotos: { [H(1)]: { d: '2026-10-02', m: photo(H(2)) }, x: 3 } })).toEqual([])+ expect(readDayPhoto({ d: '2026-10-02' })).toBeNull()+ })+})++describe('where a new photo goes', () => {+ it('onto the day\'s workout while it has room, else under the day', () => {+ const w = { id: 'w', d: '2026-10-02', start: 1, entries: [] }+ const S = state({ workouts: [w] })+ expect(fileProgressPhoto(S, '2026-10-02', photo(H(1)), { now: 5 })).toBe('workout')+ expect(S.workouts[0].media).toHaveLength(1)+ expect(fileProgressPhoto(S, '2026-10-03', photo(H(2)), { now: 5 })).toBe('day')+ const full = state({ workouts: [{ ...w, media: Array.from({ length: WORKOUT_MEDIA_MAX }, (_, i) => photo(H(i + 3))) }] })+ expect(fileProgressPhoto(full, '2026-10-02', photo(H(1)), { now: 5 })).toBe('day')+ })+ it('a server that does not keep day photos: only onto workouts', () => {+ const S = state()+ expect(fileProgressPhoto(S, '2026-10-03', photo(H(2)), { canDay: false })).toBe('no-room')+ expect(S.dayPhotos).toBeUndefined()+ })+ it('picks the latest workout of a day', () => {+ const S = state({ workouts: [{ id: 'a', d: '2026-10-02', start: 1 }, { id: 'b', d: '2026-10-02', start: 9 }] })+ expect(workoutOn(S, '2026-10-02').id).toBe('b')+ expect(workoutOn(S, '2026-10-05')).toBeNull()+ })+ it('a server keeps them when it says so, or there is none', () => {+ expect(serverTakesDayPhotos(null, null)).toBe(true)+ expect(serverTakesDayPhotos({ id: 'u' }, { media: { workouts: true } })).toBe(false)+ expect(serverTakesDayPhotos({ id: 'u' }, { media: { workouts: true, days: true } })).toBe(true)+ expect(serverTakesDayPhotos({ id: 'u' }, null)).toBe(false)+ })+})++describe('kept, synced and merged like every other photo', () => {+ it('their files count for the uploads, the backups and the clean-ups', () => {+ const S = state()+ addDayPhoto(S, '2026-10-02', photo(H(1)), 5)+ expect([...referencedHashes(S)]).toEqual([H(1)])+ expect(referencedFiles(S).map(f => f.hash)).toEqual([H(1)])+ removeDayPhoto(S, H(1), 6)+ expect([...referencedHashes(S)]).toEqual([])+ })+ it('two devices each adding one keep both; a removal on one wins over the older add', () => {+ expect(STAMPED_MAPS).toContain('dayPhotos')+ const a = state({ _ts: 10 }), b = state({ _ts: 20 })+ addDayPhoto(a, '2026-10-02', photo(H(1)), 10)+ addDayPhoto(b, '2026-10-03', photo(H(2)), 20)+ const m = mergeStates(a, b)+ expect(dayPhotosOf(m).map(p => p.hash).sort()).toEqual([H(1), H(2)])+ const c = structuredClone(m); c._ts = 30+ removeDayPhoto(c, H(1), 30)+ expect(dayPhotosOf(mergeStates(c, a)).map(p => p.hash)).toEqual([H(2)])+ expect(dayPhotosOf(mergeStates(a, c)).map(p => p.hash)).toEqual([H(2)])+ })+ it('a profile without day photos merges exactly as before', () => {+ const a = state({ _ts: 10, workouts: [{ id: 'w', d: '2026-10-02', start: 1, entries: [], _ts: 10 }] })+ const b = state({ _ts: 20 })+ expect('dayPhotos' in mergeStates(a, b)).toBe(false)+ })+})diff --git a/frontend/src/lib/exif-date.js b/frontend/src/lib/exif-date.jsnew file mode 100644index 000000000..c373bdc1a--- /dev/null+++ b/frontend/src/lib/exif-date.js@@ -0,0 +1,70 @@+// The day a photo was taken, from its EXIF DateTimeOriginal, to suggest the date a progress photo+// is filed under (#557). JPEG only, a few dozen lines rather than a library: the APP1 "Exif"+// segment, its TIFF header (either byte order), IFD0's pointer to the Exif IFD, and tag 0x9003+// there ("YYYY:MM:DD HH:MM:SS"). Anything it cannot read is null, and the person picks the date.+// It only reads bytes the person chose themselves, and only the date.++const DATE = /^(\d{4}):(\d{2}):(\d{2})/++/** 'YYYY-MM-DD' from a JPEG's bytes (ArrayBuffer or Uint8Array), or null. */+export function exifDateOf(input) {+ const b = input instanceof Uint8Array ? input : new Uint8Array(input || [])+ const v = new DataView(b.buffer, b.byteOffset, b.byteLength)+ if (b.length < 4 || b[0] !== 0xff || b[1] !== 0xd8) return null+ let p = 2+ while (p + 4 <= b.length) {+ if (b[p] !== 0xff) return null+ const marker = b[p + 1]+ if (marker === 0xda || marker === 0xd9) return null // the image data begins: no EXIF+ const len = v.getUint16(p + 2)+ if (len < 2 || p + 2 + len > b.length) return null+ if (marker === 0xe1 && len >= 8 && b[p + 4] === 0x45 && b[p + 5] === 0x78 && b[p + 6] === 0x69 && b[p + 7] === 0x66) {+ return fromTiff(b, v, p + 10, p + 2 + len)+ }+ p += 2 + len+ }+ return null+}++function fromTiff(b, v, start, end) {+ if (start + 8 > end) return null+ const le = b[start] === 0x49 && b[start + 1] === 0x49+ if (!le && !(b[start] === 0x4d && b[start + 1] === 0x4d)) return null+ const u16 = o => (o + 2 <= end ? v.getUint16(o, le) : null)+ const u32 = o => (o + 4 <= end ? v.getUint32(o, le) : null)+ const tag = (ifd, want) => {+ const at = start + ifd+ const n = u16(at)+ if (n == null || n > 1000) return null+ for (let i = 0; i < n; i++) {+ const e = at + 2 + i * 12+ if (u16(e) === want) return { type: u16(e + 2), count: u32(e + 4), value: e + 8 }+ }+ return null+ }+ const ifd0 = u32(start + 4)+ if (ifd0 == null) return null+ const exifPtr = tag(ifd0, 0x8769)+ if (!exifPtr) return null+ const exifIfd = u32(exifPtr.value)+ if (exifIfd == null) return null+ const dt = tag(exifIfd, 0x9003) || tag(exifIfd, 0x9004)+ if (!dt || dt.type !== 2 || !(dt.count >= 10)) return null+ const off = dt.count > 4 ? start + u32(dt.value) : dt.value+ if (off + 10 > end) return null+ const text = String.fromCharCode(...b.subarray(off, off + 10))+ const m = DATE.exec(text)+ if (!m) return null+ const [, y, mo, d] = m+ if (+mo < 1 || +mo > 12 || +d < 1 || +d > 31 || +y < 1990) return null+ return `${y}-${mo}-${d}`+}++/** The same from a File or Blob (the first 256 KB, where EXIF lives). Never throws. */+export async function exifDateOfFile(file) {+ try {+ if (!file || typeof file.slice !== 'function') return null+ const head = await file.slice(0, 256 * 1024).arrayBuffer()+ return exifDateOf(head)+ } catch { return null }+}diff --git a/frontend/src/lib/exif-date.test.js b/frontend/src/lib/exif-date.test.jsnew file mode 100644index 000000000..55e6f5b2f--- /dev/null+++ b/frontend/src/lib/exif-date.test.js@@ -0,0 +1,46 @@+import { describe, expect, it } from 'vitest'+import { exifDateOf, exifDateOfFile } from './exif-date.js'++/* The date a photo was taken, read from a JPEG's EXIF (#557). The JPEGs here are built byte by+ byte: SOI, an APP1 "Exif" segment with a TIFF header, IFD0 pointing at the Exif IFD, and+ DateTimeOriginal in it. */+function jpeg({ le = true, date = '2026:09:14 07:31:02', tagId = 0x9003, extra = [] } = {}) {+ const tiff = []+ const u16 = n => (le ? [n & 255, n >> 8] : [n >> 8, n & 255])+ const u32 = n => (le ? [n & 255, (n >> 8) & 255, (n >> 16) & 255, n >>> 24] : [n >>> 24, (n >> 16) & 255, (n >> 8) & 255, n & 255])+ tiff.push(...(le ? [0x49, 0x49] : [0x4d, 0x4d]), ...u16(42), ...u32(8))+ // IFD0 at 8: one entry, the Exif IFD pointer -> 26+ tiff.push(...u16(1), ...u16(0x8769), ...u16(4), ...u32(1), ...u32(26), ...u32(0))+ // Exif IFD at 26: one entry, DateTimeOriginal (ASCII, 20 bytes) at 44+ tiff.push(...u16(1), ...u16(tagId), ...u16(2), ...u32(20), ...u32(44), ...u32(0))+ tiff.push(...[...date].map(c => c.charCodeAt(0)), 0)+ const app1 = [0x45, 0x78, 0x69, 0x66, 0, 0, ...tiff]+ const len = app1.length + 2+ return new Uint8Array([0xff, 0xd8, ...extra, 0xff, 0xe1, len >> 8, len & 255, ...app1, 0xff, 0xda, 0, 2])+}++describe('exifDateOf', () => {+ it('reads DateTimeOriginal, in either byte order', () => {+ expect(exifDateOf(jpeg())).toBe('2026-09-14')+ expect(exifDateOf(jpeg({ le: false }))).toBe('2026-09-14')+ })+ it('steps over other segments before it', () => {+ const app0 = [0xff, 0xe0, 0, 6, 0x4a, 0x46, 0x49, 0x46] // a JFIF stub+ expect(exifDateOf(jpeg({ extra: app0 }))).toBe('2026-09-14')+ })+ it('falls back to DateTimeDigitized', () => {+ expect(exifDateOf(jpeg({ tagId: 0x9004 }))).toBe('2026-09-14')+ })+ it('null for anything it cannot read: no JPEG, no EXIF, a blank or silly date, cut-off bytes', () => {+ expect(exifDateOf(new Uint8Array([0x89, 0x50, 0x4e, 0x47]))).toBeNull()+ expect(exifDateOf(new Uint8Array([0xff, 0xd8, 0xff, 0xda, 0, 2]))).toBeNull()+ expect(exifDateOf(jpeg({ date: ' : : : : ' }))).toBeNull()+ expect(exifDateOf(jpeg({ date: '1970:01:01 00:00:00' }))).toBeNull()+ expect(exifDateOf(jpeg().slice(0, 30))).toBeNull()+ expect(exifDateOf(undefined)).toBeNull()+ })+ it('from a File, and quietly null for no file', async () => {+ expect(await exifDateOfFile(new Blob([jpeg()]))).toBe('2026-09-14')+ expect(await exifDateOfFile(null)).toBeNull()+ })+})diff --git a/frontend/src/lib/media-refs.js b/frontend/src/lib/media-refs.jsindex 2658ffac7..441263b72 100644--- a/frontend/src/lib/media-refs.js+++ b/frontend/src/lib/media-refs.js@@ -129,6 +129,8 @@ export function stateMediaRefs(state) {if (!isObj(w) || !Array.isArray(w.media)) continuefor (const m of w.media) if (isObj(m)) out.push(m)}+ // Progress photos filed under a day rather than a workout (lib/day-photos.js, #557).+ if (isObj(state.dayPhotos)) for (const e of Object.values(state.dayPhotos)) if (isObj(e) && isObj(e.m)) out.push(e.m)return out}diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.jsindex 16bb70042..d362c59b7 100644--- a/frontend/src/lib/pt-br-locale.test.js+++ b/frontend/src/lib/pt-br-locale.test.js@@ -41,7 +41,7 @@ describe('Brazilian Portuguese locale', () => {// has to be taught is a number nobody reads. What the numbers stood for is asserted above.// If the hash fails, review the changed keys and wording before accepting a new one. From// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('8b771eb52db6f0db4147399afbdbd62256c6367170842632e0fc40402e818082')+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('ee5ed544a148de826ac8ccce2f1d2adca04175f0dd4905275a5caa543e3af9a8')})// pt-PT labelled Unpair 'Desfazer': Undo, in Portuguese (it is pt-BR's Undo), on the button thatdiff --git a/frontend/src/lib/sync-merge.js b/frontend/src/lib/sync-merge.jsindex dcdf8acf2..ffe0664eb 100644--- a/frontend/src/lib/sync-merge.js+++ b/frontend/src/lib/sync-merge.js@@ -36,7 +36,7 @@* is the exception: the edit may have taken away the set the kept weight came from, so it* is the best of the merged history and of the editing copy's own, and the other copy's* can no longer bring a corrected typo back. exNotes, barWeights: key union- * - balanceOverrides, loadKind, plates, dbLoad, dumbbells, dayNotes: key union; of a key both+ * - balanceOverrides, loadKind, plates, dbLoad, dumbbells, dayNotes, dayPhotos: key union; of a key both* have, the entry set last by its own `_ts`, a clear included (mergeStampedMap), the newer* copy's on a tie. For plates and dumbbells the key is the unit, so the inventory of one unit* is kept whole, as last edited; for dayNotes the key is the date, so each day's note is its own@@ -83,7 +83,8 @@ const clone = o => JSON.parse(JSON.stringify(o))const list = v => (Array.isArray(v) ? v : [])// The maps whose every entry carries its own edit time (mergeStampedMap). dayNotes is a day's// note on a day off (lib/day-notes.js), one entry per date.-export const STAMPED_MAPS = ['balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells', 'dayNotes']+// dayPhotos is a progress photo filed under a day (lib/day-photos.js), one entry per photo.+export const STAMPED_MAPS = ['balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells', 'dayNotes', 'dayPhotos']/** The copy with the later `_ts`; on a tie the first argument (callers pass local first). */export const newerOf = (a, b) => ((b?._ts || 0) > (a?._ts || 0) ? b : a)@@ -612,7 +613,7 @@ function applyDeletions(S, deleted) {const OWN_MERGE = new Set(['_ts', '_rev', '_wid', '_wids', '_unstamped', '_prior', 'active', 'unit', 'unitSet', 'resetAt', 'resetIds', 'deleted', 'edited', 'undone', 'routineOrder','workouts', 'routines', 'customEx', 'equipProfiles', 'gymCards', 'bodyweight', 'measurements', 'favEx',- 'exWeights', 'balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells', 'dayNotes',+ 'exWeights', 'balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells', 'dayNotes', 'dayPhotos',])// Stamped per key instead of whole: one day of the plan, one exercise's note or bar.const PER_KEY = new Set(['week', 'dayPlan', 'exNotes', 'barWeights'])diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex ff90b8427..9212bf0ef 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -2361,4 +2361,20 @@ export default {'Rest between sides': 'الاستراحة بين الجانبين','Rest between warm-ups': 'الاستراحة بين مجموعات الإحماء','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'مجموعات الإحماء خفيفة، فيمكن أن تكون استراحتها أقصر أو بلا استراحة. آخرها يحصل على الاستراحة الكاملة قبل أول مجموعة عمل.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'إضافة صور',+ 'Each photo goes on the day it was taken.': 'كل صورة تذهب إلى اليوم الذي التُقطت فيه.',+ 'No progress photos yet. Add one for today or any day before.': 'لا صور تقدّم بعد. أضف واحدة لليوم أو لأي يوم سابق.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'تقول الصورة إنها التُقطت في {0}. غيّر اليوم إن كان يومًا آخر.',+ 'They all go on the day below.': 'كلها تذهب إلى اليوم أدناه.',+ 'Which day is this photo from?': 'من أي يوم هذه الصورة؟',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'خادمك يحتفظ بالصور فقط في أيام التمرين. التحديث يتيح له الاحتفاظ بها لأي يوم.',+ 'Add {0} photo': 'إضافة {0} صورة',+ 'Add {0} photos': 'إضافة {0} صور',+ '{0} photo added': 'تمت إضافة {0} صورة',+ '{0} photos added': 'تمت إضافة {0} صور',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} صورة تعرف يومها وتذهب إليه. البقية تذهب إلى اليوم أدناه.',+ '{0} photos know their day and go there. The others go on the day below.': '{0} صور تعرف يومها وتذهب إليه. البقية تذهب إلى اليوم أدناه.',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'كل صور التقدّم مرتبة حسب التاريخ، لأي يوم. ومعها شريط مقارنة قبل وبعد.',}diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.jsindex 002fffe7e..73669a4b3 100644--- a/frontend/src/locales/bn.js+++ b/frontend/src/locales/bn.js@@ -2385,4 +2385,20 @@ export default {'Rest between sides': 'দুই দিকের মাঝে বিশ্রাম','Rest between warm-ups': 'ওয়ার্ম-আপের মাঝে বিশ্রাম','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'ওয়ার্ম-আপ হালকা, তাই বিশ্রাম কম বা একেবারেই না হলেও চলে। শেষটি প্রথম কাজের সেটের আগে পুরো বিশ্রাম পায়।',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'ছবি যোগ করুন',+ 'Each photo goes on the day it was taken.': 'প্রতিটি ছবি সেই দিনে যাবে যেদিন তোলা হয়েছিল।',+ 'No progress photos yet. Add one for today or any day before.': 'এখনও কোনো অগ্রগতির ছবি নেই। আজকের বা আগের যেকোনো দিনের জন্য একটি যোগ করুন।',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'ছবি বলছে এটি {0} তারিখে তোলা। অন্য দিন হলে দিনটি বদলে নিন।',+ 'They all go on the day below.': 'সবগুলো নিচের দিনে যাবে।',+ 'Which day is this photo from?': 'এই ছবি কোন দিনের?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'আপনার সার্ভার শুধু ওয়ার্কআউটের দিনে ছবি রাখে। আপডেট করলে যেকোনো দিনের জন্য রাখতে পারবে।',+ 'Add {0} photo': '{0}টি ছবি যোগ করুন',+ 'Add {0} photos': '{0}টি ছবি যোগ করুন',+ '{0} photo added': '{0}টি ছবি যোগ হয়েছে',+ '{0} photos added': '{0}টি ছবি যোগ হয়েছে',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0}টি ছবি তার দিন জানে আর সেখানে যাবে। বাকিগুলো নিচের দিনে যাবে।',+ '{0} photos know their day and go there. The others go on the day below.': '{0}টি ছবি তাদের দিন জানে আর সেখানে যাবে। বাকিগুলো নিচের দিনে যাবে।',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'সব অগ্রগতির ছবি তারিখ অনুযায়ী সাজানো, যেকোনো দিনের। সঙ্গে আগে/পরে তুলনার স্লাইডার।',}diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex fa1ef708c..1cd094888 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -2326,4 +2326,20 @@ export default {'Rest between sides': 'Pause zwischen den Seiten','Rest between warm-ups': 'Pause zwischen Aufwärmsätzen','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Aufwärmsätze sind leicht, da reicht weniger Pause oder gar keine. Der letzte bekommt trotzdem die volle Pause vor dem ersten Arbeitssatz.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'Fotos hinzufügen',+ 'Each photo goes on the day it was taken.': 'Jedes Foto landet an dem Tag, an dem es gemacht wurde.',+ 'No progress photos yet. Add one for today or any day before.': 'Noch keine Fortschrittsfotos. Füg eins für heute oder einen früheren Tag hinzu.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'Laut Foto wurde es am {0} gemacht. Ändere den Tag, falls es ein anderer war.',+ 'They all go on the day below.': 'Alle landen am Tag unten.',+ 'Which day is this photo from?': 'Von welchem Tag ist dieses Foto?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'Dein Server behält Fotos nur an Tagen mit Training. Mit einem Update behält er sie für jeden Tag.',+ 'Add {0} photo': '{0} Foto hinzufügen',+ 'Add {0} photos': '{0} Fotos hinzufügen',+ '{0} photo added': '{0} Foto hinzugefügt',+ '{0} photos added': '{0} Fotos hinzugefügt',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} Foto kennt seinen Tag und landet dort. Die anderen landen am Tag unten.',+ '{0} photos know their day and go there. The others go on the day below.': '{0} Fotos kennen ihren Tag und landen dort. Die anderen landen am Tag unten.',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Alle Fortschrittsfotos nach Datum, für jeden Tag. Dazu ein Vorher-nachher-Regler.',}diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex fa6e6366e..4ff6c6a1a 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -2306,4 +2306,20 @@ export default {'Rest between sides': 'Descanso entre lados','Rest between warm-ups': 'Descanso entre calentamientos','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'El calentamiento es ligero, así que puede descansar menos o nada. El último sigue teniendo el descanso completo antes de tu primera serie de trabajo.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'Añadir fotos',+ 'Each photo goes on the day it was taken.': 'Cada foto va al día en que se tomó.',+ 'No progress photos yet. Add one for today or any day before.': 'Aún no hay fotos de progreso. Añade una para hoy o para cualquier día anterior.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'La foto dice que se tomó el {0}. Cambia el día si fue otro.',+ 'They all go on the day below.': 'Todas van al día de abajo.',+ 'Which day is this photo from?': '¿De qué día es esta foto?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'Tu servidor solo guarda fotos en días con entrenamiento. Una actualización le permite guardarlas para cualquier día.',+ 'Add {0} photo': 'Añadir {0} foto',+ 'Add {0} photos': 'Añadir {0} fotos',+ '{0} photo added': '{0} foto añadida',+ '{0} photos added': '{0} fotos añadidas',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} foto sabe su día y va allí. Las demás van al día de abajo.',+ '{0} photos know their day and go there. The others go on the day below.': '{0} fotos saben su día y van allí. Las demás van al día de abajo.',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Todas tus fotos de progreso por fecha, de cualquier día. Y un deslizador de antes y después.',}diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 3ffef6495..8228e96ca 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -2306,4 +2306,20 @@ export default {'Rest between sides': 'Repos entre les côtés','Rest between warm-ups': 'Repos entre les échauffements','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'L’échauffement est léger, il peut donc se reposer moins, voire pas du tout. Le dernier garde le repos complet avant ta première série de travail.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'Ajouter des photos',+ 'Each photo goes on the day it was taken.': 'Chaque photo va au jour où elle a été prise.',+ 'No progress photos yet. Add one for today or any day before.': 'Pas encore de photos de progression. Ajoute-en une pour aujourd’hui ou un jour d’avant.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'D’après la photo, elle a été prise le {0}. Change le jour si c’était un autre.',+ 'They all go on the day below.': 'Elles vont toutes au jour ci-dessous.',+ 'Which day is this photo from?': 'De quel jour est cette photo ?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'Ton serveur ne garde les photos que les jours avec une séance. Une mise à jour lui permet de les garder pour n’importe quel jour.',+ 'Add {0} photo': 'Ajouter {0} photo',+ 'Add {0} photos': 'Ajouter {0} photos',+ '{0} photo added': '{0} photo ajoutée',+ '{0} photos added': '{0} photos ajoutées',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} photo connaît son jour et y va. Les autres vont au jour ci-dessous.',+ '{0} photos know their day and go there. The others go on the day below.': '{0} photos connaissent leur jour et y vont. Les autres vont au jour ci-dessous.',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Toutes tes photos de progression par date, pour n’importe quel jour. Avec un curseur avant/après.',}diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 39a3d570b..09d90e7c4 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -2306,4 +2306,20 @@ export default {'Rest between sides': 'दोनों तरफ़ के बीच आराम','Rest between warm-ups': 'वॉर्म-अप के बीच आराम','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'वॉर्म-अप हल्के होते हैं, इसलिए आराम कम या बिल्कुल नहीं भी चलेगा। आख़िरी वॉर्म-अप को पहले वर्क सेट से पहले पूरा आराम मिलता है।',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'फ़ोटो जोड़ें',+ 'Each photo goes on the day it was taken.': 'हर फ़ोटो उसी दिन पर जाएगी जिस दिन ली गई थी।',+ 'No progress photos yet. Add one for today or any day before.': 'अभी कोई प्रोग्रेस फ़ोटो नहीं। आज या किसी पिछले दिन के लिए एक जोड़ें।',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'फ़ोटो के मुताबिक यह {0} को ली गई थी। कोई और दिन था तो दिन बदल दें।',+ 'They all go on the day below.': 'सभी नीचे वाले दिन पर जाएँगी।',+ 'Which day is this photo from?': 'यह फ़ोटो किस दिन की है?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'आपका सर्वर सिर्फ़ वर्कआउट वाले दिनों पर फ़ोटो रखता है। अपडेट के बाद वह किसी भी दिन के लिए रख पाएगा।',+ 'Add {0} photo': '{0} फ़ोटो जोड़ें',+ 'Add {0} photos': '{0} फ़ोटो जोड़ें',+ '{0} photo added': '{0} फ़ोटो जोड़ी गई',+ '{0} photos added': '{0} फ़ोटो जोड़ी गईं',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} फ़ोटो अपना दिन जानती है और वहीं जाएगी। बाकी नीचे वाले दिन पर जाएँगी।',+ '{0} photos know their day and go there. The others go on the day below.': '{0} फ़ोटो अपना दिन जानती हैं और वहीं जाएँगी। बाकी नीचे वाले दिन पर जाएँगी।',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'हर प्रोग्रेस फ़ोटो तारीख़ के क्रम में, किसी भी दिन की। साथ में पहले/बाद का स्लाइडर।',}diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex f8c281a04..422126426 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -2309,4 +2309,20 @@ export default {'Rest between sides': 'Pihenő az oldalak között','Rest between warm-ups': 'Pihenő a bemelegítő sorozatok között','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'A bemelegítés könnyű, így kevesebb pihenő is elég, vagy semmi. Az utolsó így is megkapja a teljes pihenőt az első munkasorozat előtt.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'Fotók hozzáadása',+ 'Each photo goes on the day it was taken.': 'Minden fotó arra a napra kerül, amikor készült.',+ 'No progress photos yet. Add one for today or any day before.': 'Még nincs fejlődési fotó. Adj hozzá egyet mára vagy egy korábbi napra.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'A fotó szerint {0} napon készült. Változtasd meg a napot, ha más volt.',+ 'They all go on the day below.': 'Mind a lenti napra kerül.',+ 'Which day is this photo from?': 'Melyik napról van ez a fotó?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'A szervered csak edzésnapokon tartja meg a fotókat. Egy frissítéssel bármelyik napra megtartja őket.',+ 'Add {0} photo': '{0} fotó hozzáadása',+ 'Add {0} photos': '{0} fotó hozzáadása',+ '{0} photo added': '{0} fotó hozzáadva',+ '{0} photos added': '{0} fotó hozzáadva',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} fotó tudja a napját, és oda kerül. A többi a lenti napra kerül.',+ '{0} photos know their day and go there. The others go on the day below.': '{0} fotó tudja a napját, és oda kerül. A többi a lenti napra kerül.',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Minden fejlődési fotó dátum szerint, bármelyik napról. Plusz egy előtte/utána csúszka.',}diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 46c6d0a69..508bff4ae 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -2306,4 +2306,20 @@ export default {'Rest between sides': 'Recupero tra i lati','Rest between warm-ups': 'Recupero tra i riscaldamenti','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Il riscaldamento è leggero, quindi può recuperare meno o per niente. L’ultimo ha comunque il recupero pieno prima della prima serie allenante.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'Aggiungi foto',+ 'Each photo goes on the day it was taken.': 'Ogni foto va nel giorno in cui è stata scattata.',+ 'No progress photos yet. Add one for today or any day before.': 'Ancora nessuna foto dei progressi. Aggiungine una per oggi o per un giorno prima.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'Dalla foto risulta scattata il {0}. Cambia il giorno se era un altro.',+ 'They all go on the day below.': 'Vanno tutte nel giorno qui sotto.',+ 'Which day is this photo from?': 'Di che giorno è questa foto?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'Il tuo server tiene le foto solo nei giorni con un allenamento. Un aggiornamento gli permette di tenerle per qualsiasi giorno.',+ 'Add {0} photo': 'Aggiungi {0} foto',+ 'Add {0} photos': 'Aggiungi {0} foto',+ '{0} photo added': '{0} foto aggiunta',+ '{0} photos added': '{0} foto aggiunte',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} foto conosce il suo giorno e va lì. Le altre vanno nel giorno qui sotto.',+ '{0} photos know their day and go there. The others go on the day below.': '{0} foto conoscono il loro giorno e vanno lì. Le altre vanno nel giorno qui sotto.',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Tutte le foto dei progressi in ordine di data, di qualsiasi giorno. Più uno slider prima/dopo.',}diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex fd1dfec05..e971a04cf 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -2306,4 +2306,20 @@ export default {'Rest between sides': '좌우 사이 휴식','Rest between warm-ups': '워밍업 세트 사이 휴식','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': '워밍업은 가벼우니 짧게 쉬거나 안 쉬어도 돼요. 마지막 워밍업 뒤에는 첫 본 세트 전에 원래 휴식을 다 줘요.',+ // --- progress photos for any day (#557) ---+ 'Add photos': '사진 추가',+ 'Each photo goes on the day it was taken.': '사진마다 찍은 날로 들어가요.',+ 'No progress photos yet. Add one for today or any day before.': '아직 진행 사진이 없어요. 오늘이나 지난 날짜로 하나 추가해 보세요.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': '사진에는 {0}에 찍었다고 나와요. 다른 날이었다면 날짜를 바꾸세요.',+ 'They all go on the day below.': '모두 아래 날짜로 들어가요.',+ 'Which day is this photo from?': '이 사진은 어느 날 사진인가요?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': '서버가 운동한 날에만 사진을 보관해요. 업데이트하면 어느 날이든 보관할 수 있어요.',+ 'Add {0} photo': '사진 {0}장 추가',+ 'Add {0} photos': '사진 {0}장 추가',+ '{0} photo added': '사진 {0}장을 추가했어요',+ '{0} photos added': '사진 {0}장을 추가했어요',+ '{0} photo knows its day and goes there. The others go on the day below.': '사진 {0}장은 찍은 날을 알아서 그날로 들어가요. 나머지는 아래 날짜로 들어가요.',+ '{0} photos know their day and go there. The others go on the day below.': '사진 {0}장은 찍은 날을 알아서 그날로 들어가요. 나머지는 아래 날짜로 들어가요.',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': '모든 진행 사진을 날짜순으로, 어느 날이든. 비포/애프터 슬라이더도 있어요.',}diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 3e1464b3a..c2bba3314 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -2306,4 +2306,20 @@ export default {'Rest between sides': 'Przerwa między stronami','Rest between warm-ups': 'Przerwa między seriami rozgrzewkowymi','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Rozgrzewka jest lekka, więc może mieć krótszą przerwę albo żadną. Ostatnia i tak dostaje pełną przerwę przed pierwszą serią roboczą.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'Dodaj zdjęcia',+ 'Each photo goes on the day it was taken.': 'Każde zdjęcie trafia na dzień, w którym zostało zrobione.',+ 'No progress photos yet. Add one for today or any day before.': 'Nie ma jeszcze zdjęć postępów. Dodaj jedno na dziś albo na wcześniejszy dzień.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'Według zdjęcia zrobiono je {0}. Zmień dzień, jeśli to był inny.',+ 'They all go on the day below.': 'Wszystkie trafią na dzień poniżej.',+ 'Which day is this photo from?': 'Z którego dnia jest to zdjęcie?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'Twój serwer trzyma zdjęcia tylko w dni z treningiem. Aktualizacja pozwoli mu trzymać je na każdy dzień.',+ 'Add {0} photo': 'Dodaj {0} zdjęcie',+ 'Add {0} photos': { one: 'Dodaj {0} zdjęcie', few: 'Dodaj {0} zdjęcia', many: 'Dodaj {0} zdjęć' },+ '{0} photo added': 'Dodano {0} zdjęcie',+ '{0} photos added': { one: 'Dodano {0} zdjęcie', few: 'Dodano {0} zdjęcia', many: 'Dodano {0} zdjęć' },+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} zdjęcie zna swój dzień i tam trafi. Pozostałe trafią na dzień poniżej.',+ '{0} photos know their day and go there. The others go on the day below.': { one: '{0} zdjęcie zna swój dzień i tam trafi. Pozostałe trafią na dzień poniżej.', few: '{0} zdjęcia znają swój dzień i tam trafią. Pozostałe trafią na dzień poniżej.', many: '{0} zdjęć zna swój dzień i tam trafi. Pozostałe trafią na dzień poniżej.' },+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Wszystkie zdjęcia postępów według daty, z dowolnego dnia. Do tego suwak przed/po.',}diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex 7e70b64eb..db0c54b08 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -1459,6 +1459,13 @@ export const PT_BR_OVERRIDES = {// --- set-specific rest ---'No timer': 'Sem cronômetro','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'O aquecimento é leve, então pode descansar menos ou nada. O último continua tendo o descanso completo antes da sua primeira série de trabalho.',+ // --- progress photos for any day (#557) ---+ 'No progress photos yet. Add one for today or any day before.': 'Ainda não há fotos de progresso. Adicione uma para hoje ou para um dia anterior.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'A foto diz que foi tirada em {0}. Mude o dia se foi outro.',+ 'They all go on the day below.': 'Todas vão para o dia abaixo.',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'Seu servidor só guarda fotos em dias com treino. Uma atualização permite guardá-las para qualquer dia.',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Todas as fotos de progresso por data, de qualquer dia. E um controle deslizante de antes/depois.',}export default { ...pt, ...PT_BR_OVERRIDES }diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 68cbfc06b..c504e8085 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -2306,4 +2306,20 @@ export default {'Rest between sides': 'Descanso entre lados','Rest between warm-ups': 'Descanso entre aquecimentos','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'O aquecimento é leve, por isso pode descansar menos ou nada. O último continua a ter o descanso completo antes da tua primeira série de trabalho.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'Adicionar fotos',+ 'Each photo goes on the day it was taken.': 'Cada foto vai para o dia em que foi tirada.',+ 'No progress photos yet. Add one for today or any day before.': 'Ainda não há fotos de progresso. Adiciona uma para hoje ou para um dia anterior.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'A foto diz que foi tirada a {0}. Muda o dia se foi outro.',+ 'They all go on the day below.': 'Vão todas para o dia abaixo.',+ 'Which day is this photo from?': 'De que dia é esta foto?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'O teu servidor só guarda fotos em dias com treino. Uma atualização deixa-o guardá-las para qualquer dia.',+ 'Add {0} photo': 'Adicionar {0} foto',+ 'Add {0} photos': 'Adicionar {0} fotos',+ '{0} photo added': '{0} foto adicionada',+ '{0} photos added': '{0} fotos adicionadas',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} foto sabe o seu dia e vai para lá. As outras vão para o dia abaixo.',+ '{0} photos know their day and go there. The others go on the day below.': '{0} fotos sabem o seu dia e vão para lá. As outras vão para o dia abaixo.',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Todas as fotos de progresso por data, de qualquer dia. E um deslizador antes/depois.',}diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 30e8fbf8d..1e27d10de 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -2310,4 +2310,20 @@ export default {'Rest between sides': 'Отдых между сторонами','Rest between warm-ups': 'Отдых между разминочными подходами','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Разминка лёгкая, так что отдыхать можно меньше или вовсе нет. После последней разминки всё равно будет полный отдых перед первым рабочим подходом.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'Добавить фото',+ 'Each photo goes on the day it was taken.': 'Каждое фото попадёт в день, когда оно сделано.',+ 'No progress photos yet. Add one for today or any day before.': 'Пока нет фото прогресса. Добавьте одно на сегодня или на любой прошлый день.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'Судя по фото, оно сделано {0}. Измените день, если это был другой.',+ 'They all go on the day below.': 'Все попадут в день ниже.',+ 'Which day is this photo from?': 'Из какого дня это фото?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'Ваш сервер хранит фото только в дни с тренировкой. После обновления он сможет хранить их для любого дня.',+ 'Add {0} photo': 'Добавить {0} фото',+ 'Add {0} photos': { one: 'Добавить {0} фото', few: 'Добавить {0} фото', many: 'Добавить {0} фото' },+ '{0} photo added': 'Добавлено {0} фото',+ '{0} photos added': { one: 'Добавлено {0} фото', few: 'Добавлено {0} фото', many: 'Добавлено {0} фото' },+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} фото знает свой день и попадёт туда. Остальные попадут в день ниже.',+ '{0} photos know their day and go there. The others go on the day below.': { one: '{0} фото знает свой день и попадёт туда. Остальные попадут в день ниже.', few: '{0} фото знают свой день и попадут туда. Остальные попадут в день ниже.', many: '{0} фото знают свой день и попадут туда. Остальные попадут в день ниже.' },+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Все фото прогресса по датам, за любой день. И ползунок «до и после».',}diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex fc84461c7..e5afb6e80 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -2317,4 +2317,20 @@ export default {'Rest between sides': 'พักระหว่างสองข้าง','Rest between warm-ups': 'พักระหว่างเซ็ตวอร์มอัพ','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'เซ็ตวอร์มอัพเบา จึงพักน้อยลงหรือไม่พักเลยก็ได้ เซ็ตสุดท้ายยังได้พักเต็มก่อนเซ็ตหลักแรก',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'เพิ่มรูป',+ 'Each photo goes on the day it was taken.': 'แต่ละรูปจะไปอยู่ในวันที่ถ่าย',+ 'No progress photos yet. Add one for today or any day before.': 'ยังไม่มีรูปความก้าวหน้า เพิ่มสักรูปสำหรับวันนี้หรือวันก่อนหน้า',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'รูปบอกว่าถ่ายเมื่อ {0} เปลี่ยนวันได้ถ้าเป็นวันอื่น',+ 'They all go on the day below.': 'ทั้งหมดจะไปอยู่ในวันด้านล่าง',+ 'Which day is this photo from?': 'รูปนี้มาจากวันไหน',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'เซิร์ฟเวอร์ของคุณเก็บรูปเฉพาะวันที่มีการออกกำลังกาย อัปเดตแล้วจะเก็บได้ทุกวัน',+ 'Add {0} photo': 'เพิ่ม {0} รูป',+ 'Add {0} photos': 'เพิ่ม {0} รูป',+ '{0} photo added': 'เพิ่มแล้ว {0} รูป',+ '{0} photos added': 'เพิ่มแล้ว {0} รูป',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} รูปรู้วันของตัวเองและจะไปอยู่ที่นั่น ที่เหลือไปอยู่ในวันด้านล่าง',+ '{0} photos know their day and go there. The others go on the day below.': '{0} รูปรู้วันของตัวเองและจะไปอยู่ที่นั่น ที่เหลือไปอยู่ในวันด้านล่าง',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'รูปความก้าวหน้าทุกรูปเรียงตามวันที่ วันไหนก็ได้ พร้อมแถบเลื่อนเปรียบเทียบก่อน/หลัง',}diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 7eea90013..22ee68da9 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -2306,4 +2306,20 @@ export default {'Rest between sides': 'Taraflar arası dinlenme','Rest between warm-ups': 'Isınma setleri arası dinlenme','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Isınma setleri hafif, o yüzden daha az ya da hiç dinlenmeyebilir. Sonuncusu yine de ilk çalışma setinden önce tam dinlenmeyi alır.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'Fotoğraf ekle',+ 'Each photo goes on the day it was taken.': 'Her fotoğraf çekildiği güne gider.',+ 'No progress photos yet. Add one for today or any day before.': 'Henüz ilerleme fotoğrafı yok. Bugün ya da önceki bir gün için bir tane ekle.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'Fotoğrafa göre {0} tarihinde çekilmiş. Başka bir günse günü değiştir.',+ 'They all go on the day below.': 'Hepsi aşağıdaki güne gider.',+ 'Which day is this photo from?': 'Bu fotoğraf hangi günden?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'Sunucun fotoğrafları yalnızca antrenman olan günlerde saklıyor. Bir güncellemeyle her gün için saklayabilir.',+ 'Add {0} photo': '{0} fotoğraf ekle',+ 'Add {0} photos': '{0} fotoğraf ekle',+ '{0} photo added': '{0} fotoğraf eklendi',+ '{0} photos added': '{0} fotoğraf eklendi',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} fotoğraf gününü biliyor ve oraya gidiyor. Diğerleri aşağıdaki güne gider.',+ '{0} photos know their day and go there. The others go on the day below.': '{0} fotoğraf gününü biliyor ve oraya gidiyor. Diğerleri aşağıdaki güne gider.',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Tüm ilerleme fotoğrafların tarihe göre, herhangi bir gün için. Bir de önce/sonra kaydırıcısı.',}diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex f2db4d826..9a0ed482d 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -2303,4 +2303,20 @@ export default {'Rest between sides': 'Відпочинок між боками','Rest between warm-ups': 'Відпочинок між розминковими підходами','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Розминка легка, тож відпочивати можна менше або зовсім ні. Після останньої розминки все одно буде повний відпочинок перед першим робочим підходом.',+ // --- progress photos for any day (#557) ---+ 'Add photos': 'Додати фото',+ 'Each photo goes on the day it was taken.': 'Кожне фото потрапить у день, коли його зроблено.',+ 'No progress photos yet. Add one for today or any day before.': 'Поки немає фото прогресу. Додайте одне на сьогодні або на будь-який попередній день.',+ 'The photo says it was taken on {0}. Change the day if it was another one.': 'Судячи з фото, його зроблено {0}. Змініть день, якщо це був інший.',+ 'They all go on the day below.': 'Усі потраплять у день нижче.',+ 'Which day is this photo from?': 'З якого дня це фото?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': 'Ваш сервер зберігає фото лише в дні з тренуванням. Після оновлення він зможе зберігати їх для будь-якого дня.',+ 'Add {0} photo': 'Додати {0} фото',+ 'Add {0} photos': { one: 'Додати {0} фото', few: 'Додати {0} фото', many: 'Додати {0} фото' },+ '{0} photo added': 'Додано {0} фото',+ '{0} photos added': { one: 'Додано {0} фото', few: 'Додано {0} фото', many: 'Додано {0} фото' },+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} фото знає свій день і потрапить туди. Решта потраплять у день нижче.',+ '{0} photos know their day and go there. The others go on the day below.': { one: '{0} фото знає свій день і потрапить туди. Решта потраплять у день нижче.', few: '{0} фото знають свій день і потраплять туди. Решта потраплять у день нижче.', many: '{0} фото знають свій день і потраплять туди. Решта потраплять у день нижче.' },+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': 'Усі фото прогресу за датами, за будь-який день. І повзунок «до і після».',}diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex c8b57514e..d07d63b74 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -2299,4 +2299,20 @@ export default {'Rest between sides': '兩側之間的休息','Rest between warm-ups': '熱身組之間的休息','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': '熱身組較輕,可以少休息或不休息。最後一個熱身組在第一個正式組前仍會得到完整的休息。',+ // --- progress photos for any day (#557) ---+ 'Add photos': '新增相片',+ 'Each photo goes on the day it was taken.': '每張相片都會放到拍攝當天。',+ 'No progress photos yet. Add one for today or any day before.': '還沒有進度相片。為今天或之前的某一天新增一張吧。',+ 'The photo says it was taken on {0}. Change the day if it was another one.': '相片顯示拍攝於 {0}。如果是別的日子,改一下日期。',+ 'They all go on the day below.': '全部放到下面的日期。',+ 'Which day is this photo from?': '這張相片是哪一天的?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': '你的伺服器只在有訓練的日子保留相片。更新後可以保留任何一天的相片。',+ 'Add {0} photo': '新增 {0} 張相片',+ 'Add {0} photos': '新增 {0} 張相片',+ '{0} photo added': '已新增 {0} 張相片',+ '{0} photos added': '已新增 {0} 張相片',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} 張相片知道自己的日期,會放到那天。其餘的放到下面的日期。',+ '{0} photos know their day and go there. The others go on the day below.': '{0} 張相片知道自己的日期,會放到那天。其餘的放到下面的日期。',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': '所有進度相片按日期排列,任何一天都行。還有前後對比滑桿。',}diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex e032114b7..536205b79 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -2306,4 +2306,20 @@ export default {'Rest between sides': '两侧之间的休息','Rest between warm-ups': '热身组之间的休息','Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': '热身组较轻,可以少休息或不休息。最后一个热身组在第一个正式组前仍会得到完整的休息。',+ // --- progress photos for any day (#557) ---+ 'Add photos': '添加照片',+ 'Each photo goes on the day it was taken.': '每张照片都会放到拍摄当天。',+ 'No progress photos yet. Add one for today or any day before.': '还没有进度照片。为今天或之前的某一天添加一张吧。',+ 'The photo says it was taken on {0}. Change the day if it was another one.': '照片显示拍摄于 {0}。如果是别的日子,改一下日期。',+ 'They all go on the day below.': '全部放到下面的日期。',+ 'Which day is this photo from?': '这张照片是哪一天的?',+ 'Your server keeps photos only on days with a workout. An update lets it keep them for any day.': '你的服务器只在有训练的日子保留照片。更新后可以保留任何一天的照片。',+ 'Add {0} photo': '添加 {0} 张照片',+ 'Add {0} photos': '添加 {0} 张照片',+ '{0} photo added': '已添加 {0} 张照片',+ '{0} photos added': '已添加 {0} 张照片',+ '{0} photo knows its day and goes there. The others go on the day below.': '{0} 张照片知道自己的日期,会放到那天。其余的放到下面的日期。',+ '{0} photos know their day and go there. The others go on the day below.': '{0} 张照片知道自己的日期,会放到那天。其余的放到下面的日期。',+ // --- progress photos card ---+ 'Every progress photo, lined up by date, for any day. Plus a before/after slider.': '所有进度照片按日期排列,任何一天都行。还有前后对比滑块。',}diff --git a/frontend/src/views/ProgressPhotos.delete.test.jsx b/frontend/src/views/ProgressPhotos.delete.test.jsxindex ae8bcee9e..c26ac8be5 100644--- a/frontend/src/views/ProgressPhotos.delete.test.jsx+++ b/frontend/src/views/ProgressPhotos.delete.test.jsx@@ -1,10 +1,11 @@// @vitest-environment happy-domimport React, { act } from 'react'import { createRoot } from 'react-dom/client'-import { afterEach, beforeEach, describe, expect, it } from 'vitest'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import { useStore, DEF } from '../store/useStore.js'import { useUI } from '../store/useUI.js'-import { PhotoView, progressPhotosOf } from './ProgressPhotos.jsx'+import { PhotoView, progressPhotosOf, AddPhotosSheet } from './ProgressPhotos.jsx'+import { todayISO } from '../lib/format.js'globalThis.IS_REACT_ACT_ENVIRONMENT = true@@ -58,3 +59,42 @@ describe('removing a progress photo', () => {expect(useStore.getState().S.workouts).toEqual(before)})})++describe('photos filed under a day (#557)', () => {+ it('show in the gallery with the workout photos, and come off with Undo the same way', () => {+ useStore.setState({ S: { ...state(), dayPhotos: { [ref(7).hash]: { d: '2026-10-03', m: ref(7), _ts: 1 } } } })+ const photos = progressPhotosOf(useStore.getState().S)+ expect(photos.map(p => p.d)).toEqual(['2026-10-05', '2026-10-03', '2026-10-01', '2026-10-01', '2026-10-01'])+ const p = photos.find(x => x.day)+ act(() => root.render(<PhotoView p={p} close={() => {}} />))+ act(() => button('Remove').click())+ act(() => [...host.querySelectorAll('.mviewer-ask button')].find(b => b.textContent === 'Remove').click())+ expect(useStore.getState().S.dayPhotos[ref(7).hash]).toEqual({ _ts: expect.any(Number) })+ act(() => useUI.getState().runToastAction())+ expect(useStore.getState().S.dayPhotos[ref(7).hash]).toMatchObject({ d: '2026-10-03', m: ref(7) })+ expect(useStore.getState().S.workouts.map(w => w.media.length)).toEqual([3, 1])+ })+})++describe('adding photos for a day', () => {+ const item = exif => ({ file: new Blob(['x']), exif })+ it('one photo: the day it was taken, changeable; several: their own days, the rest on the picked one', async () => {+ const save = vi.fn(async () => {})+ act(() => root.render(<AddPhotosSheet items={[item('2026-09-14')]} close={() => {}} save={save} />))+ expect(host.querySelector('h3').textContent).toBe('Add 1 photo')+ expect(host.querySelector('input[type=date]').value).toBe('2026-09-14')+ expect(host.querySelector('input[type=date]').max).toBe(todayISO())+ await act(async () => { button('Add').click() })+ expect(save).toHaveBeenCalledWith([item('2026-09-14')], '2026-09-14')++ act(() => root.render(null))+ act(() => root.render(<AddPhotosSheet items={[item('2026-09-14'), item(null), item(null)]} close={() => {}} save={save} />))+ expect(host.textContent).toContain('1 photo knows its day and goes there. The others go on the day below.')+ expect(host.querySelector('input[type=date]').value).toBe(todayISO())+ act(() => root.render(null))+ act(() => root.render(<AddPhotosSheet items={[item('2026-09-14'), item('2026-09-15')]} close={() => {}} save={save} />))+ expect(host.querySelector('input[type=date]')).toBeNull()+ expect(host.textContent).toContain('Each photo goes on the day it was taken.')+ })+})+diff --git a/frontend/src/views/ProgressPhotos.jsx b/frontend/src/views/ProgressPhotos.jsxindex 874349cce..0bece7f19 100644--- a/frontend/src/views/ProgressPhotos.jsx+++ b/frontend/src/views/ProgressPhotos.jsx@@ -1,13 +1,12 @@-// Every progress photo across every logged workout, in one place, newest first — a quick way to-// add one to today, and a before/after comparison between any two.+// Every progress photo in one place, newest first: adding them, for today or an earlier day,+// several at once; removing one; and a before/after comparison between any two.//-// WorkoutMedia.jsx already lets a photo or video be attached to a finished workout — that is-// still the only place one is stored (addWorkoutMedia, a saved workout's own `media` list) and-// where one is removed. What this view adds is a shortcut for the common case (today's workout-// is already logged) straight onto the record WorkoutMedia.jsx would have written to anyway, plus-// lining every still up chronologically and a slider to compare two dates directly. Nothing new-// to store, sync or back up — one more way to reach and to look at data the media system already-// keeps, private to the account the same way everything else there is (DATA_DIR/uploads/<uid>/,+// A photo for a day with a logged workout goes onto that workout (addWorkoutMedia, the saved+// workout's own `media` list, the same place WorkoutMedia.jsx writes). One for a day without a+// workout, or past a workout's cap, is filed under the day instead (#557, lib/day-photos.js+// `dayPhotos`), where the server keeps those (media.days) or there is no server. The date is+// suggested by the photo's own EXIF date where it has one, else the day picked in the sheet.+// Both kinds are private to the account like every other photo (DATA_DIR/uploads/<uid>/,// api/media.js).import { useMemo, useRef, useState } from 'react'import { useNavigate } from 'react-router-dom'@@ -15,8 +14,10 @@ import { useStore } from '../store/useStore.js'import { useUI } from '../store/useUI.js'import { t, tn } from '../lib/i18n.js'import { fmtDate, todayISO } from '../lib/format.js'-import { workoutMediaOf, WORKOUT_MEDIA_MAX } from '../lib/media-refs.js'-import { addWorkoutMedia, removeWorkoutMedia, restoreWorkoutMedia } from '../lib/workout-media.js'+import { workoutMediaOf } from '../lib/media-refs.js'+import { removeWorkoutMedia, restoreWorkoutMedia } from '../lib/workout-media.js'+import { dayPhotosOf, removeDayPhoto, restoreDayPhoto, serverTakesDayPhotos, fileProgressPhoto } from '../lib/day-photos.js'+import { exifDateOfFile } from '../lib/exif-date.js'import { sameWorkout } from '../lib/workout-date.js'import { syncMedia } from '../lib/media-sync.js'import { useMediaPicker } from '../components/CustomMediaField.jsx'@@ -48,6 +49,8 @@ export function progressPhotosOf(S) {out.push({ key: (w.id || w.start || w.d) + ':' + m.hash, d: w.d, start: w.start || 0, w, m })}}+ // And the ones filed under a day (#557), after a day's workout photos.+ for (const p of dayPhotosOf(S)) out.push({ key: 'day:' + p.hash, d: p.d, start: 0, w: null, day: true, m: p.m })out.sort((a, b) => (a.d < b.d ? 1 : a.d > b.d ? -1 : b.start - a.start))return out}@@ -76,6 +79,17 @@ export function PhotoView({ p, close }) {const [asking, setAsking] = useState(false)const remove = () => {const st = useStore.getState()+ if (p.day) {+ const entry = st.S.dayPhotos?.[p.m.hash]+ let removed = false+ st.update(s => { removed = removeDayPhoto(s, p.m.hash) })+ close()+ if (removed) useUI.getState().toast(t('Photo removed'), {+ action: t('Undo'),+ onAction: () => useStore.getState().update(s => { restoreDayPhoto(s, p.m.hash, entry) }),+ })+ return+ }const rec = (st.S.workouts || []).find(w => w && sameWorkout(w, p.w)) || p.wconst at = Array.isArray(rec?.media) ? rec.media.findIndex(x => x && x.hash === p.m.hash) : -1const ref = at >= 0 ? rec.media[at] : p.m@@ -156,15 +170,50 @@ export function openProgressCompare(x, y) {useUI.getState().openSheet(close => <ProgressCompare a={a} b={b} close={close} />, { kind: 'viewer' })}+// How many photos one pick takes: each is read and re-encoded on the device, one after another.+const MAX_AT_ONCE = 20++/* The day the picked photos go under. One photo: its own EXIF date, or today, either changeable.+ Several: each with an EXIF date goes on that day, the rest on the day picked here. */+export function AddPhotosSheet({ items, close, save }) {+ const today = todayISO()+ const one = items.length === 1+ const own = items.filter(i => i.exif).length+ const [date, setDate] = useState((one && items[0].exif) || today)+ const [busy, setBusy] = useState(false)+ const ok = /^\d{4}-\d{2}-\d{2}$/.test(date) && date <= today+ const go = async () => {+ if (!ok || busy) return+ setBusy(true)+ try { await save(items, date) } finally { setBusy(false); close() }+ }+ return <>+ <h3>{tn('Add {0} photo', 'Add {0} photos', items.length)}</h3>+ <div className="muted small" style={{ marginBottom: 12 }}>+ {one+ ? (items[0].exif ? t('The photo says it was taken on {0}. Change the day if it was another one.', fmtDate(items[0].exif, true, true)) : t('Which day is this photo from?'))+ : own === items.length ? t('Each photo goes on the day it was taken.')+ : own ? tn('{0} photo knows its day and goes there. The others go on the day below.', '{0} photos know their day and go there. The others go on the day below.', own)+ : t('They all go on the day below.')}+ </div>+ {(one || own < items.length) && <label className="measure-date" style={{ display: 'block', marginBottom: 14 }}>+ <span className="small">{t('Date')}</span>+ <input className="field" type="date" value={date} max={today} onChange={e => setDate(e.target.value)} />+ </label>}+ <Button variant="primary" disabled={!ok || busy} onClick={go}>{busy ? t('Loading…') : t('Add')}</Button>+ <div style={{ height: 8 }} />+ <Button variant="ghost" className="dim" disabled={busy} onClick={close}>{t('Cancel')}</Button>+ </>+}+export default function ProgressPhotos() {const nav = useNavigate()const S = useStore(s => s.S)const update = useStore(s => s.update)- const photos = useMemo(() => progressPhotosOf(S), [S.workouts])+ const photos = useMemo(() => progressPhotosOf(S), [S.workouts, S.dayPhotos])const groups = useMemo(() => groupByDate(photos), [photos])const [comparing, setComparing] = useState(false)const [picked, setPicked] = useState([]) // up to 2 photo keys, in tap order- const today = todaysWorkout(S)const { pick, busy, canAdd, showAdd } = useMediaPicker()const fileRef = useRef(null)@@ -181,20 +230,35 @@ export default function ProgressPhotos() {cancelCompare()if (a && b) openProgressCompare(a, b)}- // Attaches straight onto today's already-logged workout — the file picker offers the camera- // on a phone the same way WorkoutMedia.jsx's does, since it is the very same input.- const onFile = async ev => {- const file = ev.target.files && ev.target.files[0]+ // Several photos at once (#557), each filed under the day it was taken where its EXIF says so,+ // else under the day picked in the sheet (today unless changed); see fileProgressPhoto.+ const user = useStore(s => s.user)+ const config = useStore(s => s.config)+ const canDay = serverTakesDayPhotos(user, config)+ const onFiles = async ev => {+ const files = [...(ev.target.files || [])].slice(0, MAX_AT_ONCE)ev.target.value = ''- if (!file || !today) return- if (workoutMediaOf(today).length >= WORKOUT_MEDIA_MAX) { toast(t('Up to {0} photos or videos per workout.', WORKOUT_MEDIA_MAX)); return }- const got = await pick(file)- if (!got) return- let res- update(s => { res = addWorkoutMedia(s, today, got) })- if (res === 'added') { toast(t('Photo added')); syncMedia({ force: true }) }- else if (res === 'full') toast(t('Up to {0} photos or videos per workout.', WORKOUT_MEDIA_MAX))- else if (res === 'gone') toast(t('Workout deleted'))+ if (!files.length) return+ const today = todayISO()+ const items = await Promise.all(files.map(async file => {+ const d = await exifDateOfFile(file)+ return { file, exif: d && d <= today ? d : null }+ }))+ useUI.getState().openSheet(close => <AddPhotosSheet items={items} close={close} save={save} />)+ }+ const save = async (items, picked) => {+ const n = { added: 0, noRoom: 0 }+ for (const it of items) {+ const got = await pick(it.file)+ if (!got) continue+ const d = items.length > 1 ? (it.exif || picked) : picked+ let res+ update(s => { res = fileProgressPhoto(s, d, got, { canDay }) })+ if (res === 'workout' || res === 'day') n.added+++ else if (res === 'no-room') n.noRoom+++ }+ if (n.added) { toast(tn('{0} photo added', '{0} photos added', n.added)); syncMedia({ force: true }) }+ if (n.noRoom) toast(t('Your server keeps photos only on days with a workout. An update lets it keep them for any day.'))}return <>@@ -207,12 +271,10 @@ export default function ProgressPhotos() {</div>{!comparing && showAdd && <div className="row" style={{ marginBottom: 16 }}>- {today- ? <Button icon={busy ? 'image' : 'camera'} disabled={!canAdd} onClick={() => fileRef.current?.click()}>- {busy ? t('Loading…') : t('Add a photo to today')}- </Button>- : <Button icon="dumbbell" onClick={() => nav('/workout')}>{t('Log today’s workout to add a photo')}</Button>}- <input ref={fileRef} type="file" accept="image/*" hidden onChange={onFile} />+ <Button icon={busy ? 'image' : 'camera'} disabled={!canAdd || busy} onClick={() => fileRef.current?.click()}>+ {busy ? t('Loading…') : t('Add photos')}+ </Button>+ <input ref={fileRef} type="file" accept="image/*" multiple hidden onChange={onFiles} /></div>}{comparing && <div className="small dim" style={{ margin: '0 0 12px' }}>@@ -221,7 +283,7 @@ export default function ProgressPhotos() {{!photos.length? <div className="empty"><div className="ico"><Icon name="image" /></div>- {t('No progress photos yet. The button above adds one to today, once today has a logged workout.')}+ {t('No progress photos yet. Add one for today or any day before.')}</div>: groups.map(g => (<div key={g.d} style={{ marginBottom: 18 }}>diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsxindex a61fee392..95607b554 100644--- a/frontend/src/views/Stats.jsx+++ b/frontend/src/views/Stats.jsx@@ -1,6 +1,7 @@import { useEffect, useMemo, useState } from 'react'import { useNavigate } from 'react-router-dom'import { useStore } from '../store/useStore.js'+import { dayPhotosOf } from '../lib/day-photos.js'import { EXIDX, matchExercise, betterWeight, isAssisted } from '../lib/exercises.js'import { lastBW, streakWeeks, setLabel, modeOf, effortOf, entriesForExercise, metricEntriesForExercise, metricModeForEntry, bestWeightForEntry, completedRepsOf, workoutDay, workoutAt } from '../lib/history.js'import { fmtNum, fmtDate, fmtVol, todayISO, isoOf, weekKey, weekStartOf, exerciseNameText } from '../lib/format.js'@@ -663,9 +664,9 @@ export default function Stats() {<div className="muted small" style={{ marginTop: 4 }}>{t('See which lift is holding back the rest.')}</div></div><Button size="sm" variant="tinted" trailingIcon="chevronRight" style={{ flexShrink: 0 }} onClick={() => nav('/structural-balance')}>{t('Open')}</Button></div>}- {workouts.length > 0 && <div className="card row between" style={{ alignItems: 'center', gap: 12 }}>+ {(workouts.length > 0 || dayPhotosOf(S).length > 0) && <div className="card row between" style={{ alignItems: 'center', gap: 12 }}><div style={{ minWidth: 0 }}><h2 style={{ margin: 0 }}>{t('Progress photos')}</h2>- <div className="muted small" style={{ marginTop: 4 }}>{t('Every photo you kept with a workout, lined up by date. Plus a before/after slider.')}</div></div>+ <div className="muted small" style={{ marginTop: 4 }}>{t('Every progress photo, lined up by date, for any day. Plus a before/after slider.')}</div></div><Button size="sm" variant="tinted" trailingIcon="chevronRight" style={{ flexShrink: 0 }} onClick={() => nav('/progress-photos')}>{t('Open')}</Button></div>}<div className="card row between" style={{ alignItems: 'center', gap: 12 }}>diff --git a/website/api.html b/website/api.htmlindex 38c135183..fd8d17794 100644--- a/website/api.html+++ b/website/api.html@@ -245,7 +245,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon<p class="api-facts"><span>OpenAPI 3.1.0</span><span>openGym v1.4.1</span>- <span>71 endpoints</span>+ <span>73 endpoints</span><span>AGPL-3.0-or-later</span></p>@@ -4035,6 +4035,11 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon<span class="p-type">always true</span><span class="p-desc">This instance keeps the files a logged workout's <code>media</code> list names too, not only a custom exercise's. Absent on an instance from before; the app then offers photos and videos on custom exercises only.</span></div>+ <div class="prow">+ <span class="p-name">days</span>+ <span class="p-type">always true</span>+ <span class="p-desc">This instance also keeps the files of progress photos filed under a day (<code>dayPhotos</code>, a photo for a day without a workout). Absent on an instance from before; the app then only adds photos to logged workouts there.</span>+ </div></div></div></details>