From f742749b0fe8830a3daeba10376a2a1464ebeade Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Fri, 6 Jun 2025 09:15:51 +0200 Subject: [PATCH] Tidy up controller and make sure the different targets are properly separated If not, it wouldn't show stalled if there were entropy bubbles in the page --- app/javascript/controllers/bubble_controller.js | 8 ++++---- app/views/cards/display/preview/_bubble.html.erb | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/javascript/controllers/bubble_controller.js b/app/javascript/controllers/bubble_controller.js index 21dee1a67..4ccc9056b 100644 --- a/app/javascript/controllers/bubble_controller.js +++ b/app/javascript/controllers/bubble_controller.js @@ -4,7 +4,7 @@ import { signedDifferenceInDays } from "helpers/date_helpers" const REFRESH_INTERVAL = 3_600_000 // 1 hour (in milliseconds) export default class extends Controller { - static targets = [ "entropy", "top", "center", "bottom", "stalled" ] + static targets = [ "entropy", "entropyTop", "entropyCenter", "entropyBottom", "stalled", "stalledTop", "stalledCenter", "stalledBottom" ] static values = { entropy: Object, stalled: Object } #timer @@ -47,9 +47,9 @@ export default class extends Controller { } #render({ target, top, center, bottom }) { - this.topTarget.innerHTML = top - this.centerTarget.innerHTML = center - this.bottomTarget.innerHTML = bottom + this[`${target}TopTarget`].innerHTML = top + this[`${target}CenterTarget`].innerHTML = center + this[`${target}BottomTarget`].innerHTML = bottom const entropyTarget = target === "entropy" this.entropyTarget.toggleAttribute("hidden", !entropyTarget) diff --git a/app/views/cards/display/preview/_bubble.html.erb b/app/views/cards/display/preview/_bubble.html.erb index 3cd81af88..2e5c96add 100644 --- a/app/views/cards/display/preview/_bubble.html.erb +++ b/app/views/cards/display/preview/_bubble.html.erb @@ -10,16 +10,16 @@ - + - + - + @@ -28,16 +28,16 @@ - + - + - +