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 message that wraps to several lines is a rounded box instead of a large circle over the page, as with the Coach's refusal of an http:// address; a one-line toast still reads as a pill

Duarte Santos15f7467e3766
diff --git a/frontend/src/components/Toast.test.js b/frontend/src/components/Toast.test.js
new file mode 100644
index 000000000..cbf6d353f
--- /dev/null
+++ b/frontend/src/components/Toast.test.js
@@ -0,0 +1,24 @@
+// 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.
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+
+const css = readFileSync(new URL('../index.css', import.meta.url), 'utf8')
+const rule = css.match(/\n#toast\{([^}]*)\}/)[1]
+const px = v => {
+ const token = v.match(/^var\((--[\w-]+)\)$/)
+ const value = token ? css.match(new RegExp(`${token[1]}:\\s*([^;]+);`))[1].trim() : v
+ return parseFloat(value)
+}
+
+describe('the toast', () => {
+ it('rounds its corners like a pill on one line, not like a circle on four', () => {
+ const radius = px(rule.match(/border-radius:([^;]+);/)[1].trim())
+ const pad = parseFloat(rule.match(/padding:(\d+)px/)[1])
+ const size = parseFloat(rule.match(/font-size:(\d+)px/)[1])
+ const oneLine = 2 * pad + size * 1.29 // body line-height
+ expect(radius).toBeGreaterThanOrEqual(oneLine / 2) // one line: fully rounded ends
+ expect(radius).toBeLessThanOrEqual(oneLine / 2 + 4) // four lines: a box with round corners
+ })
+})
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 0cc8ff311..8436ab896 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -1349,7 +1349,9 @@ body.chips-dragging *{cursor:inherit}
bottom:calc(96px + var(--sab));z-index:200;
background:color-mix(in srgb,var(--surface-2) 88%,transparent);
-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);
- border-radius:99px;padding:11px 20px;font-size:15px;font-weight:500;
+ /* 22px, not a pill radius: one line (about 41px high) still reads as a pill, and a toast that
+ wraps to four lines is a rounded box instead of a circle over the page. */
+ 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;