diff --git a/app/javascript/controllers/card_size_controller.js b/app/javascript/controllers/card_size_controller.js deleted file mode 100644 index e688358da..000000000 --- a/app/javascript/controllers/card_size_controller.js +++ /dev/null @@ -1,43 +0,0 @@ -import { Controller } from "@hotwired/stimulus" - -const SIZES = [ "one", "two", "three", "four", "five" ] - -export default class extends Controller { - static targets = [ "card" ] - - connect() { - this.resize() - } - - resize() { - const [ min, max ] = this.#getScoreRange() - - this.cardTargets.forEach(card => { - const score = this.#currentCardScore(card) - const idx = Math.round((score - min) / (max - min) * (SIZES.length - 1)) - - card.style.setProperty("--card-size", `var(--card-size-${SIZES[idx]})`) - }) - } - - #getScoreRange() { - var min = 0, max = 1; - - this.cardTargets.forEach(card => { - const score = this.#currentCardScore(card) - - min = Math.min(min, score) - max = Math.max(max, score) - }) - - return [ min, max ] - } - - #currentCardScore(el) { - const score = el.dataset.activityScore - const scoreAt = el.dataset.activityScoreAt - const daysAgo = (Date.now() / 1000 - scoreAt) / (60 * 60 * 24) - - return score / (2**daysAgo) - } -} diff --git a/app/views/cards/index/engagement/_doing.html.erb b/app/views/cards/index/engagement/_doing.html.erb index e59c70700..216866e85 100644 --- a/app/views/cards/index/engagement/_doing.html.erb +++ b/app/views/cards/index/engagement/_doing.html.erb @@ -1,4 +1,4 @@ -
+
<% if workflow = filter.single_workflow %> <%= render "cards/index/workflow_filter", workflow: workflow, filter: filter %> <% else %>