fix lap-bests distance matching + show PRs on activity page
Build and push images / validate (push) Successful in 5s
Build and push images / build-backend (push) Successful in 6s
Build and push images / build-worker (push) Successful in 6s
Build and push images / build-frontend (push) Successful in 9s

This commit is contained in:
2026-06-16 11:38:12 +01:00
parent 16144d60b4
commit a168f594a7
2 changed files with 83 additions and 6 deletions
+21
View File
@@ -66,6 +66,12 @@ export default function ActivityDetailPage() {
enabled: !!activity?.named_route_id,
})
const { data: activityRecords } = useQuery({
queryKey: ['activity-records', id],
queryFn: () => api.get(`/activities/${id}/records`).then(r => r.data),
enabled: !!activity,
})
const { data: routeBoard } = useQuery({
queryKey: ['route-leaderboard', id],
queryFn: () => api.get(`/activities/${id}/route-leaderboard`).then(r => r.data),
@@ -132,6 +138,21 @@ export default function ActivityDetailPage() {
</div>
</div>
{/* Personal records set in this activity */}
{activityRecords && activityRecords.length > 0 && (
<div className="flex flex-wrap items-center gap-2">
<span className="text-xs text-gray-500 mr-1">🏆 Personal best{activityRecords.length > 1 ? 's' : ''} set here:</span>
{activityRecords.map(pr => (
<span
key={pr.distance_label}
className="text-xs px-2.5 py-1 rounded-full bg-yellow-500/10 text-yellow-400 border border-yellow-500/30 font-medium"
>
{pr.distance_label} · {formatDuration(pr.duration_s)}
</span>
))}
</div>
)}
{/* Stats — all on one row */}
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 lg:grid-cols-10 gap-3">
<StatCard label="Distance" value={formatDistance(activity.distance_m)} />