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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
<svg viewBox="0 0 200 100">
|
||||
<path id="top-half" fill="transparent" d="M 20,100 A 80,80 0 0,1 180,100"/>
|
||||
<text text-anchor="middle" fill="currentColor">
|
||||
<textPath href="#top-half" startOffset="50%" dominant-baseline="middle" data-bubble-target="top"></textPath>
|
||||
<textPath href="#top-half" startOffset="50%" dominant-baseline="middle" data-bubble-target="entropyTop"></textPath>
|
||||
</text>
|
||||
</svg>
|
||||
|
||||
<span class="bubble__number" data-bubble-target="center"></span>
|
||||
<span class="bubble__number" data-bubble-target="entropyCenter"></span>
|
||||
|
||||
<svg viewBox="0 0 200 100">
|
||||
<path id="bottom-half" d="M 20,0 A 80,80 0 0,0 180,0" fill="transparent"/>
|
||||
<text text-anchor="middle" fill="currentColor">
|
||||
<textPath href="#bottom-half" startOffset="50%" dominant-baseline="middle" data-bubble-target="bottom"></textPath>
|
||||
<textPath href="#bottom-half" startOffset="50%" dominant-baseline="middle" data-bubble-target="entropyBottom"></textPath>
|
||||
</text>
|
||||
</svg>
|
||||
</div>
|
||||
@@ -28,16 +28,16 @@
|
||||
<svg viewBox="0 0 200 100">
|
||||
<path id="top-half" fill="transparent" d="M 20,100 A 80,80 0 0,1 180,100"/>
|
||||
<text text-anchor="middle" fill="currentColor">
|
||||
<textPath href="#top-half" startOffset="50%" dominant-baseline="middle" data-bubble-target="top"></textPath>
|
||||
<textPath href="#top-half" startOffset="50%" dominant-baseline="middle" data-bubble-target="stalledTop"></textPath>
|
||||
</text>
|
||||
</svg>
|
||||
|
||||
<span class="bubble__number" data-bubble-target="center"></span>
|
||||
<span class="bubble__number" data-bubble-target="stalledCenter"></span>
|
||||
|
||||
<svg viewBox="0 0 200 100">
|
||||
<path id="bottom-half" d="M 20,0 A 80,80 0 0,0 180,0" fill="transparent"/>
|
||||
<text text-anchor="middle" fill="currentColor">
|
||||
<textPath href="#bottom-half" startOffset="50%" dominant-baseline="middle" data-bubble-target="bottom"></textPath>
|
||||
<textPath href="#bottom-half" startOffset="50%" dominant-baseline="middle" data-bubble-target="stalledBottom"></textPath>
|
||||
</text>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user