[OCaml] High Intensity Training Online
feat Label the extension amount by what it counts
The amount input under the ending select read "Extension reps / hold seconds" whatever was chosen. Let it follow the selection: forced reps and negatives read "Extension reps", a static hold reads "Hold seconds", and at positive failure the field hides, since there is nothing to count. No script: option:checked tracks the live selection and :has() lets the fieldset react to it. The rules sit under @supports, so a browser without :has() keeps the field and the combined label. The decoder already ignores the amount when no extension is chosen, so the hidden field's value is harmless.
Changed files
lib/presenter/pages_workout.ml
@@ -188,7 +188,15 @@
188
188
Dream_html.string_attr "for" "%s"
189
189
(field_id "extension_amount");
190
190
]
191
Removed:
[ txt "Extension reps / hold seconds" ];
191
Added:
[
192
Added:
tag "span"
193
Added:
[ class_ "amount-label-reps" ]
194
Added:
[ txt "Extension reps" ];
195
Added:
tag "span" [ class_ "amount-label-sep" ] [ txt " / " ];
196
Added:
tag "span"
197
Added:
[ class_ "amount-label-seconds" ]
198
Added:
[ txt "Hold seconds" ];
199
Added:
];
192
200
void "input"
193
201
[
194
202
type_ "number";
lib/web/assets/hito.css
@@ -570,6 +570,27 @@
570
570
/* The Ending control spans the full width below the movement rows. */
571
571
.logging-grid .field-ending { grid-column: 1 / -1; margin-top: 0.4rem; }
572
572
573
Added:
/* The extension amount follows the ending select without script: option:checked
574
Added:
tracks the live selection and :has() lets the fieldset react to it. At
575
Added:
positive failure there is nothing to count, so the field hides; forced reps
576
Added:
and negatives count reps, a static hold counts seconds. Without :has()
577
Added:
support the field stays and the label reads as the combined form. */
578
Added:
@supports selector(:has(*)) {
579
Added:
.logging-fieldset .amount-label-sep { display: none; }
580
Added:
.logging-fieldset:has(select[name="extension"] option[value=""]:checked)
581
Added:
.field-extension-amount {
582
Added:
display: none;
583
Added:
}
584
Added:
.logging-fieldset:has(select[name="extension"] option[value="static"]:checked)
585
Added:
.amount-label-reps {
586
Added:
display: none;
587
Added:
}
588
Added:
.logging-fieldset:not(:has(select[name="extension"] option[value="static"]:checked))
589
Added:
.amount-label-seconds {
590
Added:
display: none;
591
Added:
}
592
Added:
}
593
Added:
573
594
/* A shared heading row: the Load and Reps column headings shown once above a
574
595
multi-exercise group, so the labels are not repeated above every input. The
575
596
cells sit in the same grid columns as the movement inputs below them. */