diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-10-18 21:19:36 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-10-18 21:19:36 +0200 |
| commit | 8a0032d08862dcf28c653bee3fd21052e967e35d (patch) | |
| tree | 6cb0d8efe6f5c2bf9ce9eb3ef8306faecbe7cfeb /web/templates.templ | |
| parent | d575274d00c8da251df29d5d6a636044673944a3 (diff) | |
Cut climb profile sections in the backend
The chart steps are computed in Go and shipped as finished sections, next to
the profile statistics the climb package already owns: climb.ProfileSections
cuts a Route at its widest bends under a ProfilePolicy, and
rideanalysis.MergeClimbProfile takes over the merge that lived in
web/climbs.go, so web only loads the attempt rides and maps the DTOs.
The payload carries sections instead of raw elevations, and the browser keeps
what needs the canvas: slope bands, labels, distance ticks and colours.
official-climb-profile-logic.ts and its tests are gone, replaced by
climb/profile_test.go and a page test reading the embedded profile JSON.
Diffstat (limited to 'web/templates.templ')
| -rw-r--r-- | web/templates.templ | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/web/templates.templ b/web/templates.templ index 7c326eb..dbdeeac 100644 --- a/web/templates.templ +++ b/web/templates.templ @@ -304,7 +304,7 @@ templ RideDetailContent(data RideDetailView) { <span class="official-climb-chevron" aria-hidden="true">⌄</span> </summary> <div class="official-climb-card-body"> - <canvas class="official-climb-profile" data-official-profile data-profile-start={ formatRouteIndex(climb.StartIndex) } data-profile-end={ formatRouteIndex(climb.EndIndex) } tabindex="0" role="img" aria-label={ officialProfileLabel(climb.OfficialName) }></canvas> + <canvas class="official-climb-profile" data-official-profile data-profile-climb-index={ formatRouteIndex(climb.Index) } tabindex="0" role="img" aria-label={ officialProfileLabel(climb.OfficialName) }></canvas> <div class="official-climb-profile-legend" role="list" aria-label="Average slope color scale"> <span role="listitem"><i class="profile-band-swatch profile-band-downhill" aria-hidden="true"></i><=0%</span> <span role="listitem"><i class="profile-band-swatch profile-band-0-3" aria-hidden="true"></i>0–3%</span> @@ -542,7 +542,7 @@ templ ClimbDetailContent(data ClimbDetailPageData) { <section class="panel map-panel"> <div id="climb-map" class="ride-map" role="img" aria-label="Official climb map"></div> </section> - if len(data.Profile.Elevations) > 0 { + if len(data.Profile.Sections) > 0 { <section class="panel"> <div class="section-heading"><div><p class="eyebrow">Profile</p><h2>Median profile</h2></div></div> <div class="profile-chart"><canvas id="climb-profile" data-climb-profile tabindex="0" role="img" aria-label={ officialProfileLabel(data.Climb.Name) }></canvas></div> |
