@<%= @user.username %>

<% if @user.bio.present? %>

<%= @user.bio %>

<% end %>
<% if current_user && @user == current_user %> <%= link_to "Edit Profile", settings_path, class: "px-4 py-2 bg-indigo-600 text-white rounded hover:bg-indigo-700" %> <% end %>
Total Games
<%= @total_games %>
Physical
<%= @physical_games %>
Digital
<%= @digital_games %>
Completed
<%= @completed_games %>

Top Platforms

<% if @games_by_platform.any? %>
<% @games_by_platform.each do |platform_name, count| %>
<%= platform_name %>
<%= count %>
<% end %>
<% else %>

No games yet

<% end %>

Collections

<% if @public_collections.any? %>
<% @public_collections.each do |collection| %> <%= link_to collection, class: "block p-3 rounded hover:bg-gray-50 transition" do %>
<%= collection.name %>
<% if collection.description.present? %>
<%= collection.description %>
<% end %>
<%= collection.games.count %> games
<% end %> <% end %>
<% else %>

No collections yet

<% end %>

Recent Additions

<% if @recent_games.any? %>
<% @recent_games.each do |game| %>
<% if game.igdb_game&.cover_url.present? %> <%= image_tag game.igdb_game.cover_image_url("cover_big"), alt: game.title, class: "w-full h-40 object-cover rounded mb-2" %> <% else %>
No Cover
<% end %>

<%= game.title %>

<%= game.platform.name %>

<%= game.format.titleize %>
<% end %>
<% else %>

No games yet

<% end %>
<% if current_user.nil? %>

This is a public profile. <%= link_to "Create your own collection", signup_path, class: "text-indigo-600 hover:text-indigo-800" %>

<% end %>