From f92bfc59d4a98a64b52e84dbd401fd093d0ad470 Mon Sep 17 00:00:00 2001 From: trovster Date: Thu, 5 Oct 2023 18:17:25 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20trovster?= =?UTF-8?q?/fitness.trovster.com@cf18037c02ad5a81e856d5883c7eebad2a8f103a?= =?UTF-8?q?=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 8 ++++++++ js/FitnessCard.js | 1 + js/FitnessRing.js | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index f179928..217cca6 100644 --- a/index.html +++ b/index.html @@ -133,6 +133,7 @@

<fitness-card date="item.date" + replayable="true" steps="item.steps" distance="item.distance" flights="item.flights" move-total="item.move.total" move-goal="item.move.goal" exercise-total="item.exercise.total" exercise-goal="item.exercise.goal" diff --git a/js/FitnessCard.js b/js/FitnessCard.js index 5f1ba09..ae6ac93 100644 --- a/js/FitnessCard.js +++ b/js/FitnessCard.js @@ -348,6 +348,7 @@ export default class FitnessCard extends HTMLElement { { - if (wrapper.classList.contains('complete')) { + if (this.replayable() && wrapper.classList.contains('complete')) { wrapper.classList.add('reset'); wrapper.classList.remove('complete'); } @@ -67,6 +67,8 @@ export default class FitnessRing extends HTMLElement { this.observer.disconnect(); } + replayable =() => this.getAttribute('replayable') && this.getAttribute('replayable') === 'true'; + percentage = (total = 0, goal = 100, max = 100) => Math.min(Math.floor((total / goal) * 100), max);