diff --git a/app/helpers/cards_helper.rb b/app/helpers/cards_helper.rb index 08edb27d9..e34a51d3d 100644 --- a/app/helpers/cards_helper.rb +++ b/app/helpers/cards_helper.rb @@ -48,4 +48,12 @@ module CardsHelper title << "assigned to #{card.assignees.map(&:name).to_sentence}" if card.assignees.any? title.join(" ") end + + def card_entropy_action(card) + if card.doing? + "Falls Back" + elsif card.considering? + "Closes" + end + end end diff --git a/app/javascript/controllers/bubble_controller.js b/app/javascript/controllers/bubble_controller.js index 8ca4328d9..70a2c81e6 100644 --- a/app/javascript/controllers/bubble_controller.js +++ b/app/javascript/controllers/bubble_controller.js @@ -4,8 +4,8 @@ import { signedDifferenceInDays } from "helpers/date_helpers" const REFRESH_INTERVAL = 3_600_000 // 1 hour (in milliseconds) export default class extends Controller { - static targets = [ "closingTop", "consideringTop", "days", "bottom" ] - static values = { "closesAt": String, "reminderBefore": Number } + static targets = [ "top", "days", "bottom" ] + static values = { "closesAt": String, "reminderBefore": Number, "entropyAction": String } #timer @@ -26,12 +26,7 @@ export default class extends Controller { return } - if (this.hasClosingTopTarget) { - this.closingTopTarget.innerHTML = closesInDays < 1 ? "Closes" : "Closes in" - } - if (this.hasConsideringTopTarget) { - this.consideringTopTarget.innerHTML = closesInDays < 1 ? "Falls Back" : "Falls Back in" - } + this.topTarget.innerHTML = closesInDays < 1 ? this.entropyActionValue : `${this.entropyActionValue} in` this.daysTarget.innerHTML = closesInDays < 1 ? "!" : closesInDays this.bottomTarget.innerHTML = closesInDays < 1 ? "Today" : (closesInDays === 1 ? "day" : "days") diff --git a/app/views/cards/display/preview/_bubble.html.erb b/app/views/cards/display/preview/_bubble.html.erb index d34bd8bff..13faa9920 100644 --- a/app/views/cards/display/preview/_bubble.html.erb +++ b/app/views/cards/display/preview/_bubble.html.erb @@ -1,11 +1,12 @@