ui: tap any row to replay trip on mobile

- data-trip-id on the <tr> itself
- click handler checks row if no button found
- cursor: pointer on rows for discoverability

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-10 02:40:45 -04:00
co-authored by Copilot
parent f27e2f2d4b
commit 08a3bef558
+7 -2
View File
@@ -148,6 +148,8 @@
row.dataset.distance = trip.distance_km; row.dataset.distance = trip.distance_km;
row.dataset.duration = trip.duration_seconds; row.dataset.duration = trip.duration_seconds;
row.dataset.maxSpeed = trip.max_speed_kmh; row.dataset.maxSpeed = trip.max_speed_kmh;
row.dataset.tripId = trip.id;
row.style.cursor = "pointer";
row.innerHTML = ` row.innerHTML = `
<td>${formatDate(trip.start_datetime)}</td> <td>${formatDate(trip.start_datetime)}</td>
<td>${formatDistance(trip.distance_km)}</td> <td>${formatDistance(trip.distance_km)}</td>
@@ -164,11 +166,14 @@
} }
body.addEventListener("click", function (event) { body.addEventListener("click", function (event) {
// Button click (desktop) or row click (mobile)
const button = event.target.closest("[data-trip-id]"); 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; return;
} }
replayTrip(button.dataset.tripId).catch(function (replayError) { replayTrip(tripId).catch(function (replayError) {
if (replayError.name !== "AbortError") { if (replayError.name !== "AbortError") {
showError(replayError.message); showError(replayError.message);
} }