feat mark imported workouts with a primary-colour pill

Signal import status with an "Imported" pill in the primary (oxblood) colour beside the workout title, rather than relying on the three-dot menu alone. The title still shows verbatim -- the pill is a separate element, not appended text.

Commit
634d573d19ba098b8c3f43e976caae6dbfc1fb07
Author
Marius Peter <dev@marius-peter.com>
Author date
Committer
Marius Peter <dev@marius-peter.com>
Committer date
Changed files
lib/presenter/pages_logbook.ml
index 409564c4..8db841e6 100644..100644
@@ -329,12 +329,21 @@
329 329 entry.progressed_exercises
330 330 entry.compared_exercises)
331 331 in
332 Removed: (* The title shows verbatim -- no tag. An import's imported
333 Removed: status is signalled by its three-dot menu, which also
334 Removed: carries its exercises and progress. A native record's menu
335 Removed: carries Edit and Delete. *)
332 Added: (* The title shows verbatim. An import is signalled by a
333 Added: primary-colour "Imported" pill beside it, and its three-
334 Added: dot menu carries its exercises and progress. A native
335 Added: record's menu carries Edit and Delete. *)
336 336 let name_cell =
337 Removed: tag "td" [] [ txt "%s" entry.workout_name ]
337 Added: tag "td" []
338 Added: (txt "%s" entry.workout_name
339 Added: ::
340 Added: (if entry.imported then
341 Added: [
342 Added: tag "span"
343 Added: [ class_ "logbook-import-pill" ]
344 Added: [ txt "Imported" ];
345 Added: ]
346 Added: else []))
338 347 in
339 348 let actions =
340 349 if entry.imported then [ imported_menu entry ]
lib/web/assets/hito.css
index 0242d7e8..3c5e2ec1 100644..100644
@@ -705,6 +705,20 @@
705 705 text-align: left;
706 706 }
707 707
708 Added: /* A primary-colour pill beside the title marks a workout as imported. */
709 Added: .logbook-import-pill {
710 Added: display: inline-block;
711 Added: margin-left: 0.5rem;
712 Added: padding: 0.1rem 0.5rem;
713 Added: border-radius: 999px;
714 Added: color: var(--on-primary);
715 Added: background: var(--oxblood);
716 Added: font: 700 var(--font-size-small)/1.4 var(--sans);
717 Added: letter-spacing: 0.02em;
718 Added: vertical-align: middle;
719 Added: white-space: nowrap;
720 Added: }
721 Added:
708 722 .confirm-dialog button.danger {
709 723 border-color: var(--oxblood-hover);
710 724 background: var(--oxblood-hover);
test/web/logbook.ml
index e42a3d49..8b17edab 100644..100644
@@ -507,14 +507,14 @@
507 507 Alcotest.(check bool)
508 508 "the imported workout title is shown" true
509 509 (Option.is_some (index_from ~needle:"Legs" page 0));
510 Removed: (* The title shows verbatim: no "Imported" text is appended to it,
511 Removed: and the old source tag is gone. *)
510 Added: (* The title shows verbatim: it is not suffixed with "Imported".
511 Added: Import status is a separate primary-colour pill. *)
512 512 Alcotest.(check bool)
513 Removed: "no source tag on the title" false
514 Removed: (Option.is_some (index_from ~needle:"logbook-source-tag" page 0));
515 Removed: Alcotest.(check bool)
516 513 "the title is not suffixed with Imported" false
517 514 (Option.is_some (index_from ~needle:"Legs Imported" page 0));
515 Added: Alcotest.(check bool)
516 Added: "an Imported pill marks the workout" true
517 Added: (Option.is_some (index_from ~needle:"logbook-import-pill" page 0));
518 518 (* The import spans 10:00-11:00, so its duration is relevant and
519 519 shown, like a native workout. *)
520 520 Alcotest.(check bool)