From 7aa64b0917130fcc1dc9f3da30d8f825136fe541 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Fri, 7 Aug 2026 19:10:30 +0200 Subject: feat: Add ride table sorting --- web/templates.templ | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'web/templates.templ') diff --git a/web/templates.templ b/web/templates.templ index d0b1c0c..b061f1e 100644 --- a/web/templates.templ +++ b/web/templates.templ @@ -32,6 +32,9 @@ templ Layout(title string, content templ.Component) { table { width: 100%; border-collapse: collapse; } th, td { padding: .85rem .5rem; border-bottom: 1px solid #e5e9e5; text-align: left; } th { color: #68746c; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; } + .sort-link { color: inherit; text-decoration: none; } + .sort-link:hover, .sort-link:focus-visible, th.active .sort-link { color: #d96932; } + .sort-indicator { display: inline-block; margin-left: .2rem; } .numeric { text-align: right; white-space: nowrap; } .empty { padding: 2.5rem 1rem; text-align: center; color: #68746c; } @media (max-width: 700px) { .container { width: min(100% - 1rem, 70rem); padding-top: 1.5rem; } .site-header { padding-inline: 1rem; } th:nth-child(n+4), td:nth-child(n+4) { display: none; } .panel { padding: .8rem; } } @@ -49,11 +52,11 @@ templ Layout(title string, content templ.Component) { } -templ RidesPage(items []RideView) { - @Layout("Rides", RidesContent(items)) +templ RidesPage(items []RideView, headers []RideSortHeader) { + @Layout("Rides", RidesContent(items, headers)) } -templ RidesContent(items []RideView) { +templ RidesContent(items []RideView, headers []RideSortHeader) {

Ride library

All rides

Your imported rides, ready for climb analysis.

@@ -64,7 +67,11 @@ templ RidesContent(items []RideView) {
No rides stored yet. Import your first Strava rides.
} else { - + + for _, header := range headers { + + } + for _, item := range items { -- cgit v1.2.3
RideStartedDistanceMoving timeElevationCotacolCotacol / 100 km
{ header.Label }
{ item.Name }
{ item.Type }
{ formatRideDate(item.StartDate) }{ formatDistance(item.DistanceM) }{ formatDuration(item.MovingTimeS) }{ formatElevation(item.TotalElevationGainM) }{ item.Cotacol }{ item.CotacolPer100Km }