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.

Undo toast: the × moves to the start, away from Undo

Duarte Santoseacd5bf15d93
diff --git a/frontend/src/components/Toast.jsx b/frontend/src/components/Toast.jsx
index c788acb7b..41dde29bc 100644
--- a/frontend/src/components/Toast.jsx
+++ b/frontend/src/components/Toast.jsx
@@ -4,7 +4,8 @@ import { t } from '../lib/i18n.js'
// The one toast. Mostly text; with an action (the Undo after a set is removed) it carries a button
// at its end, stays longer and holds still while a finger or the mouse rests on it. Its × sends it
-// away at once: five seconds of Undo over the set list is long when you did mean to delete.
+// away at once: five seconds of Undo over the set list is long when you did mean to delete. The ×
+// sits at the start, the far end from Undo, so a thumb aiming for one never lands on the other.
export default function Toast() {
const msg = useUI(s => s.toastMsg)
const action = useUI(s => s.toastAction)
@@ -14,12 +15,12 @@ export default function Toast() {
onPointerEnter={live ? pauseToast : undefined} onPointerDown={live ? pauseToast : undefined}
onPointerLeave={live ? resumeToast : undefined} onPointerCancel={live ? resumeToast : undefined}
onPointerUp={live ? (e => { if (e.pointerType !== 'mouse') resumeToast() }) : undefined}>
+ {live && <button type="button" className="toast-x" aria-label={t('Close')} onClick={dismissToast}>
+ <Icon name="xmark" />
+ </button>}
<span className="toast-msg">{msg}</span>
{live && <button type="button" className="toast-act" key={action.id} onClick={runToastAction}>
<Icon name="undo" />{action.label}
</button>}
- {live && <button type="button" className="toast-x" aria-label={t('Close')} onClick={dismissToast}>
- <Icon name="xmark" />
- </button>}
</div>
}
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 6543613cf..96023b0f7 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -1731,12 +1731,12 @@ body.no-tabbar #timer.working{box-shadow:inset 0 var(--hair) 0 var(--acc),0 -10p
}
#toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
/* With an action (Undo): the message, then the button at the end, and the toast takes taps. */
-#toast.has-action{pointer-events:auto;display:flex;align-items:center;gap:6px;padding:4px 6px 4px 18px;text-align:start}
+#toast.has-action{pointer-events:auto;display:flex;align-items:center;gap:6px;padding:4px 6px 4px 6px;text-align:start}
#toast.has-action .toast-msg{flex:1;min-width:0;padding:7px 0}
#toast .toast-act{flex:none;display:inline-flex;align-items:center;gap:5px;color:var(--acc);font-weight:700;padding:8px 12px;border-radius:14px;min-height:36px}
#toast .toast-act:active{background:color-mix(in srgb,var(--label) 10%,transparent)}
#toast .toast-act .icn{font-size:16px}
-#toast .toast-x{flex:none;display:grid;place-items:center;width:36px;height:36px;margin-left:-4px;border-radius:50%;color:var(--label-2)}
+#toast .toast-x{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;color:var(--label-2)}
#toast .toast-x:active{background:color-mix(in srgb,var(--label) 10%,transparent)}
#toast .toast-x .icn{font-size:15px}
body.no-tabbar #toast{bottom:calc(24px + var(--sab))}