Pull out .#isBoosted() in rollup-controller

This commit is contained in:
Jose Farias
2024-10-24 17:53:36 -06:00
parent 652ec68e9c
commit b16d2ed2d8
@@ -8,7 +8,7 @@ export default class extends Controller {
}
#summarizeBoosts() {
if (this.hasBoostEventTarget) {
if (this.#isBoosted) {
const el = document.createElement("span")
el.dataset.turboTemporary = ""
el.textContent = this.#boostSumaries.toSentence()
@@ -16,6 +16,10 @@ export default class extends Controller {
}
}
get #isBoosted() {
return this.hasBoostEventTarget
}
get #boostSumaries() {
return Object.entries(this.#boostsByCreator).map(([_creatorId, boostEvents]) => {
return `${boostEvents[0].dataset.creatorName} +${boostEvents.length}`