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.

Follow-up to !140: a long role label wraps instead of losing its reps

Duarte Santosd53c99faf59b
diff --git a/frontend/src/views/StructuralBalance.jsx b/frontend/src/views/StructuralBalance.jsx
index 8f4381381..a428881a1 100644
--- a/frontend/src/views/StructuralBalance.jsx
+++ b/frontend/src/views/StructuralBalance.jsx
@@ -60,7 +60,10 @@ export default function StructuralBalance() {
<div key={r.roleId} className="mrow" data-role-id={r.roleId} data-status={r.status}
style={{ flexDirection: 'column', alignItems: 'stretch', gap: 6, paddingBlock: 10 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 12 }}>
- <span className="nm" style={{ minWidth: 0 }}>
+ {/* `.mrow .nm` keeps to one line, and its ellipsis never reaches these block lines:
+ a label is cut off mid-word instead, and what goes is its reps and "each hand" —
+ what the standard asks for. So here the name wraps. */}
+ <span className="nm" style={{ minWidth: 0, whiteSpace: 'normal', overflowWrap: 'anywhere' }}>
<span style={{ display: 'block' }}>{t(role.label)}</span>
<span className="small dim" style={{ display: 'block' }}>
{name}{r.isOverridden ? ` · ${t('Custom')}` : ''}
diff --git a/frontend/src/views/StructuralBalance.test.jsx b/frontend/src/views/StructuralBalance.test.jsx
index 662cc359a..034a6241e 100644
--- a/frontend/src/views/StructuralBalance.test.jsx
+++ b/frontend/src/views/StructuralBalance.test.jsx
@@ -71,6 +71,22 @@ describe('StructuralBalance view', () => {
expect(deadlift.textContent).toContain('No data')
})
+ // `.mrow .nm` is one line with an ellipsis that never reaches the label's block lines, so a
+ // long label (German, Russian, Hungarian at 360 px) lost its reps and "each hand" to the clip.
+ it('lets every role\'s label and exercise wrap rather than cutting them off', () => {
+ const host = render()
+ for (const tpl of TEMPLATE_LIST) {
+ const button = [...host.querySelectorAll('.seg button')].find(b => b.textContent === tpl.label)
+ act(() => button.click())
+ for (const row of host.querySelectorAll('[data-role-id]')) {
+ const name = row.querySelector('.nm')
+ expect(name.style.whiteSpace, row.dataset.roleId).toBe('normal')
+ expect(name.style.overflowWrap, row.dataset.roleId).toBe('anywhere')
+ for (const line of name.children) expect(line.style.whiteSpace).not.toBe('nowrap')
+ }
+ }
+ })
+
it('the back chevron navigates to /stats', () => {
const host = render()
act(() => host.querySelector('.iconbtn').click())