Files
fizzy/app/helpers/bubbles_helper.rb
T
2025-02-11 14:34:39 +00:00

27 lines
582 B
Ruby

module BubblesHelper
BUBBLE_ROTATION = %w[ 75 60 45 35 25 5 ]
def bubble_title(bubble)
bubble.title.presence || "Untitled"
end
def bubble_rotation(bubble)
value = BUBBLE_ROTATION[Zlib.crc32(bubble.to_param) % BUBBLE_ROTATION.size]
"--bubble-rotate: #{value}deg;"
end
def bubble_size(bubble)
rank =
case bubble.activity_score
when 0..5 then "one"
when 6..10 then "two"
when 11..25 then "three"
when 26..50 then "four"
else "five"
end
"--bubble-size: var(--bubble-size-#{rank});"
end
end