Compare commits

...

4 Commits

Author SHA1 Message Date
Peter Stockings
afc5749c82 Reduce size of logo 2026-02-03 23:08:45 +11:00
Peter Stockings
2d1509a0cd Remove dependencies on external fonts 2026-02-03 23:03:29 +11:00
Peter Stockings
83c3cd83a6 Remove SweetAlert 2 library 2026-02-03 22:55:12 +11:00
Peter Stockings
db8d39d1eb Fix issue where adding a set would result in two 'Topset added' notification 2026-02-03 22:51:19 +11:00
4 changed files with 152 additions and 200 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -7,15 +7,12 @@
<title>Workout Tracker</title> <title>Workout Tracker</title>
<link rel="icon" type="image/png" href="{{ url_for('static', filename='img/logo.png') }}"> <link rel="icon" type="image/png" href="{{ url_for('static', filename='img/logo.png') }}">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900&display=swap" rel="stylesheet" />
<link rel="stylesheet" type="text/css"
href="https://cdn.rawgit.com/dreampulse/computer-modern-web-font/master/fonts.css">
<link href="/static/css/tailwind.css" rel="stylesheet"> <link href="/static/css/tailwind.css" rel="stylesheet">
<link href="/static/css/style.css" rel="stylesheet"> <link href="/static/css/style.css" rel="stylesheet">
<script src="/static/js/htmx.min.js" defer></script> <script src="/static/js/htmx.min.js" defer></script>
<script src="/static/js/hyperscript.min.js"></script> <script src="/static/js/hyperscript.min.js"></script>
<script src="/static/js/sweetalert2@11.js" defer></script>
</head> </head>
<body> <body>

View File

