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.

Arabic: the retained-strength bars under a muscle in Stats fill from the right in right-to-left, like the bars around them (!36)

Duarte Santos3c81ac181939
diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsx
index 195f81ae8..79012e927 100644
--- a/frontend/src/views/Stats.jsx
+++ b/frontend/src/views/Stats.jsx
@@ -203,7 +203,9 @@ function MuscleBalance({ S }) {
</span>
<span className="small dim" style={{ display: 'block', fontWeight: 400 }}>{t('Est. 1RM')}: {fmtNum(row.est)} {S.unit} · {fmtDate(row.estDate, true)}</span>
</span>
- <span className="bar" style={{ alignSelf: 'center' }}><i style={{ width: '100%', background: 'linear-gradient(to right, var(--acc) ' + Math.round(row.decay * 100) + '%, var(--surface-2) ' + Math.round(row.decay * 100) + '%)' }} /></span>
+ {/* Filled by width, like the bars around it, rather than a 'to right' gradient: a block
+ starts at the inline start, so in right-to-left it fills from the right. */}
+ <span className="bar" style={{ alignSelf: 'center' }}><i style={{ width: Math.round(row.decay * 100) + '%' }} /></span>
<span className="v" style={{ alignSelf: 'center' }}>{fmtNum(row.current)} {S.unit}<span className="dim"> · {Math.round(row.decay * 100)}%</span></span>
</div>
)) : <div className="muted small">{t('No exercises with an estimated 1RM yet.')}</div>}
diff --git a/frontend/src/views/Stats.recovery.test.jsx b/frontend/src/views/Stats.recovery.test.jsx
index 13e9ee19c..50f20950a 100644
--- a/frontend/src/views/Stats.recovery.test.jsx
+++ b/frontend/src/views/Stats.recovery.test.jsx
@@ -342,6 +342,22 @@ describe('Stats strength exercise rows', () => {
expect(thrown).toEqual([])
expect(mocks.exerciseHistorySheet).toHaveBeenCalledTimes(2)
})
+
+ // The retained-strength bar used a 'to right' gradient, which fills from the left in Arabic too.
+ // A width fills from the inline start, the way the detrained rows' bars already did.
+ it('fills the retained-strength bar by width, so it follows the text direction', async () => {
+ resetFixture([workout('bench-old', BASE_NOW - 20 * DAY, [entry('0025', [set(true, { w: 80 })])])])
+ await mountStats()
+ await click(viewButton('Strength'))
+ await click(muscleCard().querySelector('[data-muscle="chest"]'))
+ const row = [...muscleCard().querySelectorAll('.mrow[role="button"]')].find(el => el.textContent.includes('Est. 1RM'))
+ expect(row).toBeTruthy()
+ const pct = row.querySelector('.v').textContent.match(/(\d+)%/)[1]
+ expect(Number(pct)).toBeLessThan(100)
+ const fill = row.querySelector('.bar i')
+ expect(fill.style.width).toBe(pct + '%')
+ expect(fill.getAttribute('style')).not.toMatch(/to right|gradient/)
+ })
})
describe('Stats exercise progress picker', () => {