diff --git a/static/js/history.js b/static/js/history.js index 80f3b24..f97b1e0 100644 --- a/static/js/history.js +++ b/static/js/history.js @@ -314,11 +314,7 @@ ${formatDuration(trip.duration_seconds)} ${formatSpeed(trip.max_speed_kmh)} ${trip.odo_start_km != null ? trip.odo_start_km.toFixed(0) + ' → ' + trip.odo_end_km.toFixed(0) + ' km' : '—'} - - ${deleteBtn} - `; + ${deleteBtn}`; body.appendChild(row); }); @@ -352,13 +348,12 @@ } } - // Replay button click (desktop) or row click (mobile) — debounced - const tripId = button ? button.dataset.tripId : (row ? row.dataset.tripId : null); - if (!tripId) return; + // Row click triggers replay — debounced + const row = event.target.closest("tr[data-trip-id]"); + if (!row) return; + const tripId = row.dataset.tripId; clearTimeout(_replayDebounce); - _replayDebounce = setTimeout(() => { - replayTrip(tripId); - }, 100); + _replayDebounce = setTimeout(() => replayTrip(tripId), 100); }); scrubber.addEventListener("input", function () {