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.

Toasts: a long message wraps across up to 88% of the screen instead of half of it, so it reads as a banner rather than a narrow column

Duarte Santosf349b6522b78
diff --git a/frontend/src/components/Toast.test.js b/frontend/src/components/Toast.test.js
index cbf6d353f..8a8130d6c 100644
--- a/frontend/src/components/Toast.test.js
+++ b/frontend/src/components/Toast.test.js
@@ -1,6 +1,7 @@
// A toast that wraps (the Coach's refusal of an http:// address runs to four lines) drew as a
// circle about 170 by 230 CSS px over the list and the button under it: its corners were a pill's
-// 99px on a box that tall (Android QA, v1.3.9). One line still has to read as a pill.
+// 99px on a box that tall, and the box only ever got half the screen's width to wrap in (Android
+// QA, v1.3.9). One line still has to read as a pill.
import { describe, expect, it } from 'vitest'
import { readFileSync } from 'node:fs'
@@ -21,4 +22,11 @@ describe('the toast', () => {
expect(radius).toBeGreaterThanOrEqual(oneLine / 2) // one line: fully rounded ends
expect(radius).toBeLessThanOrEqual(oneLine / 2 + 4) // four lines: a box with round corners
})
+
+ // left:50% leaves a box without a width half the screen to wrap in: the same message stood as
+ // a column about 206 CSS px wide and as tall.
+ it('wraps a long message across the screen, not in half of it', () => {
+ expect(rule).toMatch(/left:50%/)
+ expect(rule).toMatch(/width:max-content;max-width:88vw/)
+ })
})
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 8436ab896..1ad1e12e7 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -1354,7 +1354,9 @@ body.chips-dragging *{cursor:inherit}
border-radius:var(--r-xl);padding:11px 20px;font-size:15px;font-weight:500;
box-shadow:0 10px 30px -6px rgba(0,0,0,.5);
opacity:0;pointer-events:none;transition:opacity var(--med),transform var(--med) var(--ease);
- max-width:88vw;text-align:center;
+ /* As wide as its text up to 88vw. Without a width, left:50% left it half the screen to wrap
+ in, so a long message stood as a narrow column. */
+ width:max-content;max-width:88vw;text-align:center;
}
#toast.show{opacity:1;transform:translateX(-50%) translateY(0)}