Show standalone best effort badges with pace

This commit is contained in:
Peter Stockings
2026-10-02 14:50:04 +10:00
parent c99d51336c
commit 18273170e8
4 changed files with 5 additions and 2 deletions
+1
View File
@@ -189,6 +189,7 @@ def dashboard():
personal=True,
record_book=records_for(current_user.id, {row.id for row in pagination.items}),
mapped_run=latest_mapped_run(filters),
pace_text=pace_text,
)
+2
View File
@@ -33,6 +33,8 @@ body{font-family:"Segoe UI",Arial,sans-serif}h1{font-weight:650;letter-spacing:-
.record-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.record-badge { display: inline-flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid #394246; border-radius: 6px; color: #c5cccc; background: #202629; font-size: 12px; text-decoration: none; }
.record-badge strong { font-size: 15px; color: #eeeae4; font-variant-numeric: tabular-nums; }
.run-record-badges { margin-bottom: 20px; }
.record-badge strong small { margin-left: 3px; font-size: 10px; font-weight: 400; color: #c5cccc; }
.record-badge.is-pr { border-color: #886b34; background: #30291e; }
.badge-award { color: #f3cb78; font-size: 11px; font-weight: 600; }
a.record-badge:hover { border-color: #f3cb78; background: #3a3020; }
+1 -1
View File
@@ -10,7 +10,7 @@
<div class="page-heading"><div><span class="eyebrow">{{ activity.sport|upper }} · {{ activity.started_at|localdate(activity.owner.timezone, '%A, %d %B %Y') }}</span><h1>{{ activity.title }}</h1><p>By {% if public_view %}{{ activity.owner.display_name }}{% else %}<a href="{{ url_for('web.profile',username=activity.owner.username) }}">{{ activity.owner.display_name }}</a>{% endif %}<span class="dot-separator">·</span>{{ activity.started_at|localdate(activity.owner.timezone, '%H:%M') }}<span class="dot-separator">·</span>{{ '{:,}'.format(analysis.summary.samples) }} recorded samples</p></div><div class="activity-actions"><span class="pill {{ 'public' if public_view else activity.visibility }}">{{ 'Shared via link' if public_view else activity.visibility|title }}</span>{% if owner_view %}<button type="button" class="button secondary copy-link-button" id="copy-run-link" aria-label="Copy public link to this run" title="Copy public link — anyone with the link can view this run" data-url="{{ url_for('web.share_activity', activity_id=activity.id) }}" data-csrf="{{ csrf_token() }}"><svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m10 13 4-4m-6 6-1 1a4 4 0 0 1-6-6l4-4a4 4 0 0 1 6 0m2 2 1-1a4 4 0 0 1 6 6l-4 4a4 4 0 0 1-6 0"/></svg></button>{% endif %}</div></div>
{% if owner_view %}<div class="share-feedback"><p id="share-status" role="status" aria-live="polite"></p><label id="share-fallback" hidden>Copy this public link<input id="share-link-value" readonly aria-label="Public run link"></label></div>{% endif %}
{% if efforts %}
<section class="panel records-panel compact-records"><div class="section-head"><h2>Best efforts on this run</h2><span class="subtle-label">Estimated · elapsed time</span></div><div class="record-badges">{% for effort in efforts %}<span class="record-badge {{ 'is-pr' if effort.pr }}" title="{{ '%.2f'|format(effort.start_m/1000) }}–{{ '%.2f'|format(effort.end_m/1000) }} km into the run"><span>{{ effort.label }}</span><strong>{{ effort.seconds|duration }}</strong>{% if effort.pr %}<span class="badge-award">★ PR</span>{% endif %}</span>{% endfor %}</div></section>
<div class="record-badges run-record-badges" aria-label="Best efforts on this run">{% for effort in efforts %}<span class="record-badge {{ 'is-pr' if effort.pr }}" title="{{ '%.2f'|format(effort.start_m/1000) }}–{{ '%.2f'|format(effort.end_m/1000) }} km into the run"><span>{{ effort.label }}</span><strong>{{ pace_text(effort.seconds * 1000 / effort.distance) }}<small>/km</small></strong>{% if effort.pr %}<span class="badge-award">★ PR</span>{% endif %}</span>{% endfor %}</div>
{% endif %}
<nav class="activity-nav" aria-label="Activity sections"><a href="#route-section">Route & speed</a><a href="#performance">Performance</a><a href="#terrain">Terrain & effort</a><a href="#splits">Laps & splits</a><a href="#method">About the numbers</a></nav>
<div class="stats-grid">
+1 -1
View File
@@ -23,7 +23,7 @@
{% if personal %}
<section class="panel records-panel compact-records"><div class="section-head"><div><span class="eyebrow">YOUR FASTEST DISTANCES</span><h2>Personal records</h2></div><span class="subtle-label">Estimated · elapsed time</span></div>
<p class="section-description">Fastest stretches within your runs, including stops. PR badges mark records set at the time of the run; your first effort establishes a record.</p>
<div class="record-badges">{% for record in record_book.records %}<a class="record-badge is-pr" href="{{ url_for('web.activity', activity_id=record.activity.id) }}" title="{{ record.activity.started_at|localdate(profile.timezone) }} · {{ record.activity.title }}"><span class="badge-award" aria-hidden="true">★</span><span>{{ record.label }}</span><strong>{{ record.seconds|duration }}</strong></a>{% else %}<p class="field-help">Import a run with recorded distance and timestamps to establish your first record.</p>{% endfor %}</div></section>
<div class="record-badges">{% for record in record_book.records %}<a class="record-badge is-pr" href="{{ url_for('web.activity', activity_id=record.activity.id) }}" title="{{ record.activity.started_at|localdate(profile.timezone) }} · {{ record.activity.title }}"><span class="badge-award" aria-hidden="true">★</span><span>{{ record.label }}</span><strong>{{ pace_text(record.seconds * 1000 / record.distance) }}<small>/km</small></strong></a>{% else %}<p class="field-help">Import a run with recorded distance and timestamps to establish your first record.</p>{% endfor %}</div></section>
{% endif %}
<section class="panel activities-panel" id="history"><div class="section-head"><div><span class="eyebrow">SESSION HISTORY</span><h2>{{ 'Your activities' if personal else 'Shared activities' }}</h2></div><span class="subtle-label">{{ stats.count }} activities</span></div>{% include '_activities.html' %}</section>
{% endblock %}