Only load graphs when they come into view

This commit is contained in:
Peter Stockings
2026-02-03 23:52:59 +11:00
parent 9998616946
commit a6a71f3139
2 changed files with 13 additions and 3 deletions

View File

@@ -105,7 +105,13 @@
<div class="mt-4 mb-4 w-full grid grid-cols-1 2xl:grid-cols-2 gap-4">
{% for graph in exercise_progress_graphs %}
{{ render_partial('partials/sparkline.html', **graph.progress_graph) }}
<div hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=graph.exercise_id, min_date=min_date, max_date=max_date) }}"
hx-trigger="intersect once" hx-swap="outerHTML">
<div class="flex items-center justify-center h-48 bg-gray-50 rounded-lg">
<div class="text-sm text-gray-400 animate-pulse font-medium">Loading {{ graph.exercise_name }}...
</div>
</div>
</div>
{% endfor %}
</div>