Fix issue where adding a set would result in two 'Topset added' notification

This commit is contained in:
Peter Stockings
2026-02-03 22:51:19 +11:00
parent 437271bc8c
commit db8d39d1eb

View File

@@ -1,4 +1,5 @@
<form class="w-full" id="new-set-workout-{{ workout_id }}"
<div id="new-set-form-container-{{ workout_id }}" class="w-full">
<form class="w-full" id="new-set-workout-{{ workout_id }}"
hx-post="{{ url_for('workout.create_topset', person_id=person_id, workout_id=workout_id) }}" hx-swap="beforeend"
hx-target="#new-workout" _="on htmx:afterOnLoad if #no-workouts add .hidden to #no-workouts end
on topsetAdded
@@ -41,7 +42,8 @@
class="flex items-center justify-center py-2 px-2 md:px-3 mb-3 text-sm font-medium text-center text-gray-900 bg-cyan-600 hover:bg-cyan-700 rounded-lg border border-gray-300 hover:scale-[1.02] transition-transform mb-6 md:mb-0 mt-0 md:mt-6 w-full"
type="submit">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" class="w-7 h-7">
<path d="M12 4a1 1 0 011 1v6h6a1 1 0 110 2h-6v6a1 1 0 11-2 0v-6H5a1 1 0 110-2h6V5a1 1 0 011-1z" />
<path
d="M12 4a1 1 0 011 1v6h6a1 1 0 110 2h-6v6a1 1 0 11-2 0v-6H5a1 1 0 110-2h6V5a1 1 0 011-1z" />
</svg>
</button>
</div>
@@ -49,20 +51,21 @@
</div>
</form>
</form>
<div hx-trigger="exerciseSelected from:body"
<div hx-trigger="exerciseSelected from:body"
hx-get="{{ url_for('workout.get_most_recent_topset_for_exercise', person_id=person_id, workout_id=workout_id) }}"
hx-target="#new-set-workout-{{ workout_id }}" hx-include="[name='exercise_id']">
</div>
hx-target="#new-set-form-container-{{ workout_id }}" hx-include="[name='exercise_id']">
</div>
{% if exercise_id %}
<div class="flex items-center justify-center">
{% if exercise_id %}
<div class="flex items-center justify-center">
<div class="md:w-full max-w-screen-sm">
<div class="hidden"
hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id) }}"
hx-trigger="load" hx-target="this" hx-swap="outerHTML">
</div>
</div>
</div>
{% endif %}
</div>
{% endif %}