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);
}