diff --git a/.env.example b/.env.example
index 6ae8d8b..3847561 100644
--- a/.env.example
+++ b/.env.example
@@ -125,3 +125,10 @@ RP_NAME=openGym
# fine; set a mailto: if you would rather they mailed you:
#
# VAPID_SUBJECT=mailto:you@example.com
+
+# ── Hevy map regeneration (developers only) ────────────────────────────────
+# Not used by the running app. End users paste their own key in Settings →
+# Import from Hevy. Set this only to regenerate frontend/src/lib/hevy-id-map.js:
+#
+# HEVY_API_KEY=
+# node scripts/build-hevy-id-map.mjs
diff --git a/README.md b/README.md
index c1128eb..58cab45 100644
--- a/README.md
+++ b/README.md
@@ -85,7 +85,7 @@ as a home-screen app, passkey sign-in, offline support, sync across your phone a
- 🛠️ **Admin dashboard** (optional) — for whoever runs the instance: who's training right now, per-user history, disable accounts, invite-only signup, and an **activity log** of sign-ins, failed attempts and admin actions. Off by default, so a fresh instance stays open with no admin
- 🎨 **Designed, not assembled** — light/dark themes and 8 accent colors saved to your profile, over a hand-drawn icon set instead of emoji, so it looks the same on every phone
- 🌍 **13 languages** — full UI translation (EN, DE, ES, FR, IT, PT (Portugal), PT (Brazil), PL, TR, RU, ZH, KO, HI); exercise instructions localized in 11 of them and built-in exercise names shown bilingually in PT-BR, all loaded on demand so the app stays fast
-- 📥 **Bring your history with you** — import from **FitNotes** (Android and iOS), **Strong** and **Hevy**, or body weight straight out of an **Apple Health** export. Exercise names are matched against the library and anything unrecognised becomes one of your own exercises, so nothing in the file is dropped
+- 📥 **Bring your history with you** — import from **FitNotes** (Android and iOS), **Strong** and **Hevy** (CSV or directly with a [Hevy Pro API key](https://hevy.com/settings?developer)), or body weight straight out of an **Apple Health** export. Exercise names are matched against the library and anything unrecognised becomes one of your own exercises, so nothing in the file is dropped
- 📦 **Yours to keep** — one-tap JSON export/import, guest mode, **no telemetry**
- 🤖 **Ask an AI about your training** (optional) — an [MCP server](mcp/README.md) lets a client like Claude Desktop or Cursor read your history in your own words: *"what did I bench last week?"*. Read-only, spawned locally by the client, nothing leaves your box. Not in the Docker build — if you don't use an AI assistant, it isn't there
- 📱 **Standalone Android app** — the whole tracker as a sideloadable APK: no account, no server, data on the phone, native workout reminders ([download](https://opengym.duarte-santos.ch))
@@ -197,7 +197,7 @@ Rough, community-driven — ideas and PRs welcome:
- [x] Estimated 1RM per exercise
- [ ] Percentage / training-max programming (5/3/1-style) on top of the progression engine
- [ ] More starter plans (upper/lower, full-body, 5×5)
-- [x] Importers from FitNotes / Strong / Hevy (including the RPE they record), and body weight from Apple Health
+- [x] Importers from FitNotes / Strong / Hevy (CSV, or Hevy Pro API key — workouts and/or weigh-ins), including the RPE they record, and body weight from Apple Health
- [x] Effort per set — RIR or RPE, whichever scale you think in
- [ ] Body measurements (waist, arms…) alongside weight
- [ ] Per-exercise notes & plate calculator
diff --git a/docs/DATA_IMPORTS.md b/docs/DATA_IMPORTS.md
index f310df7..95fc1c8 100644
--- a/docs/DATA_IMPORTS.md
+++ b/docs/DATA_IMPORTS.md
@@ -36,7 +36,24 @@ These apps have been tested to work without adjustments to the column names:
| **FitNotes 2 (iOS)** | Export workouts as CSV; also manual/auto iCloud backups |
| **Strong** | Settings → Export Data |
| **Gravl** | Profile → Export Data |
-| **Hevy** | Profile → Settings → Export & Import Data (Workouts or Measurements) |
+| **Hevy** | Profile → Settings → Export & Import Data (Workouts or Measurements), **or** Settings → Import from Hevy with a Pro API key |
+
+### Hevy API (direct)
+
+If you have **Hevy Pro**, you can skip the CSV and import straight from Hevy:
+
+1. Open [Hevy → Settings → Developer](https://hevy.com/settings?developer) and create an API key
+2. In openGym: **Settings → Import from Hevy**
+3. Paste the key (used only for that import — it is not saved)
+4. Choose whether to bring **workouts**, **routines**, **weigh-ins**, or any mix, then confirm
+
+Both the API import and a detected **Hevy CSV** resolve exercises through the same generated
+lookup (`frontend/src/lib/hevy-id-map.js`): template id for the API, English title for the CSV.
+To regenerate (developers): set `HEVY_API_KEY` in the environment or `.env`, then run
+`node scripts/build-hevy-id-map.mjs`. Unmapped lifts become your own exercises. Workout days
+that already have data here are left alone; routines are always added as **new** plans
+(nothing you already have is overwritten). Localized CSV titles (non-English) still fall back
+to name matching.
You can also create your own `CSV` file:
diff --git a/frontend/src/lib/hevy-id-map.js b/frontend/src/lib/hevy-id-map.js
new file mode 100644
index 0000000..ce5b32f
--- /dev/null
+++ b/frontend/src/lib/hevy-id-map.js
@@ -0,0 +1,579 @@
+// 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.
+// 283 mapped · 168 left unmatched (import as custom).
+// Source templates: 451 (built-in only).
+
+export const HEVY_ID_MAP = {
+ "018ADC12": "3017",
+ "01A35BF9": "2404",
+ "023943F1": "0572",
+ "026FD047": "0407",
+ "0393F233": "0218",
+ "040BA2E3": "2612",
+ "046E25A2": "0673",
+ "0482DA98": "0826",
+ "05293BCA": "3142",
+ "059E835D": "0603",
+ "062AB91A": "0594",
+ "06745E58": "1372",
+ "073032BB": "1457",
+ "07B38369": "0314",
+ "084A67CA": "0128",
+ "08590920": "0472",
+ "08A2974E": "0606",
+ "091737FA": "0573",
+ "09C9F635": "0865",
+ "0B4C1902": "0294",
+ "0B841777": "0095",
+ "0B9B92BA": "0085",
+ "0EB695C9": "2611",
+ "0F24286A": "0099",
+ "0FBF7195": "0748",
+ "1006DF48": "0401",
+ "10313AFD": "0550",
+ "10347BAC": "0591",
+ "10D76E8F": "1273",
+ "112FC6B7": "0080",
+ "11A123F3": "0586",
+ "12017185": "0308",
+ "123EE239": "0439",
+ "1283BBA6": "0043",
+ "150E076B": "3655",
+ "18487FA7": "0301",
+ "19372ABC": "0662",
+ "19A38071": "0604",
+ "1B2B1E7C": "0652",
+ "1B89CA1B": "0521",
+ "1D4B3D6B": "0313",
+ "1DF4A847": "1350",
+ "1E42FD5F": "0743",
+ "1E9A6B8E": "0592",
+ "20870ED5": "0752",
+ "20C1A3CB": "0809",
+ "21310F5F": "0607",
+ "218DA87C": "0803",
+ "22578A94": "0168",
+ "234897AB": "0165",
+ "23A48484": "0175",
+ "23E92538": "0292",
+ "243710DE": "3666",
+ "286C1D0B": "0246",
+ "28BB4A95": "0591",
+ "29083183": "1326",
+ "29472BE1": "0251",
+ "2982AA23": "0687",
+ "2A48E443": "0116",
+ "2B4B7310": "0085",
+ "2C37EC5E": "0017",
+ "2CFED196": "0069",
+ "2F8D3067": "0607",
+ "2FA77B28": "0459",
+ "3092FADD": "0607",
+ "32B0B590": "0507",
+ "32C4D4A2": "0298",
+ "32HKJ34K": "1460",
+ "3303376C": "2141",
+ "33EDD7DB": "1460",
+ "35B51B87": "0030",
+ "3601968B": "0289",
+ "36E8F14E": "0165",
+ "3765684D": "0607",
+ "37FCC2BB": "0294",
+ "392887AA": "0662",
+ "39C99849": "0493",
+ "3A6FA3D1": "0757",
+ "3D0C7C75": "1760",
+ "3F5F8D40": "3142",
+ "3FF6A22E": "0544",
+ "40C6A9FC": "0127",
+ "4180C405": "0044",
+ "422B08F1": "0334",
+ "425805F4": "0499",
+ "43573BB8": "0003",
+ "4377A52B": "2311",
+ "4377A52C": "2311",
+ "473CF5B8": "0673",
+ "47B036EF": "0978",
+ "49C922A1": "1409",
+ "4B4BF8C2": "0019",
+ "4E5257DE": "2616",
+ "4F5866F8": "0573",
+ "4F942934": "0070",
+ "5046D0A9": "0042",
+ "50C613D0": "2133",
+ "50DFDFAB": "0047",
+ "5122E7D9": "1451",
+ "51A0EDAA": "0677",
+ "542F3CD5": "1700",
+ "55E6546F": "0027",
+ "56808FD2": "0970",
+ "582ADA23": "1636",
+ "5E10D0E6": "3142",
+ "5E1A7777": "0054",
+ "5F4E6DD3": "0300",
+ "5F8903BF": "0551",
+ "6120CAAB": "0795",
+ "6182EE83": "0607",
+ "651F844C": "1269",
+ "6575F52D": "0283",
+ "6622E5A0": "3142",
+ "67280085": "0375",
+ "68B83EE0": "3193",
+ "68F8A292": "0060",
+ "6A6C31A5": "2330",
+ "6AC96645": "0405",
+ "6DA40660": "0417",
+ "6E6EE645": "0054",
+ "6FCD7755": "0251",
+ "70D4EBBF": "0514",
+ "72297E8C": "5201",
+ "724CDE60": "0297",
+ "729237D1": "0652",
+ "72CFFAD5": "1459",
+ "74103F24": "0052",
+ "742E5BD5": "0767",
+ "75A4F6C4": "0585",
+ "78683336": "0596",
+ "7952B5CD": "0872",
+ "796E8E2C": "0834",
+ "797F0782": "0437",
+ "79D0BB3A": "0025",
+ "7AB9A362": "0120",
+ "7B8D84E8": "0091",
+ "7C0028C3": "0593",
+ "7C50F118": "1429",
+ "7E3BC8B6": "0312",
+ "7EB3F7C3": "0577",
+ "818BA121": "0078",
+ "8293E554": "0310",
+ "875F585F": "0060",
+ "878CD1D0": "0405",
+ "89304423": "0529",
+ "8A2E6481": "0180",
+ "8BAB2735": "0318",
+ "8BEBFED6": "0598",
+ "8C331CD8": "0196",
+ "8C9D2928": "1494",
+ "90427D4A": "1675",
+ "90B04F96": "0471",
+ "90E506D5": "3305",
+ "91237BDD": "2289",
+ "914F3A96": "0327",
+ "91AF29E0": "0091",
+ "9237BAD1": "0603",
+ "923874CA": "0562",
+ "9273BA17": "0237",
+ "9283BABA": "0858",
+ "92D858EA": "0243",
+ "9372FFAA": "0396",
+ "93A552C6": "0241",
+ "947DAC23": "0259",
+ "95F2E076": "1426",
+ "9694DA61": "3543",
+ "98237BA2": "0826",
+ "991833C2": "3220",
+ "9930DF71": "0091",
+ "99507114": "0032",
+ "99B49684": "3663",
+ "99C1F2AD": "0151",
+ "99D5F10E": "0857",
+ "9B13BA4B": "0548",
+ "9DCE2D64": "0596",
+ "9F48F858": "0206",
+ "9F9C164B": "0631",
+ "A01BE509": "0443",
+ "A05C064D": "0573",
+ "A0D8FA1B": "2271",
+ "A127DA73": "0534",
+ "A2D838BD": "0243",
+ "A41C7261": "0972",
+ "A57D38D5": "0815",
+ "A5AC6449": "0031",
+ "A69FF221": "2137",
+ "A733CC5B": "1460",
+ "A8814C06": "1003",
+ "AA1EB7D8": "0571",
+ "AA52E8D2": "0773",
+ "ABB00838": "0028",
+ "ABEC557F": "0406",
+ "AC5A4C58": "0046",
+ "ADA8623C": "0868",
+ "AF328E3D": "0575",
+ "B05C2C29": "0605",
+ "B09A1304": "0766",
+ "B123DD01": "2285",
+ "B2398CD1": "0277",
+ "B3B1D947": "3360",
+ "B537D09F": "0336",
+ "B582299E": "0383",
+ "B5D3A742": "0410",
+ "B5EFBF9C": "0194",
+ "B74A95BB": "3211",
+ "B8127AD1": "0586",
+ "B82D6418": "0043",
+ "B923B230": "0811",
+ "BB792A36": "1160",
+ "BB83BDDE": "0687",
+ "BC10A922": "0277",
+ "BD4E7E53": "0535",
+ "BD86EFD5": "0041",
+ "BE289E45": "0178",
+ "BE640BA0": "0203",
+ "BF6ECE89": "0431",
+ "C315DC2A": "0602",
+ "C43825EA": "0279",
+ "C469EA70": "0597",
+ "C6272009": "0032",
+ "C628D768": "0648",
+ "C6C9B8A0": "2135",
+ "C7973E0E": "0739",
+ "C7AE420A": "0688",
+ "C8706C80": "0624",
+ "CC35A01F": "0043",
+ "CC55119B": "0979",
+ "CD6DC8E5": "0830",
+ "D04AC939": "0043",
+ "D20D7BBE": "0117",
+ "D23C609B": "0572",
+ "D2FE7B2E": "2330",
+ "D3095577": "0028",
+ "D3E2AB55": "0319",
+ "D4A2FE7E": "2143",
+ "D53F2886": "0065",
+ "D5D0354D": "0584",
+ "D8281C62": "0602",
+ "D82EA543": "0983",
+ "D8460FA6": "0385",
+ "D8911FC4": "0276",
+ "D8F7F851": "2331",
+ "D928C232": "0832",
+ "D950429E": "0038",
+ "DA0F0470": "0033",
+ "DBB91A3C": "0162",
+ "DBE341AA": "1495",
+ "DBF9273A": "0310",
+ "DCF3B31B": "0832",
+ "DCFF3E9F": "0413",
+ "DDCC3821": "0770",
+ "DE68C825": "0192",
+ "DF200976": "0977",
+ "E05C2C38": "0605",
+ "E3EDA509": "1775",
+ "E53CCBE5": "1372",
+ "E5988A0A": "0383",
+ "E644F828": "1258",
+ "E9E4089F": "0009",
+ "EA820646": "0027",
+ "EAC7D9C5": "3124",
+ "EB43ADD4": "1452",
+ "EB813C91": "1359",
+ "F1258206": "1004",
+ "F1D60854": "0218",
+ "F1E57334": "0292",
+ "F2A37357": "1410",
+ "F30A4F01": "1460",
+ "F3717B0E": "3888",
+ "F49E31D6": "0630",
+ "F4B4C6EE": "0597",
+ "F5DEF1EB": "1489",
+ "F8356514": "0472",
+ "F8A0FCCA": "0549",
+ "F99C211D": "0535",
+ "FAB6EB2F": "0372",
+ "FAF31231": "0033",
+ "FB09C938": "0067",
+ "FBF92739": "1299",
+ "FE389074": "0074",
+ "FFABC123": "0220",
+ "FFC106CB": "0753",
+ "FFDA283B": "0381",
+}
+
+/** Lowercased Hevy English title → catalogue id (CSV / name path). */
+export const HEVY_TITLE_MAP = {
+ "ab wheel": "0857",
+ "air bike": "0003",
+ "arnold press (dumbbell)": "2137",
+ "around the world": "2143",
+ "back extension (hyperextension)": "0573",
+ "back extension (machine)": "0573",
+ "back extension (weighted hyperextension)": "0573",
+ "battle ropes": "0128",
+ "bear crawl": "3360",
+ "bench dip": "0830",
+ "bench press (barbell)": "0025",
+ "bench press (cable)": "0151",
+ "bench press (dumbbell)": "0289",
+ "bench press (smith machine)": "0748",
+ "bench press - close grip (barbell)": "0030",
+ "bench press - wide grip (barbell)": "1258",
+ "bent over row (band)": "0027",
+ "bent over row (barbell)": "0027",
+ "bent over row (dumbbell)": "0292",
+ "bent over row (smith machine)": "1359",
+ "bicep curl (barbell)": "0031",
+ "bicep curl (cable)": "0868",
+ "bicep curl (dumbbell)": "0294",
+ "bicep curl (machine)": "0575",
+ "bicep curl (suspension)": "0294",
+ "bicycle crunch": "0972",
+ "boxing": "2271",
+ "bulgarian split squat (barbell)": "0099",
+ "bulgarian split squat (dumbbell)": "0410",
+ "burpee": "1160",
+ "butterfly (pec deck)": "0596",
+ "cable core pallof press": "0979",
+ "cable crunch": "0175",
+ "cable fly crossovers": "1269",
+ "cable pull through": "0196",
+ "cable twist (down to up)": "0243",
+ "cable twist (up to down)": "0243",
+ "calf press (machine)": "2289",
+ "chest dip": "0251",
+ "chest dip (assisted)": "0009",
+ "chest dip (weighted)": "0251",
+ "chest fly (dumbbell)": "0308",
+ "chest fly (machine)": "0596",
+ "chest press (band)": "3124",
+ "chest press (machine)": "0577",
+ "chest supported incline row (dumbbell)": "0327",
+ "chest supported reverse fly (dumbbell)": "0383",
+ "chin up": "1326",
+ "chin up (assisted)": "0572",
+ "chin up (weighted)": "0572",
+ "clap push ups": "1273",
+ "clean": "0028",
+ "clean and press": "0028",
+ "concentration curl": "0297",
+ "cross body hammer curl": "0298",
+ "crunch": "0832",
+ "crunch (machine)": "1452",
+ "crunch (weighted)": "0832",
+ "cycling": "2331",
+ "dead bug": "0276",
+ "deadlift (band)": "0032",
+ "deadlift (barbell)": "0032",
+ "deadlift (dumbbell)": "0300",
+ "deadlift (smith machine)": "0752",
+ "deadlift (trap bar)": "0811",
+ "decline bench press (barbell)": "0033",
+ "decline bench press (dumbbell)": "0301",
+ "decline bench press (machine)": "0033",
+ "decline bench press (smith machine)": "0753",
+ "decline crunch": "0277",
+ "decline crunch (weighted)": "0277",
+ "decline push up": "0279",
+ "diamond push up": "0283",
+ "drag curl": "0038",
+ "dumbbell row": "0292",
+ "dumbbell snatch": "3888",
+ "dumbbell step up": "0431",
+ "elbow to knee": "0443",
+ "elliptical trainer": "2141",
+ "ez bar biceps curl": "2404",
+ "face pull": "0203",
+ "farmers walk": "2133",
+ "floor press (barbell)": "0065",
+ "floor triceps dip": "0815",
+ "flutter kicks": "0459",
+ "front raise (band)": "0978",
+ "front raise (barbell)": "0041",
+ "front raise (cable)": "0162",
+ "front raise (dumbbell)": "0310",
+ "front raise (suspension)": "0834",
+ "front squat": "0042",
+ "full squat": "0043",
+ "glute bridge (barbell)": "1409",
+ "glute ham raise": "3193",
+ "goblet squat": "1760",
+ "good morning (barbell)": "0044",
+ "hack squat": "0046",
+ "hack squat (machine)": "0743",
+ "hammer curl (band)": "0313",
+ "hammer curl (cable)": "0165",
+ "hammer curl (dumbbell)": "0312",
+ "handstand push up": "0471",
+ "hang clean": "0535",
+ "hanging knee raise": "0472",
+ "hanging leg raise": "0472",
+ "high knees": "3655",
+ "hip abduction (cable)": "0597",
+ "hip abduction (machine)": "0597",
+ "hip adduction (cable)": "0168",
+ "hip adduction (machine)": "0598",
+ "incline bench press (barbell)": "0047",
+ "incline bench press (dumbbell)": "0314",
+ "incline bench press (smith machine)": "0757",
+ "incline chest fly (dumbbell)": "0319",
+ "incline chest press (machine)": "1299",
+ "incline push ups": "0493",
+ "inverted row": "0499",
+ "iso-lateral row (machine)": "0571",
+ "jackknife sit up": "0507",
+ "jm press (barbell)": "0052",
+ "jump rope": "2612",
+ "jump squat": "0514",
+ "jumping jack": "3220",
+ "kettlebell clean": "0535",
+ "kettlebell goblet squat": "0534",
+ "kettlebell high pull": "0548",
+ "kettlebell snatch": "0529",
+ "kettlebell swing": "0549",
+ "kettlebell turkish get up": "0551",
+ "knee raise parallel bars": "0826",
+ "kneeling pulldown (band)": "0983",
+ "kneeling push up": "3211",
+ "landmine 180": "0562",
+ "lat pulldown (band)": "2330",
+ "lat pulldown (cable)": "2330",
+ "lat pulldown (machine)": "0673",
+ "lat pulldown - close grip (cable)": "2616",
+ "lateral lunge": "1410",
+ "lateral raise (band)": "0977",
+ "lateral raise (cable)": "0178",
+ "lateral raise (dumbbell)": "0334",
+ "lateral raise (machine)": "0584",
+ "leg extension (machine)": "0585",
+ "leg press (machine)": "0739",
+ "leg press horizontal (machine)": "2611",
+ "leg raise parallel bars": "0826",
+ "low row (suspension)": "0180",
+ "lunge": "0054",
+ "lunge (barbell)": "0054",
+ "lunge (dumbbell)": "0336",
+ "lying leg curl (machine)": "0586",
+ "lying leg raise": "0865",
+ "mountain climber": "0630",
+ "muscle up": "0631",
+ "oblique crunch": "1495",
+ "overhead curl (cable)": "1636",
+ "overhead press (barbell)": "0091",
+ "overhead press (dumbbell)": "0405",
+ "overhead press (smith machine)": "0766",
+ "overhead squat": "0069",
+ "overhead triceps extension (cable)": "0194",
+ "pendlay row (barbell)": "3017",
+ "pistol squat": "0544",
+ "plank": "2135",
+ "plate front raise": "0310",
+ "power clean": "0648",
+ "preacher curl (barbell)": "0070",
+ "preacher curl (dumbbell)": "0372",
+ "preacher curl (machine)": "0592",
+ "pull up": "0652",
+ "pull up (assisted)": "0017",
+ "pull up (band)": "0970",
+ "pull up (weighted)": "0652",
+ "pullover (dumbbell)": "0375",
+ "pullover (machine)": "2285",
+ "push press": "1700",
+ "push up": "0662",
+ "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",
+ "reverse crunch": "0872",
+ "reverse curl (barbell)": "0080",
+ "reverse curl (cable)": "0206",
+ "reverse grip lat pulldown (cable)": "0673",
+ "reverse hyperextension": "0593",
+ "reverse lunge (barbell)": "0078",
+ "reverse lunge (dumbbell)": "0381",
+ "reverse plank": "3663",
+ "reverse wrist curl (dumbbell)": "0385",
+ "ring dips": "0677",
+ "romanian deadlift (barbell)": "0085",
+ "romanian deadlift (dumbbell)": "1459",
+ "romanian deadlift (smith machine)": "0085",
+ "rope cable curl": "0165",
+ "rope straight arm pulldown": "0237",
+ "russian twist (bodyweight)": "0687",
+ "russian twist (weighted)": "0687",
+ "scapular pull ups": "0688",
+ "seated cable row - bar grip": "0218",
+ "seated cable row - v grip (cable)": "0218",
+ "seated calf raise": "0594",
+ "seated dip machine": "1451",
+ "seated incline curl (dumbbell)": "0318",
+ "seated lateral raise (dumbbell)": "0396",
+ "seated leg curl (machine)": "0586",
+ "seated overhead press (barbell)": "0091",
+ "seated overhead press (dumbbell)": "0091",
+ "seated palms up wrist curl": "0401",
+ "seated row (machine)": "1350",
+ "seated shoulder press (machine)": "0603",
+ "seated wrist curl (barbell)": "1426",
+ "shoulder press (dumbbell)": "0405",
+ "shoulder press (machine plates)": "0603",
+ "shrug (barbell)": "0095",
+ "shrug (cable)": "0220",
+ "shrug (dumbbell)": "0406",
+ "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",
+ "skullcrusher (barbell)": "0060",
+ "skullcrusher (dumbbell)": "0060",
+ "snatch": "0067",
+ "spider curl (dumbbell)": "1675",
+ "split squat (dumbbell)": "0809",
+ "sprints": "0858",
+ "squat (band)": "1004",
+ "squat (barbell)": "0043",
+ "squat (bodyweight)": "3543",
+ "squat (dumbbell)": "0413",
+ "squat (machine)": "0043",
+ "squat (smith machine)": "0770",
+ "squat (suspension)": "0043",
+ "squat row": "1003",
+ "stair machine (floors)": "2311",
+ "stair machine (steps)": "2311",
+ "standing calf raise": "1372",
+ "standing calf raise (barbell)": "1372",
+ "standing calf raise (dumbbell)": "0417",
+ "standing calf raise (machine)": "0605",
+ "standing calf raise (smith)": "0773",
+ "standing leg curls": "0795",
+ "standing military press (barbell)": "1457",
+ "straight leg deadlift": "0116",
+ "sumo deadlift": "0117",
+ "sumo squat": "3142",
+ "sumo squat (barbell)": "3142",
+ "sumo squat (dumbbell)": "3142",
+ "sumo squat (kettlebell)": "3142",
+ "superman": "0803",
+ "t bar row": "0606",
+ "thruster (barbell)": "3305",
+ "thruster (kettlebell)": "0550",
+ "treadmill": "3666",
+ "triceps dip": "0591",
+ "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",
+ "triceps pushdown": "0241",
+ "upright row (barbell)": "0120",
+ "upright row (cable)": "0246",
+ "upright row (dumbbell)": "0437",
+ "waiter curl (dumbbell)": "5201",
+ "walking": "1460",
+ "walking lunge": "1460",
+ "walking lunge (dumbbell)": "1460",
+ "walking lunge (sandbag)": "1460",
+ "wall sit": "0624",
+ "wide pull up": "1429",
+ "yoga": "1494",
+ "zercher squat": "0127",
+ "zottman curl (dumbbell)": "0439",
+}
diff --git a/frontend/src/lib/import-csv.js b/frontend/src/lib/import-csv.js
index 282f0bb..73ecc94 100644
--- a/frontend/src/lib/import-csv.js
+++ b/frontend/src/lib/import-csv.js
@@ -21,6 +21,7 @@
import { EXDB, EXIDX } from './exercises.js'
import { uid } from './format.js'
import { isWarmupRow } from './workout-model.js'
+import { HEVY_TITLE_MAP } from './hevy-id-map.js'
/* ----------------------------------------------------------------- CSV ---- */
@@ -251,6 +252,16 @@ export function matchExercise(name) {
return ties === 1 ? best : null
}
+/**
+ * Exact Hevy English title → catalogue id (from the generated title map).
+ * Used when a CSV is detected as Hevy: same deterministic table as the API import,
+ * keyed by title because Hevy's CSV has no template id column.
+ */
+export function matchHevyTitle(name) {
+ const id = HEVY_TITLE_MAP[String(name || '').trim().toLowerCase()]
+ return id && EXIDX[id] ? id : null
+}
+
// Hevy exports no category column, so every invented exercise fell through to the
// 'upper legs' default and a third of an imported history was attributed to the legs in
// the muscle map. When there is no category, read the body part off the name instead.
@@ -389,7 +400,12 @@ export function parseWorkoutCSV(text, { unit = 'kg' } = {}) {
const key = keyOf(name)
let id = resolved.get(key)
- if (id === undefined) { id = matchExercise(name); resolved.set(key, id) }
+ if (id === undefined) {
+ // Hevy CSV: prefer the generated English-title map (same table as the API import).
+ // Localized titles still fall through to the word-bag matcher.
+ id = (source === 'Hevy' ? matchHevyTitle(name) : null) || matchExercise(name)
+ resolved.set(key, id)
+ }
if (id) matched++
else {
let c = created.get(key)
diff --git a/frontend/src/lib/import-hevy.js b/frontend/src/lib/import-hevy.js
new file mode 100644
index 0000000..aa4fafd
--- /dev/null
+++ b/frontend/src/lib/import-hevy.js
@@ -0,0 +1,427 @@
+// Import a Hevy account through the public API (https://api.hevyapp.com/docs/).
+//
+// Exercise identity is Hevy's `exercise_template_id`, looked up in the generated
+// `hevy-id-map.js` table — never the localized title on a set. Regenerate the map
+// with `node scripts/build-hevy-id-map.mjs`. The API key never leaves this module's
+// callers: nothing here stores it.
+
+import { EXIDX } from './exercises.js'
+import { uid } from './format.js'
+import { isWarmupRow } from './workout-model.js'
+import { HEVY_ID_MAP, HEVY_TITLE_MAP } from './hevy-id-map.js'
+
+export { HEVY_ID_MAP, HEVY_TITLE_MAP }
+export const HEVY_API = 'https://api.hevyapp.com'
+export const HEVY_DEV_SETTINGS = 'https://hevy.com/settings?developer'
+
+const LB_TO_KG = 0.45359237
+
+/* --------------------------------------------------------------- auth/fetch -- */
+
+class HevyApiError extends Error {
+ constructor(status, message) {
+ super(message || `Hevy API error ${status}`)
+ this.name = 'HevyApiError'
+ this.status = status
+ }
+}
+
+async function hevyGet(path, apiKey, params = {}) {
+ const url = new URL(path, HEVY_API)
+ 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')
+ }
+ 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. */
+export async function fetchHevyPages(path, apiKey, {
+ resultKey,
+ pageSize = 10,
+ onProgress,
+} = {}) {
+ const items = []
+ let page = 1
+ let pageCount = 1
+ while (page <= pageCount) {
+ const data = await hevyGet(path, apiKey, { page, pageSize })
+ pageCount = Math.max(1, data.page_count || 1)
+ const batch = data[resultKey] || []
+ items.push(...batch)
+ onProgress && onProgress({ page, pageCount, loaded: items.length, resultKey })
+ if (!batch.length) break
+ page++
+ }
+ return items
+}
+
+export async function fetchHevyAccount(apiKey, { onProgress } = {}) {
+ const key = String(apiKey || '').trim()
+ if (!key) throw new HevyApiError(0, 'empty')
+
+ const templates = await fetchHevyPages('/v1/exercise_templates', key, {
+ resultKey: 'exercise_templates', pageSize: 100,
+ onProgress: p => onProgress && onProgress({ stage: 'templates', ...p }),
+ })
+ const workouts = await fetchHevyPages('/v1/workouts', key, {
+ resultKey: 'workouts', pageSize: 10,
+ onProgress: p => onProgress && onProgress({ stage: 'workouts', ...p }),
+ })
+ const routines = await fetchHevyPages('/v1/routines', key, {
+ resultKey: 'routines', pageSize: 10,
+ onProgress: p => onProgress && onProgress({ stage: 'routines', ...p }),
+ })
+ let bodyMeasurements = []
+ try {
+ bodyMeasurements = await fetchHevyPages('/v1/body_measurements', key, {
+ resultKey: 'body_measurements', pageSize: 10,
+ onProgress: p => onProgress && onProgress({ stage: 'body', ...p }),
+ })
+ } catch (e) {
+ // Older keys / accounts may lack measurements — workouts still import.
+ if (!(e instanceof HevyApiError) || e.message === 'auth') throw e
+ }
+ return { templates, workouts, routines, bodyMeasurements }
+}
+
+/* ---------------------------------------------------------- template → id -- */
+
+// Hevy primary_muscle_group → openGym body-part for exercises we invent.
+const HEVY_BP = {
+ biceps: 'upper arms', triceps: 'upper arms', forearms: 'lower arms',
+ chest: 'chest', lats: 'back', upper_back: 'back', lower_back: 'back',
+ traps: 'back', shoulders: 'shoulders',
+ abdominals: 'waist', abs: 'waist', obliques: 'waist',
+ quadriceps: 'upper legs', hamstrings: 'upper legs', glutes: 'upper legs',
+ abductors: 'upper legs', adductors: 'upper legs', calves: 'lower legs',
+ cardio: 'cardio', full_body: 'upper legs', other: 'upper legs', neck: 'neck',
+}
+
+/**
+ * Resolve a Hevy exercise template to a catalogue id.
+ *
+ * Deterministic: only `HEVY_ID_MAP` (generated by scripts/build-hevy-id-map.mjs).
+ * No runtime name guessing — unmatched templates become custom exercises.
+ */
+export function matchHevyTemplate(template) {
+ if (!template?.id) return null
+ const id = HEVY_ID_MAP[template.id]
+ return id && EXIDX[id] ? id : null
+}
+
+/** Build templateId → catalogue id (or null) from a templates list. */
+export function buildHevyExerciseMap(templates) {
+ const map = new Map()
+ for (const t of templates || []) {
+ if (!t?.id) continue
+ map.set(t.id, matchHevyTemplate(t))
+ }
+ return map
+}
+
+/* --------------------------------------------------------------- parse ---- */
+
+const p2 = n => String(n).padStart(2, '0')
+
+/** Hevy ISO timestamps → local calendar date + ms-since-midnight (matches CSV import). */
+export function localWhen(iso) {
+ const d = new Date(iso)
+ if (isNaN(d.getTime())) return null
+ const day = `${d.getFullYear()}-${p2(d.getMonth() + 1)}-${p2(d.getDate())}`
+ const t = d.getHours() * 3600000 + d.getMinutes() * 60000 + d.getSeconds() * 1000
+ return { d: day, t }
+}
+
+function bpOfTemplate(t) {
+ const g = String(t?.primary_muscle_group || '').toLowerCase()
+ return HEVY_BP[g] || 'upper legs'
+}
+
+/** Shared resolver: HEVY_ID_MAP hit, else one custom exercise per Hevy template id. */
+function makeResolver(templates) {
+ const byId = new Map((templates || []).map(t => [t.id, t]))
+ const created = new Map()
+ const unmatched = new Set()
+ const matchedIds = new Set()
+
+ const resolve = (templateId, fallbackTitle) => {
+ const pinned = templateId && HEVY_ID_MAP[templateId]
+ if (pinned && EXIDX[pinned]) {
+ matchedIds.add(pinned)
+ return pinned
+ }
+ const key = templateId || String(fallbackTitle || '').toLowerCase()
+ if (!key) return null
+ let c = created.get(key)
+ if (!c) {
+ const t = templateId ? byId.get(templateId) : null
+ const name = (t?.title || fallbackTitle || 'exercise').toLowerCase()
+ c = {
+ id: 'im' + uid(), n: name, custom: true, eq: 'custom', tg: '', desc: '',
+ bp: bpOfTemplate(t) || (t?.type === 'distance_duration' || t?.type === 'duration' ? 'cardio' : null)
+ || 'upper legs',
+ }
+ created.set(key, c)
+ unmatched.add(t?.title || fallbackTitle || name)
+ }
+ return c.id
+ }
+
+ return {
+ resolve,
+ byId,
+ customEx: () => [...created.values()],
+ unmatchedNames: () => [...unmatched].sort(),
+ matchedCount: () => matchedIds.size,
+ createdCount: () => created.size,
+ }
+}
+
+const toProfileWeight = (wKg, unit) => {
+ if (wKg == null || !isFinite(wKg)) return 0
+ if (unit === 'lb') return Math.round(wKg / LB_TO_KG * 10) / 10
+ return Math.round(wKg * 10) / 10
+}
+
+/**
+ * Turn Hevy API workouts into the same shape `mergeImport` already understands.
+ * Mapping is by `exercise_template_id` through `HEVY_ID_MAP` only — localized
+ * titles on each set are never used to pick a catalogue entry.
+ */
+export function parseHevyWorkouts(workouts, templates, { unit = 'kg' } = {}) {
+ const R = makeResolver(templates)
+ const byDate = new Map()
+ let sets = 0, skipped = 0, matched = 0, warmups = 0, rpeSets = 0
+
+ for (const w of workouts || []) {
+ const start = localWhen(w.start_time)
+ const end = localWhen(w.end_time)
+ if (!start) { skipped++; continue }
+
+ let day = byDate.get(start.d)
+ if (!day) {
+ day = { ex: new Map(), name: w.title || '', start: start.t, end: end?.t ?? null }
+ byDate.set(start.d, day)
+ } else if (!day.name && w.title) day.name = w.title
+ if (end?.t != null) day.end = end.t
+
+ for (const ex of w.exercises || []) {
+ const id = R.resolve(ex.exercise_template_id, ex.title)
+ if (!id) { skipped++; continue }
+ if (EXIDX[id] && !String(id).startsWith('im')) matched++
+
+ if (!day.ex.has(id)) day.ex.set(id, [])
+ const list = day.ex.get(id)
+
+ for (const s of ex.sets || []) {
+ const warmup = /warm/i.test(String(s.type || ''))
+ if (warmup) warmups++
+ const reps = s.reps != null ? Math.round(s.reps) : 0
+ const wgt = toProfileWeight(s.weight_kg, unit)
+ const secs = s.duration_seconds != null ? Number(s.duration_seconds) : 0
+ const km = s.distance_meters != null ? Number(s.distance_meters) / 1000 : 0
+ if (!wgt && !reps && !secs && !km) { skipped++; continue }
+
+ const isCardio = (km > 0 || secs > 0) && !reps
+ const mins = secs > 0 ? Math.round(secs / 60 * 10) / 10 : 0
+ const set = isCardio
+ ? { min: mins, speed: mins > 0 ? Math.round(km / (mins / 60) * 10) / 10 : 0, done: true, ...(warmup ? { phase: 'warmup' } : {}) }
+ : { w: wgt, r: reps || 0, done: true, ...(warmup ? { phase: 'warmup' } : {}) }
+
+ if (!isCardio && s.rpe != null && isFinite(Number(s.rpe)) && Number(s.rpe) > 0) {
+ set.rpe = Math.min(10, Math.round(Number(s.rpe) * 100) / 100)
+ rpeSets++
+ }
+ list.push(set)
+ sets++
+ }
+ }
+ }
+
+ const dates = [...byDate.keys()].sort()
+ const outWorkouts = dates.map(d => {
+ const day = byDate.get(d)
+ const entries = [...day.ex.entries()].map(([id, ss]) => {
+ const mx = Math.max(0, ...ss.filter(s => !isWarmupRow(s)).map(s => s.w || 0))
+ return { id, sets: ss, topW: mx || null }
+ })
+ const base = new Date(d + 'T00:00:00').getTime()
+ const startMs = base + (day.start ?? 18 * 3600000)
+ const endMs = day.end != null ? base + day.end : startMs
+ const workout = {
+ id: 'iw' + uid(), d, start: startMs, end: endMs > startMs ? endMs : startMs,
+ routineId: null, name: day.name || 'Imported', entries, prs: [],
+ }
+ workout.vol = entries.reduce((a, e) => a + e.sets.reduce((b, s) => b + (s.w || 0) * (s.r || 0), 0), 0)
+ return workout
+ })
+
+ return {
+ kind: 'workouts',
+ source: 'Hevy',
+ workouts: outWorkouts,
+ customEx: R.customEx(),
+ matched: R.matchedCount(),
+ matchedSets: matched,
+ created: R.createdCount(),
+ unmatchedNames: R.unmatchedNames(),
+ sets, skipped, warmups,
+ fileUnit: 'kg',
+ mixedUnits: false,
+ converted: unit === 'lb',
+ rpeSets, rirSets: 0,
+ from: dates[0] || null,
+ to: dates[dates.length - 1] || null,
+ }
+}
+
+/**
+ * Hevy routine → openGym routine config.
+ * Work sets become `sets`×`reps`/`weight`; warm-ups become `warmupSets`;
+ * supersets keep adjacency via `sg`. Always imported as *new* routines.
+ */
+export function parseHevyRoutines(routines, templates, { unit = 'kg' } = {}) {
+ const R = makeResolver(templates)
+ const out = []
+
+ for (const r of routines || []) {
+ const ex = []
+ const sgMap = new Map() // Hevy superset_id → openGym sg token
+
+ for (const he of r.exercises || []) {
+ const id = R.resolve(he.exercise_template_id, he.title)
+ if (!id) continue
+
+ const allSets = he.sets || []
+ const warm = allSets.filter(s => /warm/i.test(String(s.type || ''))).length
+ const work = allSets.filter(s => !/warm/i.test(String(s.type || '')))
+ if (!work.length && !warm) continue
+
+ const sample = work[0] || allSets[0]
+ const reps = sample?.reps != null ? Math.round(sample.reps) : 0
+ const secs = sample?.duration_seconds != null ? Number(sample.duration_seconds) : 0
+ const km = sample?.distance_meters != null ? Number(sample.distance_meters) / 1000 : 0
+ const wgt = toProfileWeight(sample?.weight_kg, unit)
+ const nWork = Math.max(1, work.length)
+
+ let cfg
+ if (km > 0 && !reps) {
+ const mins = secs > 0 ? Math.round(secs / 60 * 10) / 10 : 20
+ cfg = {
+ id, sets: nWork, min: mins || 20,
+ speed: mins > 0 ? Math.round(km / (mins / 60) * 10) / 10 : 0,
+ }
+ } else if (secs > 0 && !reps && !wgt) {
+ cfg = { id, sets: nWork, sec: Math.round(secs), weight: 0, mode: 'time' }
+ } else {
+ cfg = { id, sets: nWork, reps: reps || 10, weight: wgt || 0, mode: 'reps' }
+ }
+ if (warm > 0) cfg.warmupSets = Math.min(5, warm)
+ if (he.notes) cfg.note = String(he.notes).slice(0, 280)
+
+ if (he.superset_id != null && he.superset_id !== '') {
+ const key = String(he.superset_id)
+ if (!sgMap.has(key)) sgMap.set(key, 'hs' + uid())
+ cfg.sg = sgMap.get(key)
+ }
+ ex.push(cfg)
+ }
+
+ if (!ex.length) continue
+ // Drop singleton supersets (partner missing after drops).
+ ex.forEach((e, i) => {
+ if (e.sg && !(ex[i - 1]?.sg === e.sg || ex[i + 1]?.sg === e.sg)) delete e.sg
+ })
+
+ out.push({
+ id: 'hr' + uid(),
+ name: (r.title || 'Imported').trim() || 'Imported',
+ emoji: 'figureStrength',
+ hevyId: r.id || null,
+ ex,
+ })
+ }
+
+ return {
+ kind: 'routines',
+ source: 'Hevy',
+ routines: out,
+ customEx: R.customEx(),
+ matched: R.matchedCount(),
+ created: R.createdCount(),
+ unmatchedNames: R.unmatchedNames(),
+ exerciseCount: out.reduce((n, r) => n + r.ex.length, 0),
+ converted: unit === 'lb',
+ }
+}
+
+/** Merge Hevy routines into state — always added as new routines (fresh ids). */
+export function mergeHevyRoutines(S, parsed) {
+ S.customEx = S.customEx || []
+ S.routines = S.routines || []
+ const exIdMap = {}
+ ;(parsed.customEx || []).forEach(c => {
+ const same = S.customEx.find(x => (x.n || '').toLowerCase() === (c.n || '').toLowerCase() && x.bp === c.bp)
+ if (same) { exIdMap[c.id] = same.id; return }
+ // 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
+ for (const r of parsed.routines || []) {
+ S.routines.push({
+ id: uid(),
+ name: r.name,
+ emoji: r.emoji || 'figureStrength',
+ ex: (r.ex || []).map(e => ({ ...e, id: exIdMap[e.id] || e.id })),
+ })
+ added++
+ }
+ return { added }
+}
+
+/** Body measurements from the Hevy API → `mergeImport` bodyweight shape. */
+export function parseHevyBodyweight(measurements, { unit = 'kg' } = {}) {
+ const out = new Map()
+ for (const m of measurements || []) {
+ const d = String(m.date || '').slice(0, 10)
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(d)) continue
+ let w = Number(m.weight_kg)
+ if (!isFinite(w) || w <= 0) continue
+ if (unit === 'lb') w = Math.round(w / LB_TO_KG * 10) / 10
+ else w = Math.round(w * 10) / 10
+ const t = m.created_at ? new Date(m.created_at).getTime() : new Date(d + 'T12:00:00').getTime()
+ out.set(d, { d, w, t: isFinite(t) ? t : new Date(d + 'T12:00:00').getTime() })
+ }
+ const dates = [...out.keys()].sort()
+ return {
+ kind: 'bodyweight',
+ source: 'Hevy',
+ bodyweight: dates.map(d => out.get(d)),
+ fileUnit: 'kg',
+ converted: unit === 'lb',
+ from: dates[0] || null,
+ to: dates[dates.length - 1] || null,
+ }
+}
+
+/**
+ * Fetch + parse. Returns `{ workouts, routines, bodyweight }` ready to merge,
+ * or throws `HevyApiError`. The apiKey is only read here — never written.
+ */
+export async function importHevyData(apiKey, { unit = 'kg', onProgress } = {}) {
+ const { templates, workouts, routines, bodyMeasurements } = await fetchHevyAccount(apiKey, { onProgress })
+ onProgress && onProgress({ stage: 'parse' })
+ return {
+ workouts: parseHevyWorkouts(workouts, templates, { unit }),
+ routines: parseHevyRoutines(routines, templates, { unit }),
+ bodyweight: parseHevyBodyweight(bodyMeasurements, { unit }),
+ templateCount: templates.length,
+ }
+}
+
+export { HevyApiError }
diff --git a/frontend/src/lib/import-hevy.test.js b/frontend/src/lib/import-hevy.test.js
new file mode 100644
index 0000000..ec2a65e
--- /dev/null
+++ b/frontend/src/lib/import-hevy.test.js
@@ -0,0 +1,291 @@
+import { describe, expect, it, vi, afterEach } from 'vitest'
+import {
+ matchHevyTemplate, buildHevyExerciseMap, parseHevyWorkouts, parseHevyBodyweight,
+ parseHevyRoutines, mergeHevyRoutines, localWhen, importHevyData, HevyApiError, HEVY_ID_MAP,
+} from './import-hevy.js'
+import { EXIDX } from './exercises.js'
+import { mergeImport } from './import-csv.js'
+
+const TEMPLATES = [
+ {
+ id: '3303376C', title: 'Elliptical Trainer', type: 'distance_duration',
+ primary_muscle_group: 'cardio', secondary_muscle_groups: [], equipment: 'machine', is_custom: false,
+ },
+ {
+ id: '4E5257DE', title: 'Lat Pulldown - Close Grip (Cable)', type: 'weight_reps',
+ primary_muscle_group: 'lats', secondary_muscle_groups: [], equipment: 'machine', is_custom: false,
+ },
+ {
+ id: 'DEADBEEF', title: 'My Invented Landmine Twist', type: 'weight_reps',
+ primary_muscle_group: 'abdominals', secondary_muscle_groups: [], equipment: 'other', is_custom: true,
+ },
+ {
+ id: '99D5F10E', title: 'Ab Wheel', type: 'reps_only',
+ primary_muscle_group: 'abdominals', secondary_muscle_groups: [], equipment: 'other', is_custom: false,
+ },
+]
+
+const WORKOUT = {
+ id: 'w1',
+ title: 'Oberkörper 2',
+ start_time: '2026-08-25T10:10:24+00:00',
+ end_time: '2026-08-25T11:10:08+00:00',
+ exercises: [
+ {
+ index: 0,
+ title: 'Crosstrainer', // localized — must NOT drive the match
+ exercise_template_id: '3303376C',
+ sets: [{
+ index: 0, type: 'normal', weight_kg: null, reps: null,
+ distance_meters: 480, duration_seconds: 180, rpe: null,
+ }],
+ },
+ {
+ index: 1,
+ title: 'Latzug - Enger Griff (Kabel)',
+ exercise_template_id: '4E5257DE',
+ sets: [
+ { index: 0, type: 'warmup', weight_kg: 25, reps: 15, distance_meters: null, duration_seconds: null, rpe: null },
+ { index: 1, type: 'normal', weight_kg: 52, reps: 15, distance_meters: null, duration_seconds: null, rpe: 8 },
+ { index: 2, type: 'normal', weight_kg: 52, reps: 10, distance_meters: null, duration_seconds: null, rpe: null },
+ ],
+ },
+ {
+ index: 2,
+ title: 'Meine Eigenkreation',
+ exercise_template_id: 'DEADBEEF',
+ sets: [
+ { index: 0, type: 'normal', weight_kg: 20, reps: 12, distance_meters: null, duration_seconds: null, rpe: null },
+ ],
+ },
+ ],
+}
+
+describe('HEVY_ID_MAP', () => {
+ it('only points at real catalogue ids', () => {
+ for (const id of Object.values(HEVY_ID_MAP)) {
+ expect(EXIDX[id], `catalogue missing ${id}`).toBeTruthy()
+ }
+ })
+
+ // Real import leftovers: same lifts under Hevy's naming. Map lookup is the
+ // only resolution path — titles are never guessed at runtime.
+ const PINNED = {
+ B5D3A742: '0410', // Bulgarian Split Squat (Dumbbell)
+ '914F3A96': '0327', // Chest Supported Incline Row (Dumbbell)
+ '98237BA2': '0826', // Knee Raise Parallel Bars
+ '4E5257DE': '2616', // Lat Pulldown - Close Grip (Cable)
+ C315DC2A: '0602', // Rear Delt Reverse Fly (Cable)
+ FFDA283B: '0381', // Reverse Lunge (Dumbbell)
+ '8BAB2735': '0318', // Seated Incline Curl (Dumbbell)
+ '9237BAD1': '0603', // Seated Shoulder Press (Machine)
+ B05C2C29: '0605', // Single Leg Standing Calf Raise (Machine)
+ '3303376C': '2141', // Elliptical Trainer
+ '99D5F10E': '0857', // Ab Wheel
+ }
+ for (const [hid, want] of Object.entries(PINNED)) {
+ it(`maps ${hid} → ${want} (${EXIDX[want]?.n})`, () => {
+ expect(HEVY_ID_MAP[hid]).toBe(want)
+ expect(matchHevyTemplate({ id: hid, title: 'ignored localized name' })).toBe(want)
+ })
+ }
+
+ it('leaves catalogue gaps unmapped (import as custom)', () => {
+ for (const id of ['68CE0B9B', '0222DB42', 'D1CD146F']) {
+ expect(HEVY_ID_MAP[id]).toBeUndefined()
+ expect(matchHevyTemplate({ id, title: 'whatever' })).toBeNull()
+ }
+ })
+})
+
+describe('matchHevyTemplate', () => {
+ it('is map-only — title never overrides the id', () => {
+ expect(matchHevyTemplate({ id: '3303376C', title: 'Totally Wrong Name' })).toBe('2141')
+ expect(matchHevyTemplate({ id: 'DEADBEEF', title: 'Bench Press' })).toBeNull()
+ })
+})
+
+describe('parseHevyWorkouts', () => {
+ it('maps by template id, not the localized workout title', () => {
+ const parsed = parseHevyWorkouts([WORKOUT], TEMPLATES, { unit: 'kg' })
+ expect(parsed.error).toBeUndefined()
+ expect(parsed.source).toBe('Hevy')
+ expect(parsed.workouts).toHaveLength(1)
+
+ const entries = parsed.workouts[0].entries
+ const elliptical = entries.find(e => e.id === '2141')
+ expect(elliptical).toBeTruthy()
+ expect(elliptical.sets[0]).toMatchObject({ min: 3, done: true })
+
+ const pulldown = entries.find(e => e.id === '2616')
+ expect(pulldown).toBeTruthy()
+ expect(pulldown.sets[0]).toMatchObject({ w: 25, r: 15, phase: 'warmup' })
+ expect(pulldown.sets[1]).toMatchObject({ w: 52, r: 15, rpe: 8 })
+ expect(pulldown.topW).toBe(52)
+ expect(parsed.warmups).toBe(1)
+ expect(parsed.rpeSets).toBe(1)
+
+ const custom = entries.find(e => String(e.id).startsWith('im'))
+ expect(custom).toBeTruthy()
+ expect(parsed.customEx.some(c => c.id === custom.id && c.n === 'my invented landmine twist')).toBe(true)
+ expect(parsed.customEx.find(c => c.id === custom.id).bp).toBe('waist')
+ expect(parsed.unmatchedNames).toContain('My Invented Landmine Twist')
+ })
+
+ it('converts kg weights into a lb profile', () => {
+ const parsed = parseHevyWorkouts([WORKOUT], TEMPLATES, { unit: 'lb' })
+ const pulldown = parsed.workouts[0].entries.find(e => e.id === '2616')
+ expect(pulldown.sets.find(s => s.r === 15 && !s.phase).w).toBeCloseTo(114.6, 0)
+ expect(parsed.converted).toBe(true)
+ })
+
+ it('merges two Hevy sessions on the same local day', () => {
+ const a = { ...WORKOUT, id: 'a', title: 'AM', exercises: [WORKOUT.exercises[0]] }
+ const b = {
+ ...WORKOUT, id: 'b', title: 'PM',
+ start_time: '2026-08-25T18:00:00+00:00',
+ end_time: '2026-08-25T19:00:00+00:00',
+ exercises: [WORKOUT.exercises[1]],
+ }
+ const parsed = parseHevyWorkouts([a, b], TEMPLATES, { unit: 'kg' })
+ expect(parsed.workouts).toHaveLength(1)
+ expect(parsed.workouts[0].entries.length).toBeGreaterThanOrEqual(2)
+ })
+})
+
+describe('parseHevyBodyweight', () => {
+ it('reads weigh-ins in the profile unit', () => {
+ const parsed = parseHevyBodyweight([
+ { id: 1, date: '2026-08-23', weight_kg: 83.2, created_at: '2026-08-23T18:22:48.070Z' },
+ ], { unit: 'kg' })
+ expect(parsed.bodyweight).toEqual([{ d: '2026-08-23', w: 83.2, t: expect.any(Number) }])
+ })
+})
+
+describe('mergeImport with Hevy payloads', () => {
+ it('adds workouts and skips days that already exist', () => {
+ const parsed = parseHevyWorkouts([WORKOUT], TEMPLATES, { unit: 'kg' })
+ const S = { workouts: [], customEx: [], exWeights: {}, bodyweight: [] }
+ const first = mergeImport(S, parsed)
+ expect(first.added).toBe(1)
+ expect(S.customEx.length).toBe(1)
+ const second = mergeImport(S, parsed)
+ expect(second.added).toBe(0)
+ expect(S.workouts).toHaveLength(1)
+ })
+})
+
+describe('localWhen', () => {
+ it('parses an ISO timestamp into a local calendar day', () => {
+ const w = localWhen('2026-08-25T10:10:24+00:00')
+ expect(w.d).toMatch(/^\d{4}-\d{2}-\d{2}$/)
+ expect(w.t).toBeGreaterThanOrEqual(0)
+ })
+})
+
+describe('importHevyData', () => {
+ afterEach(() => { vi.unstubAllGlobals(); vi.restoreAllMocks() })
+
+ it('pages templates and workouts, never persists the key', async () => {
+ const calls = []
+ vi.stubGlobal('fetch', vi.fn(async (url, opts) => {
+ calls.push({ url: String(url), key: opts.headers['api-key'] })
+ const u = String(url)
+ if (u.includes('/exercise_templates')) {
+ return { ok: true, status: 200, json: async () => ({ page: 1, page_count: 1, exercise_templates: TEMPLATES }) }
+ }
+ if (u.includes('/workouts')) {
+ return { ok: true, status: 200, json: async () => ({ page: 1, page_count: 1, workouts: [WORKOUT] }) }
+ }
+ if (u.includes('/routines')) {
+ return { ok: true, status: 200, json: async () => ({ page: 1, page_count: 1, routines: [] }) }
+ }
+ if (u.includes('/body_measurements')) {
+ return { ok: true, status: 200, json: async () => ({ page: 1, page_count: 1, body_measurements: [] }) }
+ }
+ return { ok: false, status: 404, json: async () => ({}) }
+ }))
+
+ const result = await importHevyData('test-key-not-stored', { unit: 'kg' })
+ expect(result.workouts.workouts).toHaveLength(1)
+ expect(result.routines.routines).toHaveLength(0)
+ expect(result.bodyweight.bodyweight).toHaveLength(0)
+ expect(calls.every(c => c.key === 'test-key-not-stored')).toBe(true)
+ })
+
+ it('surfaces a refused key as HevyApiError auth', async () => {
+ vi.stubGlobal('fetch', vi.fn(async () => ({ ok: false, status: 401, json: async () => ({}) })))
+ await expect(importHevyData('bad')).rejects.toMatchObject({ name: 'HevyApiError', message: 'auth' })
+ })
+})
+
+describe('parseHevyRoutines', () => {
+ const ROUTINE = {
+ id: 'r1',
+ title: 'Oberkörper 2',
+ exercises: [
+ {
+ title: 'Crosstrainer',
+ exercise_template_id: '3303376C',
+ superset_id: null,
+ sets: [{ type: 'normal', weight_kg: null, reps: null, distance_meters: 480, duration_seconds: 180 }],
+ },
+ {
+ title: 'Latzug',
+ exercise_template_id: '4E5257DE',
+ superset_id: 1,
+ sets: [
+ { type: 'warmup', weight_kg: 25, reps: 15 },
+ { type: 'normal', weight_kg: 52, reps: 15 },
+ { type: 'normal', weight_kg: 52, reps: 12 },
+ { type: 'normal', weight_kg: 52, reps: 10 },
+ ],
+ },
+ {
+ title: 'Row partner',
+ exercise_template_id: '914F3A96', // chest supported incline row → 0327
+ superset_id: 1,
+ sets: [
+ { type: 'normal', weight_kg: 20, reps: 12 },
+ { type: 'normal', weight_kg: 20, reps: 12 },
+ ],
+ },
+ ],
+ }
+
+ it('builds openGym routine configs from Hevy sets', () => {
+ const parsed = parseHevyRoutines([ROUTINE], TEMPLATES, { unit: 'kg' })
+ expect(parsed.routines).toHaveLength(1)
+ expect(parsed.routines[0].name).toBe('Oberkörper 2')
+ expect(parsed.exerciseCount).toBe(3)
+
+ const [cardio, pull, row] = parsed.routines[0].ex
+ expect(cardio.id).toBe('2141')
+ expect(cardio).toMatchObject({ sets: 1, min: 3 })
+ expect(pull.id).toBe('2616')
+ expect(pull).toMatchObject({ sets: 3, reps: 15, weight: 52, warmupSets: 1 })
+ expect(row.id).toBe('0327')
+ expect(pull.sg).toBeTruthy()
+ expect(pull.sg).toBe(row.sg)
+ })
+
+ it('mergeHevyRoutines always adds new routines', () => {
+ const parsed = parseHevyRoutines([ROUTINE], TEMPLATES, { unit: 'kg' })
+ const S = { routines: [], customEx: [] }
+ expect(mergeHevyRoutines(S, parsed).added).toBe(1)
+ expect(S.routines).toHaveLength(1)
+ expect(mergeHevyRoutines(S, parsed).added).toBe(1)
+ expect(S.routines).toHaveLength(2)
+ expect(S.routines[0].id).not.toBe(S.routines[1].id)
+ })
+})
+
+describe('buildHevyExerciseMap', () => {
+ it('indexes every template id from the static map', () => {
+ const map = buildHevyExerciseMap(TEMPLATES)
+ expect(map.get('3303376C')).toBe('2141')
+ expect(map.get('4E5257DE')).toBe('2616')
+ expect(map.get('DEADBEEF')).toBeNull()
+ expect(map.size).toBe(TEMPLATES.length)
+ })
+})
diff --git a/frontend/src/lib/import-match.test.js b/frontend/src/lib/import-match.test.js
index 2febc5f..c726ab8 100644
--- a/frontend/src/lib/import-match.test.js
+++ b/frontend/src/lib/import-match.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
-import { matchExercise, parseWorkoutCSV } from './import-csv.js'
+import { matchExercise, matchHevyTitle, parseWorkoutCSV, detectSource } from './import-csv.js'
import { EXIDX } from './exercises.js'
// The names other apps actually export, and the catalogue entry each has to land on.
@@ -109,3 +109,36 @@ describe('invented exercises get a body part from their name', () => {
expect(r.customEx[0].bp).toBe('shoulders')
})
})
+
+describe('Hevy CSV uses the generated title map', () => {
+ const HEVY_CSV = [
+ 'title,start_time,end_time,description,exercise_title,superset_id,exercise_notes,set_index,set_type,weight_kg,reps,distance_km,duration_seconds,rpe',
+ 'Push,2026-08-01 10:00:00,2026-08-01 11:00:00,,Bulgarian Split Squat (Dumbbell),,,0,normal,40,10,0,,',
+ 'Push,2026-08-01 10:00:00,2026-08-01 11:00:00,,Lat Pulldown - Close Grip (Cable),,,0,warmup,25,15,0,,',
+ 'Push,2026-08-01 10:00:00,2026-08-01 11:00:00,,Lat Pulldown - Close Grip (Cable),,,1,normal,52,12,0,,8',
+ 'Push,2026-08-01 10:00:00,2026-08-01 11:00:00,,Reverse Lunge (Dumbbell),,,0,normal,20,10,0,,',
+ ].join('\n')
+
+ it('detects the Hevy export dialect', () => {
+ expect(detectSource(HEVY_CSV.split('\n')[0].split(','))).toBe('Hevy')
+ })
+
+ it('resolves English Hevy titles through HEVY_TITLE_MAP before the word-bag', () => {
+ expect(matchHevyTitle('Bulgarian Split Squat (Dumbbell)')).toBe('0410')
+ expect(matchHevyTitle('Lat Pulldown - Close Grip (Cable)')).toBe('2616')
+ expect(matchHevyTitle('Reverse Lunge (Dumbbell)')).toBe('0381')
+ // Word-bag alone still misses these — the title map is what makes CSV work.
+ expect(matchExercise('Bulgarian Split Squat (Dumbbell)')).toBeNull()
+ })
+
+ it('imports a Hevy CSV onto catalogue ids, not customs', () => {
+ const parsed = parseWorkoutCSV(HEVY_CSV, { unit: 'kg' })
+ expect(parsed.source).toBe('Hevy')
+ expect(parsed.created).toBe(0)
+ const ids = parsed.workouts[0].entries.map(e => e.id).sort()
+ expect(ids).toEqual(['0410', '0381', '2616'].sort())
+ const pull = parsed.workouts[0].entries.find(e => e.id === '2616')
+ expect(pull.sets[0]).toMatchObject({ w: 25, r: 15, phase: 'warmup' })
+ expect(pull.sets[1]).toMatchObject({ w: 52, r: 12, rpe: 8 })
+ })
+})
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 86aec87..f099cd4 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -472,6 +472,33 @@ export default {
'That file is empty': 'Diese Datei ist leer',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': 'Die Spalten dieser Datei sind unbekannt — unterstützte Apps stehen in der Doku.',
'Nothing to import from that file': 'Aus dieser Datei gibt es nichts zu importieren',
+ // --- import from Hevy API ---
+ 'Import from Hevy': 'Aus Hevy importieren',
+ 'Pull your history with a Hevy Pro API key': 'Verlauf mit einem Hevy-Pro-API-Schlüssel holen',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Verlauf mit einem Hevy-Pro-API-Schlüssel holen. Der Schlüssel gilt nur für diesen Import und wird nicht gespeichert.',
+ 'Hevy API key': 'Hevy-API-Schlüssel',
+ 'Get your API key': 'API-Schlüssel holen',
+ 'Hevy → Settings → Developer': 'Hevy → Einstellungen → Developer',
+ 'Paste your Hevy API key first': 'Zuerst den Hevy-API-Schlüssel einfügen',
+ 'Fetch from Hevy': 'Von Hevy laden',
+ 'Fetching from Hevy…': 'Wird von Hevy geladen…',
+ 'Fetching exercises… ({0}/{1})': 'Übungen werden geladen… ({0}/{1})',
+ 'Fetching workouts… ({0}/{1})': 'Trainings werden geladen… ({0}/{1})',
+ 'Fetching weigh-ins… ({0}/{1})': 'Wiegungen werden geladen… ({0}/{1})',
+ 'Matching exercises…': 'Übungen werden zugeordnet…',
+ 'Could not reach Hevy — check the key and try again': 'Hevy nicht erreichbar — Schlüssel prüfen und erneut versuchen',
+ 'That Hevy API key was refused': 'Dieser Hevy-API-Schlüssel wurde abgelehnt',
+ 'Nothing to import from Hevy': 'Von Hevy gibt es nichts zu importieren',
+ 'Import workouts': 'Trainings importieren',
+ 'Import routines': 'Routinen importieren',
+ 'Import weigh-ins': 'Wiegungen importieren',
+ '{0} new · {1} days already here': '{0} neu · {1} Tage schon vorhanden',
+ '{0} routines · {1} exercises — added as new plans': '{0} Routinen · {1} Übungen — als neue Pläne hinzugefügt',
+ '{0} routines imported': '{0} Routinen importiert',
+ 'Fetching routines… ({0}/{1})': 'Routinen werden geladen… ({0}/{1})',
+ 'Routines': 'Routinen',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy speichert Gewichte in kg — sie werden nach {0} umgerechnet.',
+ 'Back': 'Zurück',
// --- mobile build ---
'Your data': 'Deine Daten',
'All data stays on this phone': 'Alle Daten bleiben auf diesem Handy',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index f2689f9..9fe5f2f 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -454,6 +454,33 @@ export default {
'That file is empty': 'Ese archivo está vacío',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': 'No se reconocen las columnas del archivo — consulta la documentación.',
'Nothing to import from that file': 'No hay nada que importar de ese archivo',
+ // --- import from Hevy API ---
+ 'Import from Hevy': 'Importar desde Hevy',
+ 'Pull your history with a Hevy Pro API key': 'Trae tu historial con una clave API de Hevy Pro',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Trae tu historial con una clave API de Hevy Pro. La clave solo se usa en esta importación y no se guarda.',
+ 'Hevy API key': 'Clave API de Hevy',
+ 'Get your API key': 'Obtener tu clave API',
+ 'Hevy → Settings → Developer': 'Hevy → Ajustes → Developer',
+ 'Paste your Hevy API key first': 'Pega primero tu clave API de Hevy',
+ 'Fetch from Hevy': 'Cargar desde Hevy',
+ 'Fetching from Hevy…': 'Cargando desde Hevy…',
+ 'Fetching exercises… ({0}/{1})': 'Cargando ejercicios… ({0}/{1})',
+ 'Fetching workouts… ({0}/{1})': 'Cargando entrenamientos… ({0}/{1})',
+ 'Fetching weigh-ins… ({0}/{1})': 'Cargando pesajes… ({0}/{1})',
+ 'Matching exercises…': 'Emparejando ejercicios…',
+ 'Could not reach Hevy — check the key and try again': 'No se pudo contactar con Hevy — revisa la clave e inténtalo de nuevo',
+ 'That Hevy API key was refused': 'Esa clave API de Hevy fue rechazada',
+ 'Nothing to import from Hevy': 'No hay nada que importar desde Hevy',
+ 'Import workouts': 'Importar entrenamientos',
+ 'Import routines': 'Importar rutinas',
+ '{0} routines · {1} exercises — added as new plans': '{0} rutinas · {1} ejercicios — se añaden como planes nuevos',
+ '{0} routines imported': '{0} rutinas importadas',
+ 'Fetching routines… ({0}/{1})': 'Cargando rutinas… ({0}/{1})',
+ 'Routines': 'Rutinas',
+ 'Import weigh-ins': 'Importar pesajes',
+ '{0} new · {1} days already here': '{0} nuevos · {1} días ya están',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy guarda los pesos en kg — se convertirán a {0}.',
+ 'Back': 'Atrás',
// --- mobile build ---
'Your data': 'Tus datos',
'All data stays on this phone': 'Todos los datos se quedan en este teléfono',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index a5d3b73..13829ee 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -454,6 +454,33 @@ export default {
'That file is empty': 'Ce fichier est vide',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': 'Colonnes non reconnues — voir la documentation pour les apps prises en charge.',
'Nothing to import from that file': 'Rien à importer depuis ce fichier',
+ // --- import from Hevy API ---
+ 'Import from Hevy': 'Importer depuis Hevy',
+ 'Pull your history with a Hevy Pro API key': 'Récupérer l’historique avec une clé API Hevy Pro',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Récupérer l’historique avec une clé API Hevy Pro. La clé ne sert qu’à cet import et n’est pas enregistrée.',
+ 'Hevy API key': 'Clé API Hevy',
+ 'Get your API key': 'Obtenir votre clé API',
+ 'Hevy → Settings → Developer': 'Hevy → Réglages → Developer',
+ 'Paste your Hevy API key first': 'Collez d’abord votre clé API Hevy',
+ 'Fetch from Hevy': 'Charger depuis Hevy',
+ 'Fetching from Hevy…': 'Chargement depuis Hevy…',
+ 'Fetching exercises… ({0}/{1})': 'Chargement des exercices… ({0}/{1})',
+ 'Fetching workouts… ({0}/{1})': 'Chargement des séances… ({0}/{1})',
+ 'Fetching weigh-ins… ({0}/{1})': 'Chargement des pesées… ({0}/{1})',
+ 'Matching exercises…': 'Association des exercices…',
+ 'Could not reach Hevy — check the key and try again': 'Impossible de joindre Hevy — vérifiez la clé et réessayez',
+ 'That Hevy API key was refused': 'Cette clé API Hevy a été refusée',
+ 'Nothing to import from Hevy': 'Rien à importer depuis Hevy',
+ 'Import workouts': 'Importer les séances',
+ 'Import routines': 'Importer les routines',
+ '{0} routines · {1} exercises — added as new plans': '{0} routines · {1} exercices — ajoutées comme nouveaux plans',
+ '{0} routines imported': '{0} routines importées',
+ 'Fetching routines… ({0}/{1})': 'Chargement des routines… ({0}/{1})',
+ 'Routines': 'Routines',
+ 'Import weigh-ins': 'Importer les pesées',
+ '{0} new · {1} days already here': '{0} nouveaux · {1} jours déjà présents',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy enregistre les poids en kg — ils seront convertis en {0}.',
+ 'Back': 'Retour',
// --- mobile build ---
'Your data': 'Vos données',
'All data stays on this phone': 'Toutes les données restent sur ce téléphone',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 6c2f340..2e9b169 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -454,6 +454,33 @@ export default {
'That file is empty': 'वह फ़ाइल खाली है',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': 'फ़ाइल के कॉलम पहचाने नहीं गए — समर्थित ऐप्स के लिए दस्तावेज़ देखें।',
'Nothing to import from that file': 'उस फ़ाइल से आयात करने को कुछ नहीं',
+ // --- import from Hevy API ---
+ 'Import from Hevy': 'Hevy से आयात करें',
+ 'Pull your history with a Hevy Pro API key': 'Hevy Pro API कुंजी से अपना इतिहास लाएँ',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Hevy Pro API कुंजी से अपना इतिहास लाएँ। कुंजी केवल इस आयात के लिए उपयोग होती है और सहेजी नहीं जाती।',
+ 'Hevy API key': 'Hevy API कुंजी',
+ 'Get your API key': 'अपनी API कुंजी लें',
+ 'Hevy → Settings → Developer': 'Hevy → सेटिंग्स → Developer',
+ 'Paste your Hevy API key first': 'पहले अपनी Hevy API कुंजी चिपकाएँ',
+ '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': 'वह Hevy API कुंजी अस्वीकार कर दी गई',
+ 'Nothing to import from Hevy': 'Hevy से आयात करने के लिए कुछ नहीं',
+ 'Import workouts': 'वर्कआउट आयात करें',
+ 'Import routines': 'रूटीन आयात करें',
+ '{0} routines · {1} exercises — added as new plans': '{0} रूटीन · {1} व्यायाम — नए प्लान के रूप में जोड़े जाते हैं',
+ '{0} routines imported': '{0} रूटीन आयात किए गए',
+ 'Fetching routines… ({0}/{1})': 'रूटीन लाए जा रहे हैं… ({0}/{1})',
+ 'Routines': 'रूटीन',
+ 'Import weigh-ins': 'वज़न आयात करें',
+ '{0} new · {1} days already here': '{0} नए · {1} दिन पहले से मौजूद',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy वज़न kg में रखता है — उन्हें {0} में बदला जाएगा।',
+ 'Back': 'वापस',
// --- mobile build ---
'Your data': 'आपका डेटा',
'All data stays on this phone': 'सारा डेटा इसी फ़ोन पर रहता है',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index ecf0038..4427b65 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -454,6 +454,33 @@ export default {
'That file is empty': 'Il file è vuoto',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': 'Colonne non riconosciute — vedi la documentazione per le app supportate.',
'Nothing to import from that file': 'Niente da importare da questo file',
+ // --- import from Hevy API ---
+ 'Import from Hevy': 'Importa da Hevy',
+ 'Pull your history with a Hevy Pro API key': 'Importa lo storico con una chiave API Hevy Pro',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Importa lo storico con una chiave API Hevy Pro. La chiave serve solo a questo import e non viene salvata.',
+ 'Hevy API key': 'Chiave API Hevy',
+ 'Get your API key': 'Ottieni la chiave API',
+ 'Hevy → Settings → Developer': 'Hevy → Impostazioni → Developer',
+ 'Paste your Hevy API key first': 'Incolla prima la chiave API Hevy',
+ 'Fetch from Hevy': 'Scarica da Hevy',
+ 'Fetching from Hevy…': 'Download da Hevy…',
+ 'Fetching exercises… ({0}/{1})': 'Download esercizi… ({0}/{1})',
+ 'Fetching workouts… ({0}/{1})': 'Download allenamenti… ({0}/{1})',
+ 'Fetching weigh-ins… ({0}/{1})': 'Download pesate… ({0}/{1})',
+ 'Matching exercises…': 'Abbinamento esercizi…',
+ 'Could not reach Hevy — check the key and try again': 'Impossibile contattare Hevy — controlla la chiave e riprova',
+ 'That Hevy API key was refused': 'Questa chiave API Hevy è stata rifiutata',
+ 'Nothing to import from Hevy': 'Niente da importare da Hevy',
+ 'Import workouts': 'Importa allenamenti',
+ 'Import routines': 'Importa routine',
+ '{0} routines · {1} exercises — added as new plans': '{0} routine · {1} esercizi — aggiunte come nuovi piani',
+ '{0} routines imported': '{0} routine importate',
+ 'Fetching routines… ({0}/{1})': 'Download routine… ({0}/{1})',
+ 'Routines': 'Routine',
+ 'Import weigh-ins': 'Importa pesate',
+ '{0} new · {1} days already here': '{0} nuovi · {1} giorni già presenti',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy memorizza i pesi in kg — verranno convertiti in {0}.',
+ 'Back': 'Indietro',
// --- mobile build ---
'Your data': 'I tuoi dati',
'All data stays on this phone': 'Tutti i dati restano su questo telefono',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 8feea1e..a679ef8 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -454,6 +454,33 @@ export default {
'That file is empty': '파일이 비어 있습니다',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': '열을 인식할 수 없습니다 — 지원 앱은 문서를 참고하세요.',
'Nothing to import from that file': '이 파일에서 가져올 내용이 없습니다',
+ // --- import from Hevy API ---
+ 'Import from Hevy': 'Hevy에서 가져오기',
+ 'Pull your history with a Hevy Pro API key': 'Hevy Pro API 키로 기록을 가져옵니다',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Hevy Pro API 키로 기록을 가져옵니다. 키는 이번 가져오기에만 사용되며 저장되지 않습니다.',
+ 'Hevy API key': 'Hevy API 키',
+ 'Get your API key': 'API 키 받기',
+ 'Hevy → Settings → Developer': 'Hevy → 설정 → Developer',
+ 'Paste your Hevy API key first': '먼저 Hevy API 키를 붙여넣으세요',
+ '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': 'Hevy API 키가 거부되었습니다',
+ 'Nothing to import from Hevy': 'Hevy에서 가져올 항목이 없습니다',
+ 'Import workouts': '운동 기록 가져오기',
+ 'Import routines': '루틴 가져오기',
+ '{0} routines · {1} exercises — added as new plans': '루틴 {0}개 · 운동 {1}개 — 새 계획으로 추가',
+ '{0} routines imported': '루틴 {0}개 가져옴',
+ 'Fetching routines… ({0}/{1})': '루틴 가져오는 중… ({0}/{1})',
+ 'Routines': '루틴',
+ 'Import weigh-ins': '체중 가져오기',
+ '{0} new · {1} days already here': '새 {0}개 · 이미 있는 날 {1}개',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy는 무게를 kg로 저장합니다 — {0}(으)로 변환됩니다.',
+ 'Back': '뒤로',
// --- mobile build ---
'Your data': '내 데이터',
'All data stays on this phone': '모든 데이터는 이 휴대폰에만 저장됩니다',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 14f82e2..4a9dae1 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -454,6 +454,33 @@ export default {
'That file is empty': 'Ten plik jest pusty',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': 'Nie rozpoznano kolumn — obsługiwane aplikacje znajdziesz w dokumentacji.',
'Nothing to import from that file': 'Brak danych do importu z tego pliku',
+ // --- import from Hevy API ---
+ 'Import from Hevy': 'Importuj z Hevy',
+ 'Pull your history with a Hevy Pro API key': 'Pobierz historię kluczem API Hevy Pro',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Pobierz historię kluczem API Hevy Pro. Klucz służy tylko do tego importu i nie jest zapisywany.',
+ 'Hevy API key': 'Klucz API Hevy',
+ 'Get your API key': 'Pobierz klucz API',
+ 'Hevy → Settings → Developer': 'Hevy → Ustawienia → Developer',
+ 'Paste your Hevy API key first': 'Najpierw wklej klucz API Hevy',
+ 'Fetch from Hevy': 'Pobierz z Hevy',
+ 'Fetching from Hevy…': 'Pobieranie z Hevy…',
+ 'Fetching exercises… ({0}/{1})': 'Pobieranie ćwiczeń… ({0}/{1})',
+ 'Fetching workouts… ({0}/{1})': 'Pobieranie treningów… ({0}/{1})',
+ 'Fetching weigh-ins… ({0}/{1})': 'Pobieranie ważenia… ({0}/{1})',
+ 'Matching exercises…': 'Dopasowywanie ćwiczeń…',
+ 'Could not reach Hevy — check the key and try again': 'Nie udało się połączyć z Hevy — sprawdź klucz i spróbuj ponownie',
+ 'That Hevy API key was refused': 'Ten klucz API Hevy został odrzucony',
+ 'Nothing to import from Hevy': 'Nie ma nic do zaimportowania z Hevy',
+ 'Import workouts': 'Importuj treningi',
+ 'Import routines': 'Importuj rutyny',
+ '{0} routines · {1} exercises — added as new plans': '{0} rutyn · {1} ćwiczeń — dodane jako nowe plany',
+ '{0} routines imported': 'Zaimportowano {0} rutyn',
+ 'Fetching routines… ({0}/{1})': 'Pobieranie rutyn… ({0}/{1})',
+ 'Routines': 'Rutyny',
+ 'Import weigh-ins': 'Importuj ważenia',
+ '{0} new · {1} days already here': '{0} nowych · {1} dni już jest',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy zapisuje ciężary w kg — zostaną przeliczone na {0}.',
+ 'Back': 'Wstecz',
// --- mobile build ---
'Your data': 'Twoje dane',
'All data stays on this phone': 'Wszystkie dane zostają na tym telefonie',
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 4438843..7cf9b90 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -138,6 +138,33 @@ export const PT_BR_OVERRIDES = {
'That file\'s columns aren\'t recognised — see the docs for supported apps.': 'Colunas não reconhecidas — consulte a documentação dos aplicativos compatíveis.',
'That file is empty': 'Esse arquivo está vazio',
'Nothing to import from that file': 'Não há nada para importar desse arquivo',
+ // --- import from Hevy API ---
+ 'Import from Hevy': 'Importar do Hevy',
+ 'Pull your history with a Hevy Pro API key': 'Traga seu histórico com uma chave de API do Hevy Pro',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Traga seu histórico com uma chave de API do Hevy Pro. A chave só é usada nesta importação e não é salva.',
+ 'Hevy API key': 'Chave de API do Hevy',
+ 'Get your API key': 'Obter sua chave de API',
+ 'Hevy → Settings → Developer': 'Hevy → Configurações → Developer',
+ 'Paste your Hevy API key first': 'Cole primeiro sua chave de API do Hevy',
+ 'Fetch from Hevy': 'Buscar no Hevy',
+ 'Fetching from Hevy…': 'Buscando no Hevy…',
+ 'Fetching exercises… ({0}/{1})': 'Buscando exercícios… ({0}/{1})',
+ 'Fetching workouts… ({0}/{1})': 'Buscando treinos… ({0}/{1})',
+ 'Fetching weigh-ins… ({0}/{1})': 'Buscando pesagens… ({0}/{1})',
+ 'Matching exercises…': 'Associando exercícios…',
+ 'Could not reach Hevy — check the key and try again': 'Não foi possível contatar o Hevy — confira a chave e tente de novo',
+ 'That Hevy API key was refused': 'Essa chave de API do Hevy foi recusada',
+ 'Nothing to import from Hevy': 'Nada para importar do Hevy',
+ 'Import workouts': 'Importar treinos',
+ 'Import routines': 'Importar rotinas',
+ '{0} routines · {1} exercises — added as new plans': '{0} rotinas · {1} exercícios — adicionadas como planos novos',
+ '{0} routines imported': '{0} rotinas importadas',
+ 'Fetching routines… ({0}/{1})': 'Buscando rotinas… ({0}/{1})',
+ 'Routines': 'Rotinas',
+ 'Import weigh-ins': 'Importar pesagens',
+ '{0} new · {1} days already here': '{0} novos · {1} dias já existentes',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'O Hevy guarda os pesos em kg — eles serão convertidos para {0}.',
+ 'Back': 'Voltar',
'Your data': 'Seus dados',
'All data stays on this phone': 'Todos os dados ficam neste celular',
'No account, no cloud — back it up anytime with Export below.': 'Sem conta e sem nuvem — faça um backup quando quiser usando a opção Exportar abaixo.',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 034c7d6..7ccddec 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -454,6 +454,33 @@ export default {
'That file is empty': 'Esse ficheiro está vazio',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': 'Colunas não reconhecidas — vê a documentação para apps suportadas.',
'Nothing to import from that file': 'Nada para importar desse ficheiro',
+ // --- import from Hevy API ---
+ 'Import from Hevy': 'Importar do Hevy',
+ 'Pull your history with a Hevy Pro API key': 'Traz o historial com uma chave API Hevy Pro',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Traz o historial com uma chave API Hevy Pro. A chave só é usada neste import e não é guardada.',
+ 'Hevy API key': 'Chave API Hevy',
+ 'Get your API key': 'Obter a chave API',
+ 'Hevy → Settings → Developer': 'Hevy → Definições → Developer',
+ 'Paste your Hevy API key first': 'Cola primeiro a chave API Hevy',
+ 'Fetch from Hevy': 'Carregar do Hevy',
+ 'Fetching from Hevy…': 'A carregar do Hevy…',
+ 'Fetching exercises… ({0}/{1})': 'A carregar exercícios… ({0}/{1})',
+ 'Fetching workouts… ({0}/{1})': 'A carregar treinos… ({0}/{1})',
+ 'Fetching weigh-ins… ({0}/{1})': 'A carregar pesagens… ({0}/{1})',
+ 'Matching exercises…': 'A associar exercícios…',
+ 'Could not reach Hevy — check the key and try again': 'Não foi possível contactar o Hevy — verifica a chave e tenta de novo',
+ 'That Hevy API key was refused': 'Essa chave API Hevy foi recusada',
+ 'Nothing to import from Hevy': 'Nada para importar do Hevy',
+ 'Import workouts': 'Importar treinos',
+ 'Import routines': 'Importar rotinas',
+ '{0} routines · {1} exercises — added as new plans': '{0} rotinas · {1} exercícios — adicionadas como planos novos',
+ '{0} routines imported': '{0} rotinas importadas',
+ 'Fetching routines… ({0}/{1})': 'A carregar rotinas… ({0}/{1})',
+ 'Routines': 'Rotinas',
+ 'Import weigh-ins': 'Importar pesagens',
+ '{0} new · {1} days already here': '{0} novos · {1} dias já existentes',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'O Hevy guarda os pesos em kg — serão convertidos para {0}.',
+ 'Back': 'Voltar',
// --- mobile build ---
'Your data': 'Os teus dados',
'All data stays on this phone': 'Todos os dados ficam neste telemóvel',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index ff087a9..c7e74c7 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -454,6 +454,33 @@ export default {
'That file is empty': 'Файл пуст',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': 'Колонки не распознаны — список поддерживаемых приложений в документации.',
'Nothing to import from that file': 'В этом файле нечего импортировать',
+ // --- import from Hevy API ---
+ '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 → Настройки → Developer',
+ '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': 'Импортировать программы',
+ '{0} routines · {1} exercises — added as new plans': '{0} программ · {1} упражнений — добавляются как новые планы',
+ '{0} routines imported': 'Импортировано программ: {0}',
+ 'Fetching routines… ({0}/{1})': 'Загрузка программ… ({0}/{1})',
+ 'Routines': 'Программы',
+ 'Import weigh-ins': 'Импортировать взвешивания',
+ '{0} new · {1} days already here': '{0} новых · {1} дней уже есть',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy хранит веса в кг — они будут переведены в {0}.',
+ 'Back': 'Назад',
// --- mobile build ---
'Your data': 'Ваши данные',
'All data stays on this phone': 'Все данные остаются на этом телефоне',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 2742ff1..ea9b6ff 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -454,6 +454,33 @@ export default {
'That file is empty': 'Bu dosya boş',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': 'Sütunlar tanınmadı — desteklenen uygulamalar için belgelere bak.',
'Nothing to import from that file': 'Bu dosyada içe aktarılacak bir şey yok',
+ // --- import from Hevy API ---
+ 'Import from Hevy': 'Hevy’den içe aktar',
+ 'Pull your history with a Hevy Pro API key': 'Hevy Pro API anahtarıyla geçmişini çek',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Hevy Pro API anahtarıyla geçmişini çek. Anahtar yalnızca bu içe aktarım için kullanılır ve kaydedilmez.',
+ 'Hevy API key': 'Hevy API anahtarı',
+ 'Get your API key': 'API anahtarını al',
+ 'Hevy → Settings → Developer': 'Hevy → Ayarlar → Developer',
+ 'Paste your Hevy API key first': 'Önce Hevy API anahtarını yapıştır',
+ 'Fetch from Hevy': 'Hevy’den getir',
+ 'Fetching from Hevy…': 'Hevy’den getiriliyor…',
+ 'Fetching exercises… ({0}/{1})': 'Egzersizler getiriliyor… ({0}/{1})',
+ 'Fetching workouts… ({0}/{1})': 'Antrenmanlar getiriliyor… ({0}/{1})',
+ 'Fetching weigh-ins… ({0}/{1})': 'Tartımlar getiriliyor… ({0}/{1})',
+ 'Matching exercises…': 'Egzersizler eşleştiriliyor…',
+ 'Could not reach Hevy — check the key and try again': 'Hevy’ye ulaşılamadı — anahtarı kontrol edip tekrar dene',
+ 'That Hevy API key was refused': 'Bu Hevy API anahtarı reddedildi',
+ 'Nothing to import from Hevy': 'Hevy’den içe aktarılacak bir şey yok',
+ 'Import workouts': 'Antrenmanları içe aktar',
+ 'Import routines': 'Rutinleri içe aktar',
+ '{0} routines · {1} exercises — added as new plans': '{0} rutin · {1} egzersiz — yeni plan olarak eklenir',
+ '{0} routines imported': '{0} rutin içe aktarıldı',
+ 'Fetching routines… ({0}/{1})': 'Rutinler getiriliyor… ({0}/{1})',
+ 'Routines': 'Rutinler',
+ 'Import weigh-ins': 'Tartımları içe aktar',
+ '{0} new · {1} days already here': '{0} yeni · {1} gün zaten var',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy ağırlıkları kg olarak saklar — {0} birimine çevrilecek.',
+ 'Back': 'Geri',
// --- mobile build ---
'Your data': 'Verileriniz',
'All data stays on this phone': 'Tüm veriler bu telefonda kalır',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 2bf5df7..ac0cc54 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -454,6 +454,33 @@ export default {
'That file is empty': '该文件是空的',
'That file\'s columns aren\'t recognised — see the docs for supported apps.': '无法识别该文件的列 — 支持的应用请见文档。',
'Nothing to import from that file': '该文件中没有可导入的内容',
+ // --- import from Hevy API ---
+ 'Import from Hevy': '从 Hevy 导入',
+ 'Pull your history with a Hevy Pro API key': '使用 Hevy Pro API 密钥拉取训练记录',
+ 'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': '使用 Hevy Pro API 密钥拉取训练记录。密钥仅用于本次导入,不会保存。',
+ 'Hevy API key': 'Hevy API 密钥',
+ 'Get your API key': '获取 API 密钥',
+ 'Hevy → Settings → Developer': 'Hevy → 设置 → Developer',
+ 'Paste your Hevy API key first': '请先粘贴 Hevy API 密钥',
+ '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': '该 Hevy API 密钥被拒绝',
+ 'Nothing to import from Hevy': 'Hevy 没有可导入的内容',
+ 'Import workouts': '导入训练',
+ 'Import routines': '导入训练计划',
+ '{0} routines · {1} exercises — added as new plans': '{0} 个计划 · {1} 个动作 — 作为新计划添加',
+ '{0} routines imported': '已导入 {0} 个训练计划',
+ 'Fetching routines… ({0}/{1})': '正在获取计划… ({0}/{1})',
+ 'Routines': '训练计划',
+ 'Import weigh-ins': '导入体重',
+ '{0} new · {1} days already here': '{0} 条新记录 · {1} 天已有数据',
+ 'Hevy stores weights in kg — they will be converted to {0}.': 'Hevy 以公斤存储重量 — 将换算为 {0}。',
+ 'Back': '返回',
// --- mobile build ---
'Your data': '你的数据',
'All data stays on this phone': '所有数据都保存在这部手机上',
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 5e17fe9..7ce77be 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -17,6 +17,7 @@ import { glyphOf, GLYPH_GROUPS, DEFAULT_GLYPH } from './lib/glyphs.js'
import BodyMap from './components/BodyMap.jsx'
import { exerciseMuscleSnapshot, loadOfWorkouts, MUSCLES, MUSCLE_NAME, normalizeMuscleGroups, hasExplicitMuscleMetadata } from './lib/muscles.js'
import { parseImport, mergeImport } from './lib/import-csv.js'
+import { importHevyData, HevyApiError, HEVY_DEV_SETTINGS, mergeHevyRoutines } from './lib/import-hevy.js'
import { buildPlanBundle, parsePlan, mergePlan, printPlan } from './lib/plan-share.js'
import { estimate1RM, best1RM, is1RMRecord, REP_CAP } from './lib/onerm.js'
import { nextPrescription, applyPrescription, policyFor, defaultIncrement, POLICIES_FOR, POLICY_NAME, POLICY_DESC, MAX_BW_SETS } from './lib/progression.js'
@@ -239,6 +240,203 @@ export function importFromApp(file, onDone) {
rd.readAsText(file)
}
+/* ============================ import from Hevy API ============================ */
+// The key lives in React state for this sheet only — dismissed with the sheet, never
+// written to the store / localStorage / the server. After a successful fetch the user
+// picks workouts and/or weigh-ins before anything is merged.
+
+export function importFromHevy() {
+ ui().openSheet(close =>