Skip to content

Commit f31992b

Browse files
adn8naiagentclaude
andcommitted
Add lap order toggle, mobile scroll fix, and changelog update
- Lap analysis: toggle ascending/descending order with persisted preference - Mobile lap analysis: scrollable with max-h-[60vh] - Changelog: added 1.3.2.1 section Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 911bc7f commit f31992b

3 files changed

Lines changed: 33 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes to F1 Replay Timing will be documented in this file.
44

5+
## 1.3.2.1
6+
7+
### Fixes
8+
- **Lap analysis lap number** — fixed showing incomplete current lap data; now only displays completed laps
9+
- **Mobile lap analysis scroll** — section is now scrollable on mobile
10+
11+
---
12+
513
## 1.3.2
614

715
### Improvements

frontend/src/app/replay/[year]/[round]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ export default function ReplayPage() {
920920
</svg>
921921
</button>
922922
{mobileLapAnalysisOpen && (
923-
<div className="bg-f1-card">
923+
<div className="bg-f1-card max-h-[60vh] overflow-y-auto">
924924
<LapAnalysisPanel laps={lapsResponse.laps} drivers={drivers} currentLap={Math.max(0, (replay.frame?.lap || 0) - 1)} />
925925
</div>
926926
)}

frontend/src/components/LapAnalysisPanel.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ const LAP_RANGES = [
118118
export default function LapAnalysisPanel({ laps, drivers, currentLap, onClose }: Props) {
119119
const [selectedDrivers, setSelectedDrivers] = useState<[string | null, string | null]>([null, null]);
120120
const [lapRange, setLapRange] = useState<number>(0); // 0 = all
121+
const [lapOrder, setLapOrder] = useState<"asc" | "desc">(() => {
122+
if (typeof window !== "undefined") {
123+
return (localStorage.getItem("f1replay_lap_order") as "asc" | "desc") || "asc";
124+
}
125+
return "asc";
126+
});
121127

122128
const sortedDrivers = useMemo(
123129
() => [...drivers].sort((a, b) => (a.position ?? 999) - (b.position ?? 999)),
@@ -499,7 +505,20 @@ export default function LapAnalysisPanel({ laps, drivers, currentLap, onClose }:
499505
<div className="px-3 pb-2">
500506
{/* Header row */}
501507
<div className="flex items-center gap-1 py-1 border-b border-f1-border">
502-
<span className="w-8 text-[9px] font-bold text-f1-muted">LAP</span>
508+
<button
509+
onClick={() => {
510+
const next = lapOrder === "asc" ? "desc" : "asc";
511+
setLapOrder(next);
512+
try { localStorage.setItem("f1replay_lap_order", next); } catch {}
513+
}}
514+
className="w-8 text-[9px] font-bold text-f1-muted hover:text-white transition-colors flex items-center gap-0.5"
515+
title={lapOrder === "asc" ? "Show latest first" : "Show earliest first"}
516+
>
517+
LAP
518+
<svg className={`w-2.5 h-2.5 transition-transform ${lapOrder === "desc" ? "rotate-180" : ""}`} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
519+
<path strokeLinecap="round" strokeLinejoin="round" d="M19 9l-7 7-7-7" />
520+
</svg>
521+
</button>
503522
{activeDrivers.map((abbr) => (
504523
<div key={abbr} className="flex-1 flex items-center gap-1">
505524
<span
@@ -524,7 +543,10 @@ export default function LapAnalysisPanel({ laps, drivers, currentLap, onClose }:
524543
}),
525544
);
526545
const rows = [];
527-
for (let lap = 1; lap <= maxLap; lap++) {
546+
const startLap = lapOrder === "desc" ? maxLap : 1;
547+
const endLap = lapOrder === "desc" ? 1 : maxLap;
548+
const step = lapOrder === "desc" ? -1 : 1;
549+
for (let lap = startLap; lapOrder === "desc" ? lap >= endLap : lap <= endLap; lap += step) {
528550
rows.push(
529551
<div
530552
key={lap}

0 commit comments

Comments
 (0)