My Collections

<%= link_to "New Collection", new_collection_path, class: "px-4 py-2 bg-indigo-600 text-white rounded hover:bg-indigo-700" %>
<% if @root_collections.any? %>
<% @root_collections.each do |collection| %>

<%= link_to collection.name, collection, class: "text-indigo-600 hover:text-indigo-800" %>

<% if collection.description.present? %>

<%= truncate(collection.description, length: 100) %>

<% end %>
<%= pluralize(collection.game_count, "game") %>
<% if collection.subcollections.any? %>

Subcollections:

<% collection.subcollections.each do |subcollection| %>
<%= link_to subcollection.name, subcollection, class: "text-indigo-600 hover:text-indigo-800" %> (<%= pluralize(subcollection.game_count, "game") %>)
<% end %>
<% end %>
<%= link_to "View", collection, class: "text-indigo-600 hover:text-indigo-800 text-sm" %> <%= link_to "Edit", edit_collection_path(collection), class: "text-blue-600 hover:text-blue-800 text-sm" %> <%= button_to "Delete", collection, method: :delete, data: { turbo_confirm: "Are you sure you want to delete the collection '#{collection.name}'? Games in this collection will not be deleted." }, class: "text-red-600 hover:text-red-800 text-sm" %>
<% end %>
<% else %>

You haven't created any collections yet.

<%= link_to "Create Your First Collection", new_collection_path, class: "text-indigo-600 hover:text-indigo-800" %>
<% end %>