curated2: review fixes — touch drag (!45), deload seeds (!28), rep-range typing (!69), rebuilt rows on config change (!54), swap keeps history (!43), Hevy retry/dedup/aliases (!30), HTTPS doc (!67), locale gaps

This commit is contained in:
Duarte Santos committed 2026-08-30 14:18:09 +02:00
1 parent 148ef9fbbb
commit cc878dd353
26 files changed
+230 -64

No files matched your search

+1 -1
View File
@@ -382,7 +382,7 @@ h4.sec{
}
.item:active{background:var(--surface-2)}
.routine-list{position:relative}
.routine-drag-row{touch-action:pan-y;position:relative;transition:transform var(--fast) var(--ease)}
.routine-drag-row{touch-action:pan-y;-webkit-touch-callout:none;position:relative;transition:transform var(--fast) var(--ease)}
.routine-list.is-reordering{user-select:none;-webkit-user-select:none}
.routine-list.is-reordering .routine-drag-row{transition:none}
.routine-drag-row.is-dragging{z-index:2;pointer-events:none}
+3 -6
View File
@@ -1,7 +1,9 @@
// AUTO-GENERATED by scripts/build-hevy-id-map.mjs — do not edit by hand.
// Hevy exercise_template id → openGym catalogue id, plus English title → id for CSV exports
// (Hevy CSV has titles, not template ids). Regenerated from the Hevy templates API +
// verified title aliases.
// verified title aliases. Five title aliases whose catalogue match was wrong (crunch → weighted
// crunch, side plank → hip adduction, machine squat → barbell squat, cable triceps extension and
// cable reverse fly → lever machines) are left out; those titles import as custom exercises.
// 283 mapped · 168 left unmatched (import as custom).
// Source templates: 451 (built-in only).
@@ -348,7 +350,6 @@ export const HEVY_TITLE_MAP = {
"clean and press": "0028",
"concentration curl": "0297",
"cross body hammer curl": "0298",
"crunch": "0832",
"crunch (machine)": "1452",
"crunch (weighted)": "0832",
"cycling": "2331",
@@ -473,7 +474,6 @@ export const HEVY_TITLE_MAP = {
"push up (weighted)": "0662",
"push up - close grip": "0259",
"rack pull": "0074",
"rear delt reverse fly (cable)": "0602",
"rear delt reverse fly (dumbbell)": "0383",
"rear delt reverse fly (machine)": "0602",
"renegade row (dumbbell)": "0521",
@@ -516,7 +516,6 @@ export const HEVY_TITLE_MAP = {
"shrug (machine)": "0604",
"shrug (smith machine)": "0767",
"side bend (dumbbell)": "0407",
"side plank": "1775",
"single arm lateral raise (cable)": "0192",
"single leg standing calf raise (machine)": "0605",
"sissy squat (weighted)": "1489",
@@ -530,7 +529,6 @@ export const HEVY_TITLE_MAP = {
"squat (barbell)": "0043",
"squat (bodyweight)": "3543",
"squat (dumbbell)": "0413",
"squat (machine)": "0043",
"squat (smith machine)": "0770",
"squat (suspension)": "0043",
"squat row": "1003",
@@ -558,7 +556,6 @@ export const HEVY_TITLE_MAP = {
"triceps dip (assisted)": "0019",
"triceps dip (weighted)": "0591",
"triceps extension (barbell)": "0607",
"triceps extension (cable)": "0607",
"triceps extension (dumbbell)": "0607",
"triceps extension (machine)": "0607",
"triceps extension (suspension)": "0607",
+13 -4
View File
@@ -308,11 +308,17 @@ export function buildSets(S, cfg, options = {}) {
export const MAX_PLANNED_WARMUPS = 5
function buildWorkSets(S, cfg, options = {}) {
const last = lastEntryFor(S, cfg.id)
const n = Math.max(1, cfg.sets || 1)
const mode = modeOf(cfg)
const preferLast = !!options.preferLast
const useTarget = !!options.useTarget
// A workout flagged excludeFromProgression (a planned deload) is not "last time" for the
// next regular session either: its reps and durations must not seed the rows any more than
// its weight seeds the prescription. The deload session itself reads the routine's own target.
const regular = (S.workouts || []).some(w => w.excludeFromProgression === true)
? { ...S, workouts: S.workouts.filter(w => w.excludeFromProgression !== true) }
: S
const last = lastEntryFor(regular, cfg.id)
const n = Math.max(1, cfg.sets || 1)
const mode = modeOf(cfg)
const sets = []
// A deload routine must use its own prescription instead of carrying regular-session values
// into the workout. Other planned sessions keep the existing history-first behaviour.
@@ -341,8 +347,11 @@ function buildWorkSets(S, cfg, options = {}) {
const usable = prev && prev.r > 0 ? prev : null
// Planned sessions may use the confirmed working weight, while freestyle should reproduce
// the load of each matching set when that option is requested.
// A deload uses the routine's target weight; a routine that never set one (weight 0) falls
// back to the last regular load rather than prescribing an empty bar.
const lastRegular = last ? (last.sets[i] || last.sets[last.sets.length - 1]) : null
const w = useTarget
? cfg.weight
? (cfg.weight > 0 ? cfg.weight : (lastRegular && lastRegular.r > 0 ? lastRegular.w : cfg.weight))
: preferLast && usable ? usable.w : (conf && conf.w > 0 ? conf.w : (usable ? usable.w : cfg.weight))
sets.push({ w, r: usable ? usable.r : cfg.reps, done: false })
}
+29 -8
View File
@@ -31,12 +31,22 @@ async function hevyGet(path, apiKey, params = {}) {
for (const [k, v] of Object.entries(params)) {
if (v != null && v !== '') url.searchParams.set(k, String(v))
}
const res = await fetch(url, { headers: { 'api-key': apiKey } })
if (res.status === 401 || res.status === 403) {
throw new HevyApiError(res.status, 'auth')
// Hevy publishes no rate limit, but a large account is 100+ sequential page requests; a 429
// gets a short back-off and one more try before it surfaces as its own error kind.
for (let attempt = 0; ; attempt++) {
const res = await fetch(url, { headers: { 'api-key': apiKey } })
if (res.status === 401 || res.status === 403) {
throw new HevyApiError(res.status, 'auth')
}
if (res.status === 429 && attempt < 2) {
const after = Number(res.headers?.get?.('retry-after'))
await new Promise(r => setTimeout(r, (after > 0 && after <= 30 ? after : 2 * (attempt + 1)) * 1000))
continue
}
if (res.status === 429) throw new HevyApiError(res.status, 'rate-limit')
if (!res.ok) throw new HevyApiError(res.status, `http ${res.status}`)
return res.json()
}
if (!res.ok) throw new HevyApiError(res.status, `http ${res.status}`)
return res.json()
}
/** Page through a Hevy list endpoint. `pageSize` caps differ per resource. */
@@ -371,17 +381,28 @@ export function mergeHevyRoutines(S, parsed) {
// Keep the pre-assigned id from parse so routine configs already point at it.
if (!S.customEx.some(x => x.id === c.id)) S.customEx.push(c)
})
let added = 0
// A second import must not double every plan: a routine that already carries the same Hevy
// id is replaced in place (its exercises re-read from Hevy), everything else is appended.
let added = 0, updated = 0
for (const r of parsed.routines || []) {
const ex = (r.ex || []).map(e => ({ ...e, id: exIdMap[e.id] || e.id }))
const existing = r.hevyId ? S.routines.find(x => x.hevyId === r.hevyId) : null
if (existing) {
existing.name = r.name
existing.ex = ex
updated++
continue
}
S.routines.push({
id: uid(),
name: r.name,
emoji: r.emoji || 'figureStrength',
ex: (r.ex || []).map(e => ({ ...e, id: exIdMap[e.id] || e.id })),
...(r.hevyId ? { hevyId: r.hevyId } : {}),
ex,
})
added++
}
return { added }
return { added, updated }
}
/** Body measurements from the Hevy API → `mergeImport` bodyweight shape. */
+15 -4
View File
@@ -269,14 +269,25 @@ describe('parseHevyRoutines', () => {
expect(pull.sg).toBe(row.sg)
})
it('mergeHevyRoutines always adds new routines', () => {
it('mergeHevyRoutines replaces a routine it imported before instead of duplicating it', () => {
const parsed = parseHevyRoutines([ROUTINE], TEMPLATES, { unit: 'kg' })
const S = { routines: [], customEx: [] }
expect(mergeHevyRoutines(S, parsed).added).toBe(1)
expect(mergeHevyRoutines(S, parsed)).toEqual({ added: 1, updated: 0 })
expect(S.routines).toHaveLength(1)
expect(mergeHevyRoutines(S, parsed).added).toBe(1)
expect(S.routines[0].hevyId).toBe(ROUTINE.id)
const firstId = S.routines[0].id
S.routines[0].name = 'renamed locally'
expect(mergeHevyRoutines(S, parsed)).toEqual({ added: 0, updated: 1 })
expect(S.routines).toHaveLength(1)
expect(S.routines[0].id).toBe(firstId)
expect(S.routines[0].name).toBe(ROUTINE.title)
})
it('mergeHevyRoutines still adds a routine that carries no Hevy id', () => {
const parsed = parseHevyRoutines([{ ...ROUTINE, id: undefined }], TEMPLATES, { unit: 'kg' })
const S = { routines: [], customEx: [] }
mergeHevyRoutines(S, parsed); mergeHevyRoutines(S, parsed)
expect(S.routines).toHaveLength(2)
expect(S.routines[0].id).not.toBe(S.routines[1].id)
})
})
+1 -1
View File
@@ -27,7 +27,7 @@ describe('Brazilian Portuguese locale', () => {
.sort(byCodeUnit)
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(331)
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(333)
expect(inherited).toHaveLength(448)
// If this fails, review the changed keys and wording before accepting a new hash. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
+3 -1
View File
@@ -731,5 +731,7 @@ export default {
'Add session note': 'Notiz zum Training',
'Edit session note': 'Notiz bearbeiten',
'How the session went as a whole.': 'Wie das Training insgesamt lief.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-Pause trainiert immer als ein Aufwärmsatz mit dieser Wiederholungszahl und ein Rest-Pause-Arbeitssatz — „Sätze“ wird nicht verwendet.'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-Pause trainiert immer als ein Aufwärmsatz mit dieser Wiederholungszahl und ein Rest-Pause-Arbeitssatz — „Sätze“ wird nicht verwendet.',
'Open progression settings': 'Progressions-Einstellungen öffnen',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy drosselt die Anfragen — eine Minute warten und erneut versuchen',
}
+3 -1
View File
@@ -714,5 +714,7 @@ export default {
'Add session note': 'Añadir nota de la sesión',
'Edit session note': 'Editar nota de la sesión',
'How the session went as a whole.': 'Cómo fue la sesión en conjunto.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause siempre entrena como una serie de calentamiento con estas reps y una serie de trabajo rest-pause — «Series» no se usa.'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause siempre entrena como una serie de calentamiento con estas reps y una serie de trabajo rest-pause — «Series» no se usa.',
'Open progression settings': 'Abrir ajustes de progresión',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy está limitando las solicitudes: espera un minuto y vuelve a intentarlo',
}
+3 -1
View File
@@ -714,5 +714,7 @@ export default {
'Add session note': 'Ajouter une note de séance',
'Edit session note': 'Modifier la note de séance',
'How the session went as a whole.': 'Comment la séance s’est passée dans l’ensemble.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Le rest-pause s’entraîne toujours comme une série d’échauffement à ce nombre de reps, puis une série de travail rest-pause — « Séries » n’est pas utilisé.'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Le rest-pause s’entraîne toujours comme une série d’échauffement à ce nombre de reps, puis une série de travail rest-pause — « Séries » n’est pas utilisé.',
'Open progression settings': 'Ouvrir les réglages de progression',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy limite les requêtes — attendez une minute puis réessayez',
}
+3 -1
View File
@@ -714,5 +714,7 @@ export default {
'Add session note': 'सत्र का नोट जोड़ें',
'Edit session note': 'सत्र का नोट बदलें',
'How the session went as a whole.': 'पूरा सत्र कैसा रहा।',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'रेस्ट-पॉज़ हमेशा इसी रेप्स संख्या के एक वार्म-अप सेट और एक रेस्ट-पॉज़ वर्क सेट के रूप में किया जाता है — “सेट” का उपयोग नहीं होता।'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'रेस्ट-पॉज़ हमेशा इसी रेप्स संख्या के एक वार्म-अप सेट और एक रेस्ट-पॉज़ वर्क सेट के रूप में किया जाता है — “सेट” का उपयोग नहीं होता।',
'Open progression settings': 'प्रगति सेटिंग्स खोलें',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy अनुरोधों को सीमित कर रहा है — एक मिनट रुकें और फिर से कोशिश करें',
}
+33
View File
@@ -689,4 +689,37 @@ export default {
'Keep replacement in this group': 'A csere maradjon ebben a csoportban',
'Insert after this group': 'Beszúrás a csoport után',
'Logged sets stay with the original exercise. The replacement will be inserted afterward.': 'A naplózott sorozatok az eredeti gyakorlatnál maradnak. A csere utána kerül beszúrásra.',
'Rest after each set of this exercise. Leave at 0 to use your default rest timer.': 'Pihenő a gyakorlat minden sorozata után. Hagyd 0-n az alapértelmezett pihenőidőzítőhöz.',
'Flash screen when timer ends': 'Képernyő villogása, ha lejár az időzítő',
'Import from Hevy': 'Importálás a Hevyből',
'Pull your history with a Hevy Pro API key': 'Előzmények letöltése Hevy Pro API-kulccsal',
'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Előzmények letöltése Hevy Pro API-kulccsal. A kulcs csak ehhez az importhoz kell, nem mentjük el.',
'Hevy API key': 'Hevy API-kulcs',
'Get your API key': 'API-kulcs beszerzése',
'Hevy → Settings → Developer': 'Hevy → Beállítások → Fejlesztő',
'Paste your Hevy API key first': 'Előbb illeszd be a Hevy API-kulcsot',
'Fetch from Hevy': 'Letöltés a Hevyből',
'Fetching from Hevy…': 'Letöltés a Hevyből…',
'Fetching exercises… ({0}/{1})': 'Gyakorlatok letöltése… ({0}/{1})',
'Fetching workouts… ({0}/{1})': 'Edzések letöltése… ({0}/{1})',
'Fetching weigh-ins… ({0}/{1})': 'Mérések letöltése… ({0}/{1})',
'Matching exercises…': 'Gyakorlatok párosítása…',
'Could not reach Hevy — check the key and try again': 'A Hevy nem érhető el — ellenőrizd a kulcsot, és próbáld újra',
'That Hevy API key was refused': 'A Hevy elutasította ezt az API-kulcsot',
'Nothing to import from Hevy': 'Nincs mit importálni a Hevyből',
'Import workouts': 'Edzések importálása',
'Import routines': 'Edzéstervek importálása',
'Import weigh-ins': 'Mérések importálása',
'{0} new · {1} days already here': '{0} új · {1} nap már megvan',
'{0} routines · {1} exercises — added as new plans': '{0} edzésterv · {1} gyakorlat — új tervekként hozzáadva',
'{0} routines imported': '{0} edzésterv importálva',
'Fetching routines… ({0}/{1})': 'Edzéstervek letöltése… ({0}/{1})',
'Hevy stores weights in kg — they will be converted to {0}.': 'A Hevy kg-ban tárolja a súlyokat — átváltjuk erre: {0}.',
'Back': 'Vissza',
'Reps up to': 'Ism. legfeljebb',
'Exclude from automatic progression': 'Kihagyás az automatikus progresszióból',
'Use for planned deloads. Workouts stay in history and statistics.': 'Tervezett deloadhoz. Az edzések megmaradnak az előzményekben és a statisztikában.',
'The next regular target continues from the last included workout.': 'A következő normál cél az utolsó beszámított edzéstől folytatódik.',
'Open progression settings': 'Progresszió beállításainak megnyitása',
'Hevy is rate-limiting requests — wait a minute and try again': 'A Hevy korlátozza a kéréseket — várj egy percet, és próbáld újra',
}
+3 -1
View File
@@ -714,5 +714,7 @@ export default {
'Add session note': 'Aggiungi nota della sessione',
'Edit session note': 'Modifica nota della sessione',
'How the session went as a whole.': 'Com’è andata la sessione nel complesso.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Il rest-pause si allena sempre come una serie di riscaldamento a queste ripetizioni e una serie di lavoro rest-pause — “Serie” non viene usato.'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Il rest-pause si allena sempre come una serie di riscaldamento a queste ripetizioni e una serie di lavoro rest-pause — “Serie” non viene usato.',
'Open progression settings': 'Apri le impostazioni di progressione',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy sta limitando le richieste: attendi un minuto e riprova',
}
+3 -1
View File
@@ -714,5 +714,7 @@ export default {
'Add session note': '운동 메모 추가',
'Edit session note': '운동 메모 편집',
'How the session went as a whole.': '이번 운동이 전체적으로 어땠는지.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': '레스트포즈는 항상 이 횟수의 워밍업 세트 하나와 레스트포즈 작업 세트 하나로 진행됩니다 — ‘세트’는 사용하지 않습니다.'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': '레스트포즈는 항상 이 횟수의 워밍업 세트 하나와 레스트포즈 작업 세트 하나로 진행됩니다 — ‘세트’는 사용하지 않습니다.',
'Open progression settings': '진행 설정 열기',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy가 요청을 제한하고 있습니다 — 잠시 기다렸다가 다시 시도하세요',
}
+3 -1
View File
@@ -714,5 +714,7 @@ export default {
'Add session note': 'Dodaj notatkę do sesji',
'Edit session note': 'Edytuj notatkę do sesji',
'How the session went as a whole.': 'Jak przebiegła cała sesja.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause zawsze trenuje się jako jedna seria rozgrzewkowa o tej liczbie powtórzeń i jedna seria robocza rest-pause — „Serie” nie są używane.'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause zawsze trenuje się jako jedna seria rozgrzewkowa o tej liczbie powtórzeń i jedna seria robocza rest-pause — „Serie” nie są używane.',
'Open progression settings': 'Otwórz ustawienia progresji',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy ogranicza liczbę zapytań — odczekaj minutę i spróbuj ponownie',
}
+3 -1
View File
@@ -345,7 +345,9 @@ export const PT_BR_OVERRIDES = {
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'O rest-pause sempre treina como uma série de aquecimento com essas repetições e uma série de trabalho rest-pause — “Séries” não é usado.',
// --- per-exercise rest ---
'Rest after each set of this exercise. Leave at 0 to use your default rest timer.': 'Descanso depois de cada série deste exercício. Deixe em 0 para usar o temporizador de descanso padrão.'
'Rest after each set of this exercise. Leave at 0 to use your default rest timer.': 'Descanso depois de cada série deste exercício. Deixe em 0 para usar o temporizador de descanso padrão.',
'Open progression settings': 'Abrir configurações de progressão',
'Hevy is rate-limiting requests — wait a minute and try again': 'O Hevy está limitando as solicitações — espere um minuto e tente novamente',
}
export default { ...pt, ...PT_BR_OVERRIDES }
+3 -1
View File
@@ -714,5 +714,7 @@ export default {
'Add session note': 'Adicionar nota da sessão',
'Edit session note': 'Editar nota da sessão',
'How the session went as a whole.': 'Como correu a sessão no seu todo.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'O rest-pause treina sempre como uma série de aquecimento com estas repetições e uma série de trabalho rest-pause — «Séries» não é usado.'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'O rest-pause treina sempre como uma série de aquecimento com estas repetições e uma série de trabalho rest-pause — «Séries» não é usado.',
'Open progression settings': 'Abrir definições de progressão',
'Hevy is rate-limiting requests — wait a minute and try again': 'O Hevy está a limitar os pedidos — espere um minuto e tente novamente',
}
+3 -1
View File
@@ -714,5 +714,7 @@ export default {
'Add session note': 'Добавить заметку',
'Edit session note': 'Изменить заметку',
'How the session went as a whole.': 'Как прошла тренировка в целом.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause всегда выполняется как один разминочный подход с этим числом повторений и один рабочий подход rest-pause — «Подходы» не используются.'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause всегда выполняется как один разминочный подход с этим числом повторений и один рабочий подход rest-pause — «Подходы» не используются.',
'Open progression settings': 'Открыть настройки прогрессии',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy ограничивает запросы — подождите минуту и попробуйте снова',
}
+33
View File
@@ -697,4 +697,37 @@ export default {
'Keep replacement in this group': 'เก็บท่าใหม่ไว้ในกลุ่มนี้',
'Insert after this group': 'แทรกหลังกลุ่มนี้',
'Logged sets stay with the original exercise. The replacement will be inserted afterward.': 'เซ็ตที่บันทึกแล้วจะอยู่กับท่าเดิม ท่าใหม่จะถูกแทรกไว้ถัดไป',
'Rest after each set of this exercise. Leave at 0 to use your default rest timer.': 'พักหลังแต่ละเซ็ตของท่านี้ ปล่อยไว้ที่ 0 เพื่อใช้ตัวจับเวลาพักค่าเริ่มต้น',
'Flash screen when timer ends': 'กะพริบหน้าจอเมื่อหมดเวลา',
'Import from Hevy': 'นำเข้าจาก Hevy',
'Pull your history with a Hevy Pro API key': 'ดึงประวัติด้วยคีย์ API ของ Hevy Pro',
'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'ดึงประวัติด้วยคีย์ API ของ Hevy Pro คีย์ใช้สำหรับการนำเข้าครั้งนี้เท่านั้นและจะไม่ถูกบันทึก',
'Hevy API key': 'คีย์ API ของ Hevy',
'Get your API key': 'รับคีย์ API ของคุณ',
'Hevy → Settings → Developer': 'Hevy → การตั้งค่า → นักพัฒนา',
'Paste your Hevy API key first': 'วางคีย์ API ของ Hevy ก่อน',
'Fetch from Hevy': 'ดึงจาก Hevy',
'Fetching from Hevy…': 'กำลังดึงจาก Hevy…',
'Fetching exercises… ({0}/{1})': 'กำลังดึงท่าออกกำลังกาย… ({0}/{1})',
'Fetching workouts… ({0}/{1})': 'กำลังดึงการฝึก… ({0}/{1})',
'Fetching weigh-ins… ({0}/{1})': 'กำลังดึงน้ำหนักตัว… ({0}/{1})',
'Matching exercises…': 'กำลังจับคู่ท่าออกกำลังกาย…',
'Could not reach Hevy — check the key and try again': 'ติดต่อ Hevy ไม่ได้ — ตรวจสอบคีย์แล้วลองอีกครั้ง',
'That Hevy API key was refused': 'คีย์ API ของ Hevy ถูกปฏิเสธ',
'Nothing to import from Hevy': 'ไม่มีอะไรให้นำเข้าจาก Hevy',
'Import workouts': 'นำเข้าการฝึก',
'Import routines': 'นำเข้าโปรแกรม',
'Import weigh-ins': 'นำเข้าน้ำหนักตัว',
'{0} new · {1} days already here': 'ใหม่ {0} · มีอยู่แล้ว {1} วัน',
'{0} routines · {1} exercises — added as new plans': '{0} โปรแกรม · {1} ท่า — เพิ่มเป็นแผนใหม่',
'{0} routines imported': 'นำเข้า {0} โปรแกรมแล้ว',
'Fetching routines… ({0}/{1})': 'กำลังดึงโปรแกรม… ({0}/{1})',
'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy เก็บน้ำหนักเป็นกก. — จะถูกแปลงเป็น {0}',
'Back': 'กลับ',
'Reps up to': 'ครั้งสูงสุด',
'Exclude from automatic progression': 'ไม่รวมในการเพิ่มน้ำหนักอัตโนมัติ',
'Use for planned deloads. Workouts stay in history and statistics.': 'ใช้สำหรับดีโหลดที่วางแผนไว้ การฝึกยังอยู่ในประวัติและสถิติ',
'The next regular target continues from the last included workout.': 'เป้าหมายปกติครั้งถัดไปจะต่อจากการฝึกล่าสุดที่นับรวม',
'Open progression settings': 'เปิดการตั้งค่าการเพิ่มน้ำหนัก',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy จำกัดจำนวนคำขอ — รอสักครู่แล้วลองอีกครั้ง',
}
+3 -1
View File
@@ -714,5 +714,7 @@ export default {
'Add session note': 'Antrenman notu ekle',
'Edit session note': 'Antrenman notunu düzenle',
'How the session went as a whole.': 'Antrenmanın genel olarak nasıl geçtiği.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause her zaman bu tekrar sayısında bir ısınma seti ve bir rest-pause çalışma seti olarak çalışılır — “Setler” kullanılmaz.'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause her zaman bu tekrar sayısında bir ısınma seti ve bir rest-pause çalışma seti olarak çalışılır — “Setler” kullanılmaz.',
'Open progression settings': 'İlerleme ayarlarını aç',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy istekleri sınırlıyor — bir dakika bekleyip tekrar deneyin',
}
+3 -1
View File
@@ -714,5 +714,7 @@ export default {
'Add session note': '添加训练备注',
'Edit session note': '编辑训练备注',
'How the session went as a whole.': '这次训练整体感觉如何。',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause 始终按这个次数练一个热身组,再加一个 rest-pause 正式组 —— 不使用“组数”。'
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause 始终按这个次数练一个热身组,再加一个 rest-pause 正式组 —— 不使用“组数”。',
'Open progression settings': '打开进阶设置',
'Hevy is rate-limiting requests — wait a minute and try again': 'Hevy 正在限制请求——请稍等一分钟后重试',
}
+20 -9
View File
@@ -297,6 +297,7 @@ function HevyImportSheet({ close }) {
setPayload(data)
} catch (e) {
if (e instanceof HevyApiError && e.message === 'auth') toast(t('That Hevy API key was refused'))
else if (e instanceof HevyApiError && e.message === 'rate-limit') toast(t('Hevy is rate-limiting requests — wait a minute and try again'))
else if (e instanceof HevyApiError && e.message === 'empty') toast(t('Paste your Hevy API key first'))
else toast(t('Could not reach Hevy — check the key and try again'))
} finally {
@@ -716,15 +717,23 @@ export function swapActiveWorkoutExercise(index) {
const active = S().active
if (!active?.entries?.[index]) return
exercisePicker(ex => exConfigSheet(ex, null, cfg => {
const picker = exercisePicker(ex => exConfigSheet(ex, null, cfg => {
// The picker is a chooser here, not a stack you keep adding from: one swap, then back to
// the workout. (The add flow deliberately leaves it open.)
picker.close()
const full = { ...cfg, id: ex.id }
const st = S()
// Same rows the add flow builds: last time's loads and, in a planned session, the
// prescription — swapping barbell for dumbbell bench must not start you at an empty bar.
const freestyle = !st.active?.routineId
const step = defaultIncrement(ex.id, st.unit)
const plan = freestyle ? null : nextPrescription(st, full, st.routines.find(r => r.id === st.active.routineId))
const built = buildSets(st, full, { step, ...(freestyle ? { preferLast: true } : {}) })
const replacement = {
id: ex.id,
target: { ...cfg },
plan: null,
sets: applyIntensifierPlan(buildSets({ ...S(), workouts: [] }, full, {
step: defaultIncrement(ex.id, S().unit)
}), full)
plan,
sets: applyIntensifierPlan(freestyle ? built : applyPrescription(built, plan, step), full)
}
const current = S().active?.entries?.[index]
if (!current) return
@@ -846,10 +855,12 @@ function ProgressionFields({ ex, mode, c, setC, routine, unit, perSide }) {
step={mode === 'time' ? 5 : 1.25} decimal={mode !== 'time'} invalid={invalid} className={invalid ? 'invalid' : ''}
onChange={v => setC(x => ({ ...x, inc: v }))} />
{active === 'double' && <>
<Stepper label={t('Reps from')} value={range.repsMin} step={stride} decimal={false}
onChange={v => setC(x => ({ ...x, ...normalizeRepRange(x.reps, v, stride) }))} />
<Stepper label={t('Reps up to')} value={range.reps} step={stride} decimal={false}
onChange={v => setC(x => ({ ...x, ...normalizeRepRange(v, x.repsMin, stride) }))} />
{/* The draft stays as typed: normalising on every keystroke turned "12" into 92 (the
"1" was pulled above the lower bound first). Save and the engine normalise anyway. */}
<Stepper label={t('Reps from')} value={c.repsMin ?? range.repsMin} step={stride} decimal={false}
onChange={v => setC(x => ({ ...x, repsMin: v }))} />
<Stepper label={t('Reps up to')} value={c.reps ?? range.reps} step={stride} decimal={false}
onChange={v => setC(x => ({ ...x, reps: v }))} />
</>}
</div>}
{invalid && <div className="small" role="alert" style={{ color: 'var(--red)', marginTop: -10, marginBottom: 18 }}>
+8
View File
@@ -251,7 +251,14 @@ function useRoutineReorder(routineIdentity, exercises, onDrop) {
const onContextMenu = event => { if (gestureRef.current?.active && event.target.closest?.('[data-routine-row]')) event.preventDefault() }
const onDragStart = event => { if (event.target.closest?.('[data-routine-row]')) event.preventDefault() }
// Touch: the rows keep `touch-action: pan-y` so the list still scrolls with a finger, but once
// a long-press has lifted a row the browser must not claim the vertical drag as a pan — it
// would fire pointercancel and scroll instead. preventDefault on a pointer event cannot stop
// that; only a non-passive touchmove listener can, and only while a drag is actually active.
const onTouchMove = event => { if (gestureRef.current?.active) event.preventDefault() }
document.addEventListener('pointerdown', onPointerDown)
document.addEventListener('touchmove', onTouchMove, { passive: false })
document.addEventListener('pointermove', onPointerMove, { passive: false })
document.addEventListener('pointerup', onPointerUp, { passive: false })
document.addEventListener('pointercancel', onPointerCancel)
@@ -266,6 +273,7 @@ function useRoutineReorder(routineIdentity, exercises, onDrop) {
clearTimer(gesture); clearFrame(); gestureRef.current = null
releaseCapture(gesture)
document.removeEventListener('pointerdown', onPointerDown)
document.removeEventListener('touchmove', onTouchMove)
document.removeEventListener('pointermove', onPointerMove)
document.removeEventListener('pointerup', onPointerUp)
document.removeEventListener('pointercancel', onPointerCancel)
+12 -1
View File
@@ -444,10 +444,21 @@ function ActiveWorkout() {
if (!activeEntry) return
const full = { ...cfg, id: activeEntry.id }
const activeRoutine = s.routines.find(r => r.id === s.active.routineId)
const step = defaultIncrement(activeEntry.id, s.unit)
// A config without a set count keeps the rows the session already has.
if (!(full.sets > 0)) full.sets = activeEntry.sets.filter(x => !isWarmupRow(x)).length || 1
const plan = nextPrescription(s, full, activeRoutine)
// The sheet edits sets, reps, weight and warm-ups as well as the rule — so the rows are
// rebuilt from the new config the way the session was, and only what you already logged
// is kept in place (done warm-ups first, then done work sets, then the fresh remainder).
const fresh = applyIntensifierPlan(applyPrescription(buildSets(s, full, { step }), plan, step), full)
const doneWarm = activeEntry.sets.filter(x => x.done && isWarmupRow(x))
const doneWork = activeEntry.sets.filter(x => x.done && !isWarmupRow(x))
const freshWarm = fresh.filter(isWarmupRow)
const freshWork = fresh.filter(x => !isWarmupRow(x))
activeEntry.target = { ...cfg }
activeEntry.plan = plan
activeEntry.sets = applyPrescription(activeEntry.sets, plan, defaultIncrement(activeEntry.id, s.unit))
activeEntry.sets = [...doneWarm, ...freshWarm.slice(doneWarm.length), ...doneWork, ...freshWork.slice(doneWork.length)]
}), null, routine)
}