From 08a3bef558607228831bfac0f7f45ed82a9cbcb0 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Mon, 10 Aug 2026 02:40:45 -0400 Subject: [PATCH] ui: tap any row to replay trip on mobile - data-trip-id on the itself - click handler checks row if no button found - cursor: pointer on rows for discoverability Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- static/js/history.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/static/js/history.js b/static/js/history.js index d0c67b8..ac1eea0 100644 --- a/static/js/history.js +++ b/static/js/history.js @@ -148,6 +148,8 @@ row.dataset.distance = trip.distance_km; row.dataset.duration = trip.duration_seconds; row.dataset.maxSpeed = trip.max_speed_kmh; + row.dataset.tripId = trip.id; + row.style.cursor = "pointer"; row.innerHTML = ` ${formatDate(trip.start_datetime)} ${formatDistance(trip.distance_km)} @@ -164,11 +166,14 @@ } body.addEventListener("click", function (event) { + // Button click (desktop) or row click (mobile) const button = event.target.closest("[data-trip-id]"); - if (!button) { + const row = event.target.closest("tr[data-trip-id]"); + const tripId = button ? button.dataset.tripId : (row ? row.dataset.tripId : null); + if (!tripId) { return; } - replayTrip(button.dataset.tripId).catch(function (replayError) { + replayTrip(tripId).catch(function (replayError) { if (replayError.name !== "AbortError") { showError(replayError.message); }