Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Stats: Week figures no longer pick up the Coach's .cmp rule line and padding (#573 follow-up)

Duarte Santosea377f5ebe2d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c78f4fbee..a6c16ace1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,8 @@ per muscle. Settings → Workout → Fine-tuning turns it off.
- **Muscle balance**: tap a muscle you haven't trained right on the map and its row offers the
exercises for it, the same way the "Not trained" chips do (#553).
+- Stats' Week rows lose a stray line over each done/planned figure, which also sat a little
+ low next to its bar.
**Security.** Follow-ups to v1.4.2's audit.
- **Pairing the phone app asks you to confirm it's you** (passkey, or your password where that
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 5039e9d3e..4cbef74cf 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -1734,8 +1734,9 @@ body.no-tabbar #timer.working{box-shadow:inset 0 var(--hair) 0 var(--acc),0 -10p
.mrow .bar i{display:block;height:100%;background:var(--acc);border-radius:3px}
.mrow .v{font-size:12px;color:var(--label-2);min-width:52px;text-align: end;flex:none}
/* The Week view's "done/planned · %" (#573): wider than a set count, and as wide on every row, so
- the bars line up the way they do in 30d, 90d and All. */
-.mrow .v.cmp{min-width:92px;font-variant-numeric:tabular-nums;white-space:nowrap}
+ the bars line up the way they do in 30d, 90d and All. coach.css has a `.cmp` of its own (the
+ Coach's comparison rows) with a rule line and padding, loaded on every page: reset both here. */
+.mrow .v.cmp{min-width:92px;font-variant-numeric:tabular-nums;white-space:nowrap;border-top:none;padding:0}
/* Selected-muscle fatigue detail: the legend's three bands as one bar, the value above
its marker, the 0–100% endpoints under it and each zone named beneath itself. Ready is
the map's unshaded base, so the left zone stays neutral; margins leave room for the
diff --git a/frontend/src/views/Stats.cmp-css.test.js b/frontend/src/views/Stats.cmp-css.test.js
new file mode 100644
index 000000000..8db221ccb
--- /dev/null
+++ b/frontend/src/views/Stats.cmp-css.test.js
@@ -0,0 +1,21 @@
+// The Week view's done/planned figure (`.mrow .v.cmp`, #573) shares its class name with the
+// Coach's comparison rows (coach.css `.cmp`: a rule line on top and 8px padding), and coach.css is
+// loaded on every page. Checked in Chrome: every Week row's figure had a hairline over it and sat
+// 8px off the bar's line. The Stats rule now resets both.
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+
+const strip = f => readFileSync(resolve(process.cwd(), f), 'utf8').replace(/\/\*[\s\S]*?\*\//g, '')
+const rule = (css, sel) => css.match(new RegExp('(^|})\\s*' + sel.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '\\{([^}]*)\\}'))?.[2] || ''
+
+describe('Stats Week figures keep clear of the Coach .cmp rule', () => {
+ it('the Coach rule is still there (or this guard can go)', () => {
+ expect(rule(strip('src/coach.css'), '.cmp')).toMatch(/border-top/)
+ })
+ it('the Stats rule resets its border and padding', () => {
+ const own = rule(strip('src/index.css'), '.mrow .v.cmp')
+ expect(own).toMatch(/border-top:none/)
+ expect(own).toMatch(/padding:0/)
+ })
+})