From c5e131f81c5739ad3418355200f6f8484553d41b Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Fri, 31 Jul 2026 15:35:27 +0200 Subject: [PATCH] Rest timer: take 15 seconds off, not only add them addRest now accepts a negative step, and taking off more than is left finishes the rest instead of counting into the negative -- which also kept a negative duration out of the progress bar and out of the server-side push schedule. Three controls and the clock do not fit one line on a phone: at 360px the bar was left with about 30px and stopped saying anything. The rest variant stacks -- clock and bar on top, controls beneath, -15 and +15 together in number-line order, Skip pushed to the far edge so the button that ends the rest is not next to the one you tap to buy more time. Scoped to #timer.rest, so the work timer keeps its single row. Back to one line at >=1000px, and the card is nearly opaque now -- the set rows underneath were reading through it. --- frontend/src/components/RestTimer.jsx | 19 ++++++++++++++----- frontend/src/index.css | 20 +++++++++++++++++--- frontend/src/store/useUI.js | 3 +++ 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/RestTimer.jsx b/frontend/src/components/RestTimer.jsx index 24e24c1..9599f61 100644 --- a/frontend/src/components/RestTimer.jsx +++ b/frontend/src/components/RestTimer.jsx @@ -34,12 +34,21 @@ export default function RestTimer() { ) + // Three controls plus the clock don't fit one line on a phone — at 360px the bar is left + // with about 30px and stops saying anything. So the rest variant stacks: clock and bar + // read at a glance, controls get their own row. −15 and +15 sit together in number-line + // order; Skip is pushed to the far edge, away from the button you tap to buy more time. return ( -
-
{clock(timer.left)}
-
- - +
+
+
{clock(timer.left)}
+
+
+
+ + + +
) } diff --git a/frontend/src/index.css b/frontend/src/index.css index 6afdd3f..47123d7 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -165,8 +165,9 @@ button,.chip,.tile,.item,.wday,.cal-d,.swatch,.hm-c,.lrow,.seg button,.stp butto padding:calc(var(--sat) + 8px) var(--pad) calc(128px + var(--sab)); max-width:560px;margin:0 auto; } -/* while the rest timer floats above the tab bar, keep its height scrollable-past */ -body.resting #app{padding-bottom:calc(206px + var(--sab))} +/* while the rest timer floats above the tab bar, keep its height scrollable-past + (the rest variant is two rows tall — ~44px more than the single-row work timer) */ +body.resting #app{padding-bottom:calc(250px + var(--sab))} @keyframes viewfade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}} #app.vfade{animation:viewfade var(--med) var(--ease)} @@ -603,7 +604,9 @@ h4.sec{ /* --- rest timer --- */ #timer{ position:fixed;left:12px;right:12px;bottom:calc(88px + var(--sab));z-index:60; - background:color-mix(in srgb,var(--surface) 82%,transparent); + /* nearly opaque: the set rows underneath were reading through the old 82% and made the + clock hard to pick out mid-set. The blur stays, so it still sits above the page. */ + background:color-mix(in srgb,var(--surface) 97%,transparent); backdrop-filter:saturate(180%) blur(24px);-webkit-backdrop-filter:saturate(180%) blur(24px); border-radius:var(--r-lg);padding:12px 14px; display:flex;align-items:center;gap:12px; @@ -614,6 +617,14 @@ h4.sec{ #timer .t{font-size:26px;font-weight:600;letter-spacing:-.026em;font-variant-numeric:tabular-nums;min-width:66px} #timer .bar{flex:1;height:4px;background:var(--surface-3);border-radius:99px;overflow:hidden} #timer .bar i{display:block;height:100%;background:var(--acc);transition:width 1s linear} +/* rest variant: −15/+15/Skip and the clock won't share one line on a phone, so the clock and + bar take the top row and the controls take their own. The work timer keeps a single row — + it only ever has two buttons. */ +#timer.rest{flex-direction:column;align-items:stretch;gap:10px} +#timer.rest .head{display:flex;align-items:center;gap:12px} +#timer.rest .acts{display:flex;align-items:center;gap:8px} +#timer.rest .acts .btn{padding-top:11px;padding-bottom:11px} /* sweaty hands, mid-set */ +#timer.rest .acts .skip{margin-left:auto;min-width:84px} /* work timer (issue #16): the same bar doing the opposite job — outlined and tinted so a glance tells "you are holding this" apart from "you are recovering". */ #timer.working{border:var(--hair) solid var(--acc)} @@ -893,6 +904,9 @@ h4.sec{ .sheet{left:50%;right:auto;margin-left:-320px;width:640px;border-radius:var(--r-xl) var(--r-xl) 0 0} .center{width:340px} #timer{left:50%;right:auto;margin-left:-260px;width:520px;bottom:112px} + /* 520px fits the clock, the bar and all three controls on one line again */ + #timer.rest{flex-direction:row;align-items:center;gap:14px} + #timer.rest .head{flex:1;min-width:0} .exmedia img{height:380px} .hm-wrap{display:flex;flex-direction:column;align-items:center} } diff --git a/frontend/src/store/useUI.js b/frontend/src/store/useUI.js index 70c77bf..b4eb439 100644 --- a/frontend/src/store/useUI.js +++ b/frontend/src/store/useUI.js @@ -63,6 +63,9 @@ export const useUI = create((set, get) => ({ const tm = get().timer if (!tm) return const left = tm.left + sec + // taking off more than is left means "I'm ready now" — same as skipping, and it keeps a + // negative duration out of both the progress bar and the server-side push schedule + if (left <= 0) { get().stopRest(); return } set({ timer: { ...tm, left, total: tm.total + sec, endsAt: tm.endsAt + sec * 1000 } }) pushRestTimer(left) },