Completely remove dependency on plotly, undecided as to whether I should refactor dashboard/people views so they render graphs statically rather then using htmx to fetch on load, probably a smarter move but too lazy atm
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Workout Tracker</title>
|
||||
<script src="/static/js/plotly-basic-2.20.0.min.js" defer></script>
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900&display=swap" rel="stylesheet" />
|
||||
<link type="text/css" rel="stylesheet" href="/static/css/tail.select.min.css">
|
||||
<script src="/static/js/tail.select.min.js"></script>
|
||||
@@ -16,29 +15,6 @@
|
||||
<script src="/static/js/hyperscript.min.js" defer></script>
|
||||
<script src="/static/js/sweetalert2@11.js" defer></script>
|
||||
|
||||
<script>
|
||||
function debounce(func, timeout = 300) {
|
||||
let timer;
|
||||
return (...args) => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => { func.apply(this, args); }, timeout);
|
||||
};
|
||||
}
|
||||
window.addEventListener('resize', () => {
|
||||
debounce(() => window.dispatchEvent(new Event('resize')))
|
||||
})
|
||||
</script>
|
||||
|
||||
<script>
|
||||
let layout = {
|
||||
margin: { t: 0 }, xaxis: { type: 'date', showgrid: false }, yaxis: {
|
||||
title: 'Estimated 1RM (kg)',
|
||||
showgrid: false
|
||||
}
|
||||
};
|
||||
let config = { responsive: true, displayModeBar: false };
|
||||
let hovertemplate = '<i>Estimated 1RM</i>: <b>%{y}kg</b><br><i>Topset</i>:<b>%{text}</b><br><i>Date</i>: <b>%{x}</b>';
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -134,17 +134,14 @@
|
||||
<div class="overflow-x-auto rounded-lg">
|
||||
<div class="align-middle inline-block min-w-full">
|
||||
<div class="shadow overflow-hidden sm:rounded-lg">
|
||||
<h4 class="text-l font-semibold text-blue-400 mb-2 text-center">{{ e['ExerciseName'] }}</h4>
|
||||
{% if e['RepMaxes']|length > 1 %}
|
||||
<div class="w-full mt-2 aspect-video" _="init js(me)
|
||||
Plotly.newPlot(me, [{
|
||||
x: {{ e['EstimatedOneRepMaxProgressions']['StartDates'] | replace_double_quote_strings_with_single_quote | safe }},
|
||||
y: {{ e['EstimatedOneRepMaxProgressions']['Estimated1RMs'] | replace_double_quote_strings_with_single_quote | safe }},
|
||||
text: {{ e['EstimatedOneRepMaxProgressions']['TopSets'] | replace_double_quote_strings_with_single_quote | safe }},
|
||||
name: '{{ p['PersonName'] }} - {{ e['ExerciseName'] }}' , hovertemplate }], layout,
|
||||
config)
|
||||
end">
|
||||
<div class="w-full mt-2 aspect-video">
|
||||
<div class="hidden"
|
||||
hx-get="{{ url_for('get_exercise_progress_for_user', person_id=p['PersonId'], exercise_id=e['ExerciseId'], min_date=min_date, max_date=max_date) }}"
|
||||
hx-trigger="load" hx-target="this" hx-swap="outerHTML">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
|
||||
Reference in New Issue
Block a user