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:
Peter Stockings
2023-12-09 14:54:44 +11:00
parent e3435df8b5
commit 69e502ca01
2 changed files with 6 additions and 33 deletions

View File

@@ -6,7 +6,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Workout Tracker</title> <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 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"> <link type="text/css" rel="stylesheet" href="/static/css/tail.select.min.css">
<script src="/static/js/tail.select.min.js"></script> <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/hyperscript.min.js" defer></script>
<script src="/static/js/sweetalert2@11.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> </head>
<body> <body>

View File

@@ -134,17 +134,14 @@
<div class="overflow-x-auto rounded-lg"> <div class="overflow-x-auto rounded-lg">
<div class="align-middle inline-block min-w-full"> <div class="align-middle inline-block min-w-full">
<div class="shadow overflow-hidden sm:rounded-lg"> <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 %} {% if e['RepMaxes']|length > 1 %}
<div class="w-full mt-2 aspect-video" _="init js(me) <div class="w-full mt-2 aspect-video">
Plotly.newPlot(me, [{ <div class="hidden"
x: {{ e['EstimatedOneRepMaxProgressions']['StartDates'] | replace_double_quote_strings_with_single_quote | safe }}, 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) }}"
y: {{ e['EstimatedOneRepMaxProgressions']['Estimated1RMs'] | replace_double_quote_strings_with_single_quote | safe }}, hx-trigger="load" hx-target="this" hx-swap="outerHTML">
text: {{ e['EstimatedOneRepMaxProgressions']['TopSets'] | replace_double_quote_strings_with_single_quote | safe }}, </div>
name: '{{ p['PersonName'] }} - {{ e['ExerciseName'] }}' , hovertemplate }], layout,
config)
end">
</div> </div>
{% endif %} {% endif %}
<table class="min-w-full divide-y divide-gray-200"> <table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50"> <thead class="bg-gray-50">