[OCaml] High Intensity Training Online
feat style the Home begin button by recovery state
When recovery is complete, the "Begin next workout" submit keeps the solid blood pill — the primary action look. When recovery is not complete, the "Begin under override" submit becomes an outline blood button, so the lower-emphasis, deliberate deviation reads as secondary to a normal begin. Extends the shared blood-outline skin to cover a bare submit input (input[type="submit"].outline), which wins over the solid rule by specificity.
lib/presenter/pages_routine.ml
@@ -80,6 +80,7 @@
80
80
void "input"
81
81
[
82
82
type_ "submit";
83
Added:
class_ "outline";
83
84
value "Begin under override";
84
85
Dream_html.attr "data-hito-confirm-cancel";
85
86
];
lib/web/assets/hito.css
@@ -562,6 +562,7 @@
562
562
correction and finish action groups, which name both group classes so they
563
563
beat the generic solid-fill and brass-outline rules of equal specificity. */
564
564
a.button.outline,
565
Added:
input[type="submit"].outline,
565
566
.button-group.correction-actions input[type="submit"],
566
567
.button-group.finish-actions input[type="submit"],
567
568
.button-group.finish-actions input[type="submit"].secondary {
@@ -570,6 +571,7 @@
570
571
border: 2px solid var(--blood-dark);
571
572
}
572
573
a.button.outline:hover,
574
Added:
input[type="submit"].outline:hover,
573
575
.button-group.correction-actions input[type="submit"]:hover,
574
576
.button-group.finish-actions input[type="submit"]:hover,
575
577
.button-group.finish-actions input[type="submit"].secondary:hover {
test/web/overview.ml
@@ -119,6 +119,54 @@
119
119
"the best is styled as the record to beat" true
120
120
(Option.is_some (index_from ~needle:"next-workout-best" page 0))
121
121
);
122
Added:
( "the begin button is a solid blood pill when recovery is complete",
123
Added:
`Quick,
124
Added:
fun () ->
125
Added:
(* A fresh trainee with a routine selected and no history is Ready.
126
Added:
Home offers the solid "Begin next workout" submit — no outline
127
Added:
class, so the shared solid-blood-pill skin applies. *)
128
Added:
let c = client () in
129
Added:
let _ = sign_in_new c in
130
Added:
let token = Option.get (csrf_token (body (get c "/"))) in
131
Added:
let _ = post c "/routines/ideal/select" [ ("dream.csrf", token) ] in
132
Added:
let page = body (get c "/") in
133
Added:
Alcotest.(check bool)
134
Added:
"recovery-complete status is shown" true
135
Added:
(Option.is_some
136
Added:
(index_from ~needle:"Recovery is complete." page 0));
137
Added:
Alcotest.(check bool)
138
Added:
"the begin submit is present" true
139
Added:
(Option.is_some
140
Added:
(index_from ~needle:"value=\"Begin next workout\"" page 0));
141
Added:
Alcotest.(check bool)
142
Added:
"the begin submit carries no outline class" false
143
Added:
(Option.is_some (index_from ~needle:"class=\"outline\"" page 0))
144
Added:
);
145
Added:
( "begin under override is an outline blood button while recovering",
146
Added:
`Quick,
147
Added:
fun () ->
148
Added:
(* Finish a workout, so recovery has not elapsed. Home now gates the
149
Added:
next start behind the outline "Begin under override" submit. *)
150
Added:
let c = client () in
151
Added:
let _ = sign_in_new c in
152
Added:
let token = Option.get (csrf_token (body (get c "/"))) in
153
Added:
let _ = post c "/routines/ideal/select" [ ("dream.csrf", token) ] in
154
Added:
let token = Option.get (csrf_token (body (get c "/"))) in
155
Added:
let _ =
156
Added:
post c "/workout" [ ("dream.csrf", token); ("override", "false") ]
157
Added:
in
158
Added:
let token = Option.get (csrf_token (body (get c "/workout"))) in
159
Added:
let _ = post c "/workout/finish" [ ("dream.csrf", token) ] in
160
Added:
let page = body (get c "/") in
161
Added:
Alcotest.(check bool)
162
Added:
"recovery is not yet complete" true
163
Added:
(Option.is_some (index_from ~needle:"requires recovery" page 0));
164
Added:
Alcotest.(check bool)
165
Added:
"the override submit is styled as an outline button" true
166
Added:
(Option.is_some
167
Added:
(index_from
168
Added:
~needle:"class=\"outline\" value=\"Begin under override\""
169
Added:
page 0)) );
122
170
( "the routine page is served once a routine is selected",
123
171
`Quick,
124
172
fun () ->