Skip to content

Commit

Permalink
Merge pull request #279 from kortirso/issue_277
Browse files Browse the repository at this point in the history
IS-277 modified icons for fantasy teams in navigation
  • Loading branch information
kortirso authored Mar 9, 2024
2 parents 5ea8246 + 0b8930e commit 261908d
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Modified
- user navigation
- icons for fantasy teams in navigation

## [1.2.1] - 2024-02-29
### Added
Expand Down
Binary file added app/assets/images/leagues/no_text_bundesliga.webp
Binary file not shown.
Binary file not shown.
Binary file added app/assets/images/leagues/no_text_epl.webp
Binary file not shown.
Binary file added app/assets/images/leagues/no_text_la_liga.webp
Binary file not shown.
Binary file added app/assets/images/leagues/no_text_nba.webp
Binary file not shown.
Binary file added app/assets/images/leagues/no_text_rpl.webp
Binary file not shown.
Binary file added app/assets/images/leagues/no_text_seria_a.webp
Binary file not shown.
5 changes: 4 additions & 1 deletion app/controllers/oracul_places_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ def show; end
private

def find_leagues
@leagues = League.hashable_pluck(:id, :background_url, :sport_kind)
@leagues =
Rails.cache.fetch('oracul_places_show_leagues_v1', expires_in: 24.hours, race_condition_ttl: 10.seconds) do
League.hashable_pluck(:id, :background_url, :sport_kind)
end
end

def find_oracul_places
Expand Down
3 changes: 2 additions & 1 deletion app/views/components/page_wrappers/page_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<% global_user_fantasy_teams.each do |user_fantasy_team| %>
<div>
<%= link_to fantasy_team_points_path(user_fantasy_team[:uuid]), class: 'flex items-center px-4 py-2' do %>
<%= image_tag "icons/#{user_fantasy_team[:leagues_sport_kind]}.svg", class: 'w-8 h-8 mr-2' %>
<%= image_tag background_urls.dig('Season', user_fantasy_team[:season_id]).split('/').join('/no_text_'), class: 'w-8 h-8 mr-2 bg-white rounded-full' %>
<span class="text-xl text-white"><%= user_fantasy_team[:name] %></span>
<% end %>
<% if user_fantasy_team[:uuid] == @fantasy_team&.uuid %>
Expand All @@ -99,6 +99,7 @@
<% global_user_oraculs.each do |global_user_oracul| %>
<div>
<%= link_to oracul_path(global_user_oracul[:uuid]), class: 'flex items-center px-4 py-2' do %>
<%= image_tag background_urls.dig(global_user_oracul[:placeable_type], global_user_oracul[:placeable_id]).split('/').join('/no_text_'), class: 'w-8 h-8 mr-2 bg-white rounded-full' %>
<span class="text-xl text-white"><%= global_user_oracul[:name] %></span>
<% end %>
</div>
Expand Down
18 changes: 14 additions & 4 deletions app/views/components/page_wrappers/page_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def initialize(fantasy_team: nil, oracul: nil)
def global_user_fantasy_teams
@global_user_fantasy_teams ||=
Current.user
.fantasy_teams.completed
.joins(season: :league)
.hashable_pluck(:uuid, :name, 'leagues.sport_kind')
.fantasy_teams
.completed
.hashable_pluck(:uuid, :name, :season_id)
end

def global_user_oraculs
Expand All @@ -24,7 +24,17 @@ def global_user_oraculs
.oraculs
.joins(:oracul_place)
.where(oracul_places: { active: true })
.hashable_pluck(:uuid, :name)
.hashable_pluck(:uuid, :name, :placeable_id, :placeable_type)
end

private

def background_urls
@background_urls ||=
{
'Season' => Season.joins(:league).pluck(:id, 'leagues.background_url').to_h.symbolize_keys,
'Cup' => Cup.joins(:league).pluck(:id, 'leagues.background_url').to_h.symbolize_keys
}
end
end
end

0 comments on commit 261908d

Please sign in to comment.