diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-17 10:34:06 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-17 10:34:06 +0200 |
| commit | 7c39bc7124f89aa28aaeaffb60b71af9e6335295 (patch) | |
| tree | 56f2948a4e0af8fa107e618caeba3a4dd50a269f /web/frontend/ride-detail-logic.ts | |
| parent | 2a20ea69a3d62c32c09e62e756a872a3042372b2 (diff) | |
refactor(web): split ride detail rendering concerns
Diffstat (limited to 'web/frontend/ride-detail-logic.ts')
| -rw-r--r-- | web/frontend/ride-detail-logic.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/web/frontend/ride-detail-logic.ts b/web/frontend/ride-detail-logic.ts index f8eb040..e0f7281 100644 --- a/web/frontend/ride-detail-logic.ts +++ b/web/frontend/ride-detail-logic.ts @@ -28,8 +28,17 @@ export const categoryForCotacol = (cotacol: number): string => { return "HC"; }; -export const formatClimbLabel = (name: string, category: string, cotacol: number, officialClimb = false): string => { - if (name) return officialClimb ? `${name} (${category})` : name; +type ClimbLabelKind = "official" | "detected"; + +interface ClimbLabelOptions { + name: string; + category: string; + cotacol: number; + kind: ClimbLabelKind; +} + +export const formatClimbLabel = ({ name, category, cotacol, kind }: ClimbLabelOptions): string => { + if (name) return kind === "official" ? `${name} (${category})` : name; return `${category} ${cotacol.toFixed(1)}`; }; |