Add button to topsets to show history as a table

This commit is contained in:
Peter Stockings
2026-02-26 23:26:49 +11:00
parent 67009c9603
commit 895b813a35
4 changed files with 127 additions and 19 deletions

View File

@@ -6,18 +6,32 @@
hx-vals='{"filter": "?exercise_id={{ exercise_id }}", "person_id" : "{{ person_id }}" }'
hx-target="#container" hx-swap="innerHTML" hx-push-url="true"
_='on click trigger closeModalWithoutRefresh'>{{ exercise_name }}</span>
<button
class="inline-flex justify-center p-1 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600"
title="Show Progress Graph"
hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id) }}"
hx-target="#graph-content-{{ topset_id }}" hx-swap="innerHTML">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path>
</svg>
<span class="sr-only">Show Progress Graph</span>
</button>
<div class="flex flex-col sm:flex-row space-y-1 sm:space-y-0 sm:space-x-1">
<button
class="inline-flex justify-center p-1 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600"
title="Show Progress Graph"
hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id) }}"
hx-target="#extra-content-{{ topset_id }}" hx-swap="innerHTML">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path>
</svg>
<span class="sr-only">Show Progress Graph</span>
</button>
<button
class="inline-flex justify-center p-1 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600"
title="Show History"
hx-get="{{ url_for('workout.get_exercise_history', person_id=person_id, exercise_id=exercise_id, source_topset_id=topset_id) }}"
hx-target="#extra-content-{{ topset_id }}" hx-swap="innerHTML">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4 6h16M4 10h16M4 14h16M4 18h16"></path>
</svg>
<span class="sr-only">Show History</span>
</button>
</div>
</div>
{% else %}
<div class="w-full">
@@ -103,10 +117,10 @@
</div>
</td>
</tr>
{# Target row modified for dismissible graph #}
<tr id="graph-target-{{ topset_id }}">
{# Target row modified for dismissible extra content (graph or history) #}
<tr id="extra-target-{{ topset_id }}">
<td colspan="3" class="p-0 relative">
<div id="graph-content-{{ topset_id }}" class="graph-content-container" _="
<div id="extra-content-{{ topset_id }}" class="extra-content-container" _="
on htmx:afterSwap
get the next <button.dismiss-button/>
if my.innerHTML is not empty and my.innerHTML is not ' '
@@ -115,12 +129,12 @@
add .hidden to it
end
end">
<!-- Progress graph will be loaded here -->
<!-- Progress graph or history will be loaded here -->
</div>
<button
class="absolute top-1 right-1 p-1 bg-white rounded-full text-gray-500 hover:text-gray-700 hover:bg-gray-100 z-10 dismiss-button hidden"
title="Dismiss Graph" _="on click
get #graph-content-{{ topset_id }}
title="Dismiss Content" _="on click
get #extra-content-{{ topset_id }}
set its innerHTML to ''
add .hidden to me
end">
@@ -129,7 +143,7 @@
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clip-rule="evenodd"></path>
</svg>
<span class="sr-only">Dismiss Graph</span>
<span class="sr-only">Dismiss Content</span>
</button>
</td>
</tr>