@@ -1,68 +1,71 @@
<form class="w-full" id="new-set-workout-{{ workout_id }}" <div id="new-set-form-container-{{ workout_id }}" class="w-full">
hx-post="{{ url_for('workout.create_topset', person_id=person_id, workout_id=workout_id) }}" hx-swap="beforeend" <form class="w-full" id="new-set-workout-{{ workout_id }}"
hx-target="#new-workout" _="on htmx:afterOnLoad if #no-workouts add .hidden to #no-workouts end hx-post="{{ url_for('workout.create_topset', person_id=person_id, workout_id=workout_id) }}" hx-swap="beforeend"
on topsetAdded hx-target="#new-workout" _="on htmx:afterOnLoad if #no-workouts add .hidden to #no-workouts end
render #notification-template with (message: 'Topset added') then append it to #notifications-container on topsetAdded
then call _hyperscript.processNode(#notifications-container) render #notification-template with (message: 'Topset added') then append it to #notifications-container
then reset() me then call _hyperscript.processNode(#notifications-container)
then trigger clearNewSetInputs"> then reset() me
then trigger clearNewSetInputs">
<div class="flex flex-wrap -mx-3 mb-2">
<div class="w-full md:w-[30%] px-2 md:px-3 mb-6 md:mb-0">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-state">
Exercise
</label>
{{ render_partial('partials/exercise/exercise_select.html', person_id=person_id,
exercise_id=exercise_id, exercise_name=exercise_name) }}
</div>
<div class="w-full md:w-[30%] px-2 md:px-3 mb-6 md:mb-0">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
Reps
</label>
<input
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="grid-city" type="number" name="repetitions" {% if repetitions %} placeholder="{{ repetitions }}"
_="on clearNewSetInputs set my.placeholder to ''" {% endif %}>
</div>
<div class="w-full md:w-[30%] px-2 md:px-3 mb-6 md:mb-0">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-zip">
Weight
</label>
<input
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="grid-zip" type="number" name="weight" step="any" {% if weight %} placeholder="{{ weight }}"
_="on clearNewSetInputs set my.placeholder to ''" {% endif %}>
</div>
<div class="w-full md:w-[10%] px-2 md:px-3 mb-6 md:mb-0">
<button
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" />
</svg>
</button>
</div>
<div class="flex flex-wrap -mx-3 mb-2">
<div class="w-full md:w-[30%] px-2 md:px-3 mb-6 md:mb-0">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-state">
Exercise
</label>
{{ render_partial('partials/exercise/exercise_select.html', person_id=person_id,
exercise_id=exercise_id, exercise_name=exercise_name) }}
</div>
<div class="w-full md:w-[30%] px-2 md:px-3 mb-6 md:mb-0">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
Reps
</label>
<input
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="grid-city" type="number" name="repetitions" {% if repetitions %} placeholder="{{ repetitions }}"
_="on clearNewSetInputs set my.placeholder to ''" {% endif %}>
</div>
<div class="w-full md:w-[30%] px-2 md:px-3 mb-6 md:mb-0">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-zip">
Weight
</label>
<input
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="grid-zip" type="number" name="weight" step="any" {% if weight %} placeholder="{{ weight }}"
_="on clearNewSetInputs set my.placeholder to ''" {% endif %}>
</div>
<div class="w-full md:w-[10%] px-2 md:px-3 mb-6 md:mb-0">
<button
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" />
</svg>
</button>
</div> </div>
</form>
<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-form-container-{{ workout_id }}" hx-include="[name='exercise_id']">
</div> </div>
</form> {% if exercise_id %}
<div class="flex items-center justify-center">
<div hx-trigger="exerciseSelected from:body" <div class="md:w-full max-w-screen-sm">
hx-get="{{ url_for('workout.get_most_recent_topset_for_exercise', person_id=person_id, workout_id=workout_id) }}" <div class="hidden"
hx-target="#new-set-workout-{{ workout_id }}" hx-include="[name='exercise_id']"> hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id) }}"
</div> hx-trigger="load" hx-target="this" hx-swap="outerHTML">
</div>
{% 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> </div>
{% endif %}
</div> </div>
{% endif %}

View File

@@ -2,32 +2,32 @@
{% set margin = 2 %} {% set margin = 2 %}
{% macro path(data_points, vb_height) %} {% macro path(data_points, vb_height) %}
{% for value, position in data_points %} {% for value, position in data_points %}
{% set x = (position * vb_width)+margin %} {% set x = (position * vb_width)+margin %}
{% set y = (vb_height - value)+margin %} {% set y = (vb_height - value)+margin %}
{% if loop.first %}M{{ x | int }} {{ y | int }}{% else %} L{{ x | int }} {{ y | int }}{% endif %} {% if loop.first %}M{{ x | int }} {{ y | int }}{% else %} L{{ x | int }} {{ y | int }}{% endif %}
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
{% macro path_best_fit(best_fit_points, vb_height) %} {% macro path_best_fit(best_fit_points, vb_height) %}
{% for value, position in best_fit_points %} {% for value, position in best_fit_points %}
{% set x = (position * vb_width)+margin %} {% set x = (position * vb_width)+margin %}
{% set y = (vb_height - value)+margin %} {% set y = (vb_height - value)+margin %}
{% if loop.first %}M{{ x | int }} {{ y | int }}{% else %} L{{ x | int }} {{ y | int }}{% endif %} {% if loop.first %}M{{ x | int }} {{ y | int }}{% else %} L{{ x | int }} {{ y | int }}{% endif %}
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
{% macro circles(data_points, color) %} {% macro circles(data_points, color) %}
{% for value, position in data_points %} {% for value, position in data_points %}
{% set x = (position * vb_width)+margin %} {% set x = (position * vb_width)+margin %}
{% set y = (vb_height - value)+margin %} {% set y = (vb_height - value)+margin %}
<circle cx="{{ x | int }}" cy="{{ y | int }}" r="1"></circle> <circle cx="{{ x | int }}" cy="{{ y | int }}" r="1"></circle>
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
{% macro plot_line(points, color) %} {% macro plot_line(points, color) %}
<path d="{{ path(points, vb_height) }}" stroke="{{ color }}" fill="none" /> <path d="{{ path(points, vb_height) }}" stroke="{{ color }}" fill="none" />
{{ circles(points, color) }} {{ circles(points, color) }}
{% endmacro %} {% endmacro %}
<!-- HubSpot doesn't escape whitespace. --> <!-- HubSpot doesn't escape whitespace. -->
@@ -44,194 +44,146 @@
on mouseout from .pnt-{{ unique_id }} on mouseout from .pnt-{{ unique_id }}
add .hidden to #popover-{{ unique_id }}"> add .hidden to #popover-{{ unique_id }}">
<div id="popover-{{ unique_id }}" class="absolute t-0 r-0 hidden bg-white border border-gray-300 p-2 z-10"> <div id="popover-{{ unique_id }}" class="absolute t-0 r-0 hidden bg-white border border-gray-300 p-2 z-10">
<!-- Popover content will be dynamically inserted here --> <!-- Popover content will be dynamically inserted here -->
</div> </div>
<h4 class="text-l font-semibold text-blue-400 text-center">{{ title }}</h4> <h4 class="text-l font-semibold text-blue-400 text-center">{{ title }}</h4>
<h2 class="text-xs font-semibold text-blue-200 mb-1 text-center" style='font-family: "Computer Modern Sans", sans-serif;'> <h2 class="text-xs font-semibold text-blue-200 mb-1 text-center">
{% if best_fit_formula %} {% if best_fit_formula %}
{{ best_fit_formula.kg_per_week }} kg/week, {{ best_fit_formula.kg_per_month }} kg/month {{ best_fit_formula.kg_per_week }} kg/week, {{ best_fit_formula.kg_per_month }} kg/month
{% endif %} {% endif %}
</h2> </h2>
<div class="inline-flex rounded-md shadow-sm w-full items-center justify-center mb-1"> <div class="inline-flex rounded-md shadow-sm w-full items-center justify-center mb-1">
{% for epoch in epochs %} {% for epoch in epochs %}
<div <div {% if selected_epoch==epoch %}
{% if selected_epoch == epoch %} class="px-4 py-2 text-sm font-medium text-blue-700 bg-white border border-gray-200 rounded-s-lg hover:bg-gray-100 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white"
class="px-4 py-2 text-sm font-medium text-blue-700 bg-white border border-gray-200 rounded-s-lg hover:bg-gray-100 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white"
{% else %} {% else %}
class="px-4 py-2 text-sm font-medium text-gray-900 bg-white border border-gray-200 rounded-e-lg hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white cursor-pointer" class="px-4 py-2 text-sm font-medium text-gray-900 bg-white border border-gray-200 rounded-e-lg hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white cursor-pointer"
hx-get='{{ url_for("get_exercise_progress_for_user", person_id=person_id, exercise_id=exercise_id, epoch=epoch) }}' hx-target="#svg-plot-{{ unique_id }}" hx-swap="outerHTML" hx-trigger="click" hx-get='{{ url_for("get_exercise_progress_for_user", person_id=person_id, exercise_id=exercise_id, epoch=epoch) }}'
{% endif %}> hx-target="#svg-plot-{{ unique_id }}" hx-swap="outerHTML" hx-trigger="click" {% endif %}>
{% if epoch == 'Custom' %} {% if epoch == 'Custom' %}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5 {% if selected_epoch == 'Custom' %}text-blue-700{% else %}text-gray-500{% endif %} group-hover:text-gray-900"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
<path d="M10 3.75a2 2 0 1 0-4 0 2 2 0 0 0 4 0ZM17.25 4.5a.75.75 0 0 0 0-1.5h-5.5a.75.75 0 0 0 0 1.5h5.5ZM5 3.75a.75.75 0 0 1-.75.75h-1.5a.75.75 0 0 1 0-1.5h1.5a.75.75 0 0 1 .75.75ZM4.25 17a.75.75 0 0 0 0-1.5h-1.5a.75.75 0 0 0 0 1.5h1.5ZM17.25 17a.75.75 0 0 0 0-1.5h-5.5a.75.75 0 0 0 0 1.5h5.5ZM9 10a.75.75 0 0 1-.75.75h-5.5a.75.75 0 0 1 0-1.5h5.5A.75.75 0 0 1 9 10ZM17.25 10.75a.75.75 0 0 0 0-1.5h-1.5a.75.75 0 0 0 0 1.5h1.5ZM14 10a2 2 0 1 0-4 0 2 2 0 0 0 4 0ZM10 16.25a2 2 0 1 0-4 0 2 2 0 0 0 4 0Z" /> class="w-5 h-5 {% if selected_epoch == 'Custom' %}text-blue-700{% else %}text-gray-500{% endif %} group-hover:text-gray-900">
</svg> <path
{% else %} d="M10 3.75a2 2 0 1 0-4 0 2 2 0 0 0 4 0ZM17.25 4.5a.75.75 0 0 0 0-1.5h-5.5a.75.75 0 0 0 0 1.5h5.5ZM5 3.75a.75.75 0 0 1-.75.75h-1.5a.75.75 0 0 1 0-1.5h1.5a.75.75 0 0 1 .75.75ZM4.25 17a.75.75 0 0 0 0-1.5h-1.5a.75.75 0 0 0 0 1.5h1.5ZM17.25 17a.75.75 0 0 0 0-1.5h-5.5a.75.75 0 0 0 0 1.5h5.5ZM9 10a.75.75 0 0 1-.75.75h-5.5a.75.75 0 0 1 0-1.5h5.5A.75.75 0 0 1 9 10ZM17.25 10.75a.75.75 0 0 0 0-1.5h-1.5a.75.75 0 0 0 0 1.5h1.5ZM14 10a2 2 0 1 0-4 0 2 2 0 0 0 4 0ZM10 16.25a2 2 0 1 0-4 0 2 2 0 0 0 4 0Z" />
{{ epoch}} </svg>
{% endif %} {% else %}
</div> {{ epoch}}
{% endif %}
</div>
{% endfor %} {% endfor %}
</div> </div>
{% if selected_epoch == 'Custom' %} {% if selected_epoch == 'Custom' %}
<div class="flex flex-col md:flex-row justify-center pb-4"> <div class="flex flex-col md:flex-row justify-center pb-4">
<!-- Min Date --> <!-- Min Date -->
<div class="w-full md:w-1/3 px-2 md:px-3 mb-6 md:mb-0"> <div class="w-full md:w-1/3 px-2 md:px-3 mb-6 md:mb-0">
<label <label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" Min date
for="grid-city"
>
Min date
</label> </label>
<div class="relative pr-2"> <div class="relative pr-2">
<div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
<svg <svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor"
aria-hidden="true" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
class="w-5 h-5 text-gray-500 dark:text-gray-400" <path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2
2 0 002 2h12a2 2 0 002-2V6a2 2 0 2 0 002 2h12a2 2 0 002-2V6a2 2 0
00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1
1 0 00-1-1zm0 5a1 1 0 000 1 0 00-1-1zm0 5a1 1 0 000
2h8a1 1 0 100-2H6z" 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path>
clip-rule="evenodd" </svg>
></path> </div>
</svg> <input type="date" class="bg-gray-50 border border-gray-300 text-gray-900
</div>
<input
type="date"
class="bg-gray-50 border border-gray-300 text-gray-900
text-sm rounded-lg focus:ring-blue-500 text-sm rounded-lg focus:ring-blue-500
focus:border-blue-500 block w-full pl-10 p-2.5" focus:border-blue-500 block w-full pl-10 p-2.5" name="min_date" value="{{ min_date }}"
name="min_date" hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id) }}"
value="{{ min_date }}" hx-include="#svg-plot-{{ unique_id }} [name='max_date'], #svg-plot-{{ unique_id }} [name='degree']"
hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id) }}" hx-vals='{"epoch": "Custom"}' hx-target="#svg-plot-{{ unique_id }}" hx-swap="outerHTML"
hx-include="#svg-plot-{{ unique_id }} [name='max_date'], #svg-plot-{{ unique_id }} [name='degree']" hx-trigger="change">
hx-vals='{"epoch": "Custom"}'
hx-target="#svg-plot-{{ unique_id }}"
hx-swap="outerHTML"
hx-trigger="change"
>
</div> </div>
</div> </div>
<!-- Max Date --> <!-- Max Date -->
<div class="w-full md:w-1/3 px-2 md:px-3 mb-6 md:mb-0"> <div class="w-full md:w-1/3 px-2 md:px-3 mb-6 md:mb-0">
<label <label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-zip">
class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" Max date
for="grid-zip"
>
Max date
</label> </label>
<div class="relative pr-2"> <div class="relative pr-2">
<div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
<svg <svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor"
aria-hidden="true" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
class="w-5 h-5 text-gray-500 dark:text-gray-400" <path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M6 2a1 1 0 00-1 1v1H4a2 2 0
00-2 2v10a2 2 0 002 2h12a2 00-2 2v10a2 2 0 002 2h12a2
2 0 002-2V6a2 2 0 00-2-2h-1V3a1 2 0 002-2V6a2 2 0 00-2-2h-1V3a1
1 0 10-2 0v1H7V3a1 1 0 1 0 10-2 0v1H7V3a1 1 0
00-1-1zm0 5a1 1 0 000 00-1-1zm0 5a1 1 0 000
2h8a1 1 0 100-2H6z" 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path>
clip-rule="evenodd"
></path>
</svg> </svg>
</div> </div>
<input <input type="date" class="bg-gray-50 border border-gray-300
type="date"
class="bg-gray-50 border border-gray-300
text-gray-900 text-sm rounded-lg text-gray-900 text-sm rounded-lg
focus:ring-blue-500 focus:border-blue-500 focus:ring-blue-500 focus:border-blue-500
block w-full pl-10 p-2.5" block w-full pl-10 p-2.5" name="max_date" value="{{ max_date }}"
name="max_date"
value="{{ max_date }}"
hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id) }}" hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id) }}"
hx-include="#svg-plot-{{ unique_id }} [name='min_date'], #svg-plot-{{ unique_id }} [name='degree']" hx-include="#svg-plot-{{ unique_id }} [name='min_date'], #svg-plot-{{ unique_id }} [name='degree']"
hx-vals='{"epoch": "Custom"}' hx-vals='{"epoch": "Custom"}' hx-target="#svg-plot-{{ unique_id }}" hx-swap="outerHTML"
hx-target="#svg-plot-{{ unique_id }}" hx-trigger="change">
hx-swap="outerHTML"
hx-trigger="change"
>
</div> </div>
</div> </div>
<!-- Degree --> <!-- Degree -->
<div class="w-full md:w-1/3 px-2 md:px-3 mb-6 md:mb-0"> <div class="w-full md:w-1/3 px-2 md:px-3 mb-6 md:mb-0">
<label <label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-zip">
class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" Degree
for="grid-zip"
>
Degree
</label> </label>
<div class="relative pr-2"> <div class="relative pr-2">
<div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 text-gray-500 dark:text-gray-400"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
<path stroke-linecap="round" stroke-linejoin="round" d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z" /> stroke="currentColor" class="w-5 h-5 text-gray-500 dark:text-gray-400">
</svg> <path stroke-linecap="round" stroke-linejoin="round"
d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z" />
</svg>
</div> </div>
<input type="number" <input type="number"
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 w-full" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 w-full"
name="degree" name="degree" value="{{ degree }}" min="1" step="1"
value="{{ degree }}" hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id) }}"
min="1" hx-include="#svg-plot-{{ unique_id }} [name='min_date'], #svg-plot-{{ unique_id }} [name='max_date']"
step="1" hx-vals='{"epoch": "Custom"}' hx-target="#svg-plot-{{ unique_id }}" hx-swap="outerHTML"
hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id) }}" hx-trigger="change">
hx-include="#svg-plot-{{ unique_id }} [name='min_date'], #svg-plot-{{ unique_id }} [name='max_date']"
hx-vals='{"epoch": "Custom"}'
hx-target="#svg-plot-{{ unique_id }}" hx-swap="outerHTML" hx-trigger="change">
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
<svg viewBox="0 0 {{ (vb_width + 2*margin) | int }} {{ (vb_height + 2*margin) | int }}" preserveAspectRatio="none"> <svg viewBox="0 0 {{ (vb_width + 2*margin) | int }} {{ (vb_height + 2*margin) | int }}" preserveAspectRatio="none">
{% for plot in plots %} {% for plot in plots %}
<g class="{{ plot.label }}" style="fill: {{ plot.color }}; stroke: {{ plot.color }};"> <g class="{{ plot.label }}" style="fill: {{ plot.color }}; stroke: {{ plot.color }};">
{{ plot_line(plot.points, plot.color) }} {{ plot_line(plot.points, plot.color) }}
</g> </g>
{% endfor %} {% endfor %}
<g style="fill-opacity: 0%"> <g style="fill-opacity: 0%">
{% for pos, message in plot_labels %} {% for pos, message in plot_labels %}
{% set x = (pos * vb_width) - (stroke_width/2) + margin %} {% set x = (pos * vb_width) - (stroke_width/2) + margin %}
{% set y = 0 %} {% set y = 0 %}
{% set width = stroke_width %} {% set width = stroke_width %}
{% set height = vb_height + margin %} {% set height = vb_height + margin %}
<rect <rect x="{{ x | int }}" y="{{ y | int }}" width="{{ width | int }}" height="{{ height | int }}"
x="{{ x | int }}" class="pnt-{{ unique_id }}" data-msg="{{ message }}"></rect>
y="{{ y | int }}" {% endfor %}
width="{{ width | int }}"
height="{{ height | int }}"
class="pnt-{{ unique_id }}"
data-msg="{{ message }}"></rect>
{% endfor %}
</g> </g>
<path d="{{ path_best_fit(best_fit_points, vb_height) }}" stroke="gray" stroke-dasharray="2,1" fill="none" stroke-opacity="60%"/> <path d="{{ path_best_fit(best_fit_points, vb_height) }}" stroke="gray" stroke-dasharray="2,1" fill="none"
stroke-opacity="60%" />
</svg> </svg>
<div class="flex justify-center pt-2"> <div class="flex justify-center pt-2">
{% for plot in plots %} {% for plot in plots %}
<div class="flex items-center px-2 select-none cursor-pointer" <div class="flex items-center px-2 select-none cursor-pointer" _="on load put document.querySelector('#svg-plot-{{ unique_id }} g.{{plot.label}}') into my.plot_line
_="on load put document.querySelector('#svg-plot-{{ unique_id }} g.{{plot.label}}') into my.plot_line
on click toggle .hidden on my.plot_line then toggle .line-through on me"> on click toggle .hidden on my.plot_line then toggle .line-through on me">
<div class="w-3 h-3 mr-1" style="background-color: {{ plot.color }};"></div> <div class="w-3 h-3 mr-1" style="background-color: {{ plot.color }};"></div>
<div class="text-xs">{{ plot.label }}</div> <div class="text-xs">{{ plot.label }}</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>