[OCaml] High Intensity Training Online
feat simplify account and logbook affordances
Keep the masthead brand-only, place Account on Home, and reduce Logbook to its training history with a quiet progress link.
Changed files
lib/presenter/pages_logbook.ml
@@ -453,34 +453,17 @@
453
453
ignore expanded_record;
454
454
html_page ~viewer ~request ~active:"logbook" ?workout_started "Logbook"
455
455
([
456
Removed:
tag "h1" [] [ txt "Logbook" ];
457
Removed:
(* Actions above the accordion, so they are reachable without scrolling
458
Removed:
past a long month. View progress opens the per-exercise chart; Record
459
Removed:
feedback opens the subjective-feedback modal. *)
460
456
tag "div"
461
Removed:
[ class_ "button-group logbook-actions-bar" ]
457
Added:
[ class_ "page-heading-row" ]
462
458
[
459
Added:
tag "h1" [] [ txt "Logbook" ];
463
460
tag "a"
464
461
[
465
Removed:
href Routes.profile;
466
Removed:
class_ "button";
467
Removed:
Dream_html.attr "data-hito-app-link";
468
Removed:
]
469
Removed:
[ txt "Profile" ];
470
Removed:
tag "a"
471
Removed:
[
472
462
href Routes.progress;
473
Removed:
class_ "button";
463
Added:
class_ "page-heading-link";
474
464
Dream_html.attr "data-hito-app-link";
475
465
]
476
466
[ txt "View progress" ];
477
Removed:
tag "a"
478
Removed:
[
479
Removed:
class_ "button outline";
480
Removed:
Dream_html.string_attr "href" "/logbook?feedback=start";
481
Removed:
Dream_html.attr "data-hito-feedback-open";
482
Removed:
]
483
Removed:
[ txt "Record feedback" ];
484
467
];
485
468
(if suggest_feedback then
486
469
tag "p"
lib/presenter/pages_profile.ml
@@ -14,8 +14,8 @@
14
14
| None -> []
15
15
in
16
16
let error_block = function Some message -> [ alert message ] | None -> [] in
17
Removed:
html_page ~viewer ~request ~active:"profile" ?workout_started "Profile"
18
Removed:
([ tag "h1" [] [ txt "Profile" ] ]
17
Added:
html_page ~viewer ~request ~active:"profile" ?workout_started "Account"
18
Added:
([ tag "h1" [] [ txt "Account" ] ]
19
19
@ notice_block
20
20
@ [
21
21
(* Username: show the current value and a button that opens the edit
lib/presenter/pages_routine.ml
@@ -24,7 +24,21 @@
24
24
void "input" [ type_ "submit"; value "Use this routine" ];
25
25
];
26
26
])
27
Removed:
routines)
27
Added:
routines
28
Added:
@ [
29
Added:
tag "section"
30
Added:
[ class_ "home-account" ]
31
Added:
[
32
Added:
tag "p" [] [ txt "Account · %s" viewer.View_model.Viewer.username ];
33
Added:
tag "a"
34
Added:
[
35
Added:
href Routes.profile;
36
Added:
class_ "button secondary";
37
Added:
Dream_html.attr "data-hito-app-link";
38
Added:
]
39
Added:
[ txt "Account" ];
40
Added:
];
41
Added:
])
28
42
29
43
let begin_form request ~routine_id ~override label =
30
44
tag "form"
@@ -159,7 +173,21 @@
159
173
vm.next_exercises));
160
174
tag "p" [] [ txt "%s" status ];
161
175
]
162
Removed:
@ gate)
176
Added:
@ gate
177
Added:
@ [
178
Added:
tag "section"
179
Added:
[ class_ "home-account" ]
180
Added:
[
181
Added:
tag "p" [] [ txt "Account · %s" viewer.View_model.Viewer.username ];
182
Added:
tag "a"
183
Added:
[
184
Added:
href Routes.profile;
185
Added:
class_ "button secondary";
186
Added:
Dream_html.attr "data-hito-app-link";
187
Added:
]
188
Added:
[ txt "Account" ];
189
Added:
];
190
Added:
])
163
191
164
192
(* Home while a workout is in progress. Rather than the recovery gate or the
165
193
routine chooser, Home shows a single card: the workout is under way and one
lib/web/assets/hito.css
@@ -266,6 +266,41 @@
266
266
gap: 0.6rem;
267
267
padding: 0.2rem 0;
268
268
}
269
Added:
270
Added:
/* Account is a global utility, not a primary training action. */
271
Added:
.home-account {
272
Added:
display: flex;
273
Added:
align-items: center;
274
Added:
justify-content: space-between;
275
Added:
gap: 1rem;
276
Added:
margin-top: 2rem;
277
Added:
padding-top: 0.85rem;
278
Added:
border-top: 1px solid var(--rule);
279
Added:
}
280
Added:
.home-account p {
281
Added:
margin: 0;
282
Added:
font-size: var(--font-size-small);
283
Added:
}
284
Added:
.home-account .button {
285
Added:
flex: 0 0 auto;
286
Added:
}
287
Added:
288
Added:
/* Keep one page action beside the title without creating a button strip. */
289
Added:
.page-heading-row {
290
Added:
display: flex;
291
Added:
align-items: baseline;
292
Added:
justify-content: space-between;
293
Added:
gap: 1rem;
294
Added:
}
295
Added:
.page-heading-row h1 { margin: 0; }
296
Added:
.page-heading-link {
297
Added:
flex: 0 0 auto;
298
Added:
color: var(--blood-dark);
299
Added:
font-size: var(--font-size-small);
300
Added:
font-weight: 700;
301
Added:
text-decoration: none;
302
Added:
}
303
Added:
.page-heading-link:hover { text-decoration: underline; }
269
304
.next-workout-exercise { flex: 1 1 auto; }
270
305
/* The current best weight × reps to beat: an observed fact, monospaced and
271
306
quiet, aligned to the right of each exercise. */
test/web/logbook.ml
@@ -10,6 +10,10 @@
10
10
fun () ->
11
11
let c = client () in
12
12
let _ = sign_in_new c in
13
Added:
let page = body (get c "/logbook") in
14
Added:
Alcotest.(check bool)
15
Added:
"Logbook keeps progress beside its title" true
16
Added:
(Option.is_some (index_from ~needle:"View progress" page 0));
13
17
List.iter
14
18
(fun path ->
15
19
Alcotest.(check int)
test/web/overview.ml
@@ -43,6 +43,10 @@
43
43
chart. *)
44
44
let c, repo = client_with_repo () in
45
45
let _ = register c ~username:"lifter" ~password:"heavyduty1" in
46
Added:
let home = body (get c "/") in
47
Added:
Alcotest.(check bool)
48
Added:
"Home offers the Account affordance" true
49
Added:
(Option.is_some (index_from ~needle:"Account" home 0));
46
50
let trainee = the_trainee repo ~username:"lifter" in
47
51
let token = Option.get (csrf_token (body (get c "/"))) in
48
52
let _ = post c "/routines/ideal/select" [ ("dream.csrf", token) ] in