diff --git a/app/assets/stylesheets/bubbles.css b/app/assets/stylesheets/bubbles.css index e6ab5b42c..c5129a6b9 100644 --- a/app/assets/stylesheets/bubbles.css +++ b/app/assets/stylesheets/bubbles.css @@ -1,5 +1,9 @@ :root { - --bubble-size: 30vw; + --bubble-size-one: 14cqi; + --bubble-size-two: 16cqi; + --bubble-size-three: 18cqi; + --bubble-size-four: 20cqi; + --bubble-size-five: 22cqi; --bubble-shift: 10deg; } diff --git a/app/assets/stylesheets/projects.css b/app/assets/stylesheets/projects.css index c78a36c9a..3499193d2 100644 --- a/app/assets/stylesheets/projects.css +++ b/app/assets/stylesheets/projects.css @@ -10,7 +10,6 @@ .project__windshield { --border-radius: 1.5em; - --bubble-size: 17cqi; --column-gap: 1cqi; --row-gap: 1cqi; diff --git a/app/helpers/bubbles_helper.rb b/app/helpers/bubbles_helper.rb index b6f54058c..7b529d837 100644 --- a/app/helpers/bubbles_helper.rb +++ b/app/helpers/bubbles_helper.rb @@ -1,7 +1,5 @@ module BubblesHelper BUBBLE_ROTATION = %w[ 90 80 75 60 45 35 25 5 -45 -40 -75 ] - BUBBLE_SIZE = [ 14, 16, 18, 20, 22 ] - MIN_THRESHOLD = 7 def bubble_rotation(bubble) value = BUBBLE_ROTATION[Zlib.crc32(bubble.to_param) % BUBBLE_ROTATION.size] @@ -10,9 +8,15 @@ module BubblesHelper end def bubble_size(bubble) - total = MIN_THRESHOLD + bubble.boosts.size + bubble.comments.size - value = BUBBLE_SIZE.min_by { |size| (size - total).abs } + activity = bubble.boosts.size + bubble.comments.size + rank = case activity + 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: #{value}cqi;" + "--bubble-size: var(--bubble-size-#{rank});" end end diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 69d2b5f49..bff0ebb6f 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -19,7 +19,7 @@
  • <% project.bubbles.left_joins(:comments, :boosts).group(:id).order(Arel.sql("COUNT(comments.id) + COUNT(boosts.id) DESC")).limit(10).each do |bubble| %> -
    +