Namespace bubble-related targets

This commit is contained in:
Jorge Manrubia
2025-06-05 10:32:14 +02:00
parent 2cbd451944
commit 22ed605884
2 changed files with 23 additions and 17 deletions
@@ -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 = [ "top", "days", "bottom" ]
static targets = [ "bubbleTop", "bubbleDays", "bubbleBottom" ]
static values = { entropy: Object }
#timer
@@ -26,9 +26,9 @@ export default class extends Controller {
return
}
this.topTarget.innerHTML = closesInDays < 1 ? this.entropyValue.action : `${this.entropyValue.action} in`
this.daysTarget.innerHTML = closesInDays < 1 ? "!" : closesInDays
this.bottomTarget.innerHTML = closesInDays < 1 ? "Today" : (closesInDays === 1 ? "day" : "days")
this.bubbleTopTarget.innerHTML = closesInDays < 1 ? this.entropyValue.action : `${this.entropyValue.action} in`
this.bubbleDaysTarget.innerHTML = closesInDays < 1 ? "!" : closesInDays
this.bubbleBottomTarget.innerHTML = closesInDays < 1 ? "Today" : (closesInDays === 1 ? "day" : "days")
this.#show()
}