diff --git a/app/javascript/controllers/bubble_controller.js b/app/javascript/controllers/bubble_controller.js index 4ccc9056b..66fd469cf 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", "entropyTop", "entropyCenter", "entropyBottom", "stalled", "stalledTop", "stalledCenter", "stalledBottom" ] + static targets = [ "entropy", "stalled", "top", "center", "bottom" ] static values = { entropy: Object, stalled: Object } #timer @@ -39,21 +39,16 @@ export default class extends Controller { #showEntropy() { this.#render({ - target: "entropy", top: this.#entropyCleanupInDays < 1 ? this.entropyValue.action : `${this.entropyValue.action} in`, center: this.#entropyCleanupInDays < 1 ? "!" : this.#entropyCleanupInDays, bottom: this.#entropyCleanupInDays < 1 ? "Today" : (this.#entropyCleanupInDays === 1 ? "day" : "days"), }) } - #render({ target, top, center, 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) - this.stalledTarget.toggleAttribute("hidden", entropyTarget) + #render({ top, center, bottom }) { + this.topTarget.innerHTML = top + this.centerTarget.innerHTML = center + this.bottomTarget.innerHTML = bottom this.#show() } @@ -64,7 +59,6 @@ export default class extends Controller { #showStalled() { this.#render({ - target: "stalled", top: "Stalled for", center: signedDifferenceInDays(new Date(this.stalledValue.lastActivitySpikeAt), new Date()), bottom: "days" diff --git a/app/views/cards/display/preview/_bubble.html.erb b/app/views/cards/display/preview/_bubble.html.erb index 2e5c96add..2b0de0fff 100644 --- a/app/views/cards/display/preview/_bubble.html.erb +++ b/app/views/cards/display/preview/_bubble.html.erb @@ -6,39 +6,19 @@ bubble_stalled_value: stalled_bubble_options_for(card)&.to_json } do %> -
- - - - - - + + + + + + - + - - - - - - -
- -
- - - - - - - - - - - - - - - -
+ + + + + + <% end %>