From e9cb1ea4e4c63e395222ce4ef239c0c9f2145e61 Mon Sep 17 00:00:00 2001 From: owain Date: Thu, 11 Jun 2026 23:42:12 +0100 Subject: [PATCH] Dashboard Running PRs: show fixed 1k, 1 mile, 5k, 10k distances Co-Authored-By: Claude Opus 4.8 --- frontend/src/pages/DashboardPage.jsx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/frontend/src/pages/DashboardPage.jsx b/frontend/src/pages/DashboardPage.jsx index 451c52c..1ca497c 100644 --- a/frontend/src/pages/DashboardPage.jsx +++ b/frontend/src/pages/DashboardPage.jsx @@ -425,21 +425,23 @@ function RecentActivities({ activities }) { ) } +const DASH_PR_LABELS = ['1k', '1 mile', '5k', '10k'] + function RunningPRs({ records }) { + const byLabel = Object.fromEntries((records || []).map(r => [r.distance_label, r])) return ( - {records?.length > 0 ? ( -
- {records.slice(0, 5).map(rec => ( -
-

{rec.distance_label}

-

{formatDuration(rec.duration_s)}

+
+ {DASH_PR_LABELS.map(label => { + const rec = byLabel[label] + return ( +
+

{label}

+

{rec ? formatDuration(rec.duration_s) : '--'}

- ))} -
- ) : ( -
No running records yet
- )} + ) + })} +
) }