Make site even more responsive

This commit is contained in:
Peter Stockings
2023-12-08 21:23:26 +11:00
parent db8ae218fc
commit 0fa3d4b74b
4 changed files with 30 additions and 29 deletions

View File

@@ -39,7 +39,6 @@ tr.htmx-swapping td {
border-radius: 8px;
box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.3);
background-color: white;
padding: 20px;
/* Animate when opening */
animation-name: zoomIn;
animation-duration: 150ms;

View File

@@ -8,7 +8,7 @@
then trigger clearNewSetInputs">
<div class="flex flex-wrap -mx-3 mb-2" id="new-set-workout-{{ workout_id }}">
<div class="w-full md:w-1/3 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 class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-state">
Exercise
</label>
@@ -34,7 +34,7 @@
</div>
</div>
<div class="w-full md:w-1/3 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 class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
Reps
</label>
@@ -44,7 +44,7 @@
_="on clearNewSetInputs set my.placeholder to ''" {% endif %}>
</div>
<div class="w-full md:w-1/3 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 class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-zip">
Weight
</label>
@@ -56,7 +56,7 @@
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4 pt-2 px-0 sm:px-2">
<button
class="py-2 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"
class="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"
type="submit">
Add top set
</button>
@@ -64,7 +64,7 @@
<button hx-confirm="Are you sure you wish to delete this workout?"
hx-delete="{{ url_for('delete_workout', person_id=person_id, workout_id=workout_id) }}"
_='on click trigger closeModal'
class="py-2 px-3 mb-3 text-sm font-medium text-center text-gray-900 bg-white rounded-lg border border-gray-300 hover:bg-gray-100 hover:scale-[1.02] transition-transform">Delete
class="py-2 px-2 md:px-3 mb-3 text-sm font-medium text-center text-gray-900 bg-white rounded-lg border border-gray-300 hover:bg-gray-100 hover:scale-[1.02] transition-transform">Delete
workout</button>
</div>
</form>

View File

@@ -1,42 +1,44 @@
{% set fill = "#dcfce7" %}
{% set stroke = "#bbf7d0" %}
{% set stroke_width = 4 %}
{% set margin = 0 %} {# space allocated for axis labels and ticks #}
{% set margin = 2 %}
{% macro path(data_points, vb_height) %}
{% for value, position, message in data_points %}
{% set x = position * vb_width %}
{% set y = vb_height - value %}
{% set x = (position * vb_width)+margin %}
{% set y = (vb_height - value)+margin %}
{% if loop.first %}M{{ x }} {{ y }}{% else %} L{{ x }} {{ y }}{% endif %}
{% endfor %}
{% endmacro %}
{% macro circles(data_points, vb_height) %}
{% for value, position, message in data_points %}
{% set x = position * vb_width %}
{% set y = vb_height - value %}
{% set x = (position * vb_width)+margin %}
{% set y = (vb_height - value)+margin %}
<circle cx="{{ x }}" cy="{{ y }}" r="5" class="cursor-pointer" data-message="{{ message }}" fill-opacity="0%"
_="on mouseover
put my @data-message into #popover
then remove .hidden from #popover
put my @data-message into #popover-{{ unique_id }}
then remove .hidden from #popover-{{ unique_id }}
on mouseout
add .hidden to #popover">
add .hidden to #popover-{{ unique_id }}">
</circle>
<circle cx="{{ x }}" cy="{{ y }}" r="1" stroke="blue" fill="blue"></circle>
{% endfor %}
{% endmacro %}
{% macro closed_path(points, vb_width, vb_height) %}
{{ path(points, vb_width, vb_height) }} L {{ vb_width + 2*margin }} {{ vb_height + 2*margin }} L {{ 2*margin }} {{ vb_height + 2*margin }} Z
{% endmacro %}
<!-- HubSpot doesn't escape whitespace. -->
{% macro random_int() %}{% for n in [0,1,2,3,4,5] %}{{ [0,1,2,3,4,5,6,7,8,9]|random }}{% endfor %}{% endmacro %}
<!-- You have to manually call the macros in a list. -->
{% set parts = [random_int()] %}
{% set unique_id = parts|join('-') %}
<div class="relative">
<div id="popover" 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 -->
</div>
<svg viewBox="0 0 {{ vb_width }} {{ vb_height }}" preserveAspectRatio="none">
<svg viewBox="0 0 {{ vb_width + 4 }} {{ vb_height + 4 }}" preserveAspectRatio="none">
<path d="{{ path(data_points, vb_height) }}" stroke="blue" fill="none" />
{{ circles(data_points, vb_height) }}
</svg>
</div>

View File

@@ -10,12 +10,12 @@
then remove me
then toggle .hide-scrollbar on document.body'>
<div class='modal-underlay' _='on click trigger closeModal'></div>
<div class='modal-content m-4 sm:mt-24 max-h-[95%]' _='init toggle .hide-scrollbar on document.body'>
<div class='modal-content p-2 md:p-4 m-2 sm:mt-24 max-h-[98%]' _='init toggle .hide-scrollbar on document.body'>
<div class="relative w-full h-full max-w-2xl md:h-auto overflow-auto">
<!-- Modal content -->
<div class="relative bg-white rounded-lg shadow">
<!-- Modal header -->
<div class="flex items-start justify-between p-4 border-b rounded-t">
<div class="flex items-start justify-between p-2 md:p-4 border-0 md:border-b rounded-t">
<div class="flex flex-col w-full">
<div class="flex items-center justify-between">
<div class="w-full">
@@ -59,7 +59,7 @@
</div>
<!-- Modal body -->
<div class="p-6 space-y-6">
<div class="p-3 md:p-6 space-y-6">
<table class="items-center w-full bg-transparent border-collapse table-fixed">
<thead>
<tr>
@@ -94,7 +94,7 @@
{% endif %}
</div>
<!-- Modal footer -->
<div class="flex items-center p-6 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600">
<div class="flex items-center p-3 md:p-6 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600">
{{ render_partial('partials/new_set_form.html', person_id=workout['PersonId'],
workout_id=workout['WorkoutId'],
exercises=exercises,