Add saved analysis workspace and live dashboard statistics

This commit is contained in:
Peter Stockings
2026-10-03 12:27:20 +10:00
parent 5ede1a01d2
commit e6e2f22479
31 changed files with 1986 additions and 131 deletions
+37
View File
@@ -0,0 +1,37 @@
<section class="panel analysis-workspace">
<div class="section-head"><div><span class="eyebrow">ACCOUNT LIBRARY</span><h2>Investigations</h2></div><button type="button" class="button secondary" id="new-analysis">New analysis</button></div>
<div id="analysis-library" class="analysis-library" aria-live="polite"><p class="field-help">Loading your saved analyses…</p></div>
</section>
<dialog id="save-analysis-dialog" class="analysis-dialog">
<form id="save-analysis-form">
<div class="studio-row"><h2 id="save-analysis-title">Save analysis</h2><button type="button" class="text-button" id="close-analysis-dialog" aria-label="Close">×</button></div>
<label>Name<input name="name" maxlength="100" required placeholder="HR at easy pace"></label>
<label>Investigation<input name="collection" maxlength="80" required value="My analyses" placeholder="Easy-run effort"></label>
<label>Notes<textarea name="notes" maxlength="4000" rows="3" placeholder="What are you investigating? What should you check next?"></textarea></label>
<div class="analysis-settings"><label>Dashboard display<select name="view"><option value="chart">Plot</option><option value="value">Summary values</option><option value="table">Grouped table</option></select></label><label>Widget width<select name="width"><option value="half">Half width</option><option value="full">Full width</option></select></label></div>
<label class="analysis-check"><input name="pinned" type="checkbox"> Pin to live dashboard</label>
<p id="save-analysis-error" class="studio-error" role="alert"></p>
<div class="studio-row bottom"><button type="button" class="button secondary" id="save-analysis-copy">Save as new</button><button class="button primary" type="submit" id="save-analysis-submit">Save analysis</button></div>
</form>
</dialog>
<details class="panel analysis-builder">
<summary>Build a comparable-effort investigation</summary>
<form id="matched-effort-form">
<div class="analysis-settings">
<label>Compare inputs<select name="source"><option value="runs">Whole runs</option><option value="segments">Steady moving segments</option></select></label>
<label>Pace from · min/km<input name="pace_low" value="5:20" pattern="[0-9]+:[0-5][0-9]" required></label>
<label>Pace to · min/km<input name="pace_high" value="5:40" pattern="[0-9]+:[0-5][0-9]" required></label>
<label>Max ascent per km · m/km<input name="hills" type="number" min="0" max="1000" value="10" required></label>
<label>Current window · weeks<input name="weeks" type="number" min="1" max="104" value="12" required></label>
<label>Earlier baseline · days<input name="baseline" type="number" min="7" max="732" value="90" required></label>
<label>Minimum usable inputs per week<input name="minimum" type="number" min="2" max="1000" value="3" required></label>
</div>
<p class="field-help">Segments also require ≤5% speed variation, ≥80% moving HR coverage and ≥4 minutes. Matching pace and hills narrows the cohort; conditions can still differ.</p>
<button class="button primary" type="submit">Explore matched heart rate</button>
</form>
</details>
<details class="panel analysis-preset-gallery">
<summary>Start with a question</summary>
<div class="analysis-presets">{% for preset in presets %}<a class="analysis-preset" href="{{ url_for('web.stats', query=preset.query) }}"><span class="eyebrow">{{ preset.category }}</span><h3>{{ preset.name }}</h3><p>{{ preset.description }}</p></a>{% endfor %}</div>
</details>
<script id="selected-analysis" type="application/json">{{ selected_analysis|tojson }}</script>