<%= notice %>

<% content_for :title, "Games" %> <% content_for :top_content do %>
<%= image_tag "header-logo.png", width: 768, alt: "DipFront Logo" %>
<% end %>

Games

<%= link_to "New game", new_game_path, class: "inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" %>
<% if current_user && @my_games.any? %>

参加中のゲーム

<% @my_games.each do |game| %>

<%= game.title %>

<% if game.status == 'finished' %>

状態: 履歴モード

<% else %>

状態: <%= game.status %>

<% end %> <% if game.turns.present? %>

時期: <%= parse_phase(game.turns.sort_by(&:number).last&.phase) %>

<% end %> <% participant = game.participants.find_by(user: current_user) %> <% if participant %>

国: <%= participant.power || '未選択' %>

命令:

<% end %>
<%= link_to game, class: "inline-flex items-center text-sm font-bold text-green-900 hover:text-[#c5a059] transition-colors" do %> プレイする <% end %>
<% end %>
<% end %> <% if @recruiting_games.any? %>

募集中のゲーム

<% @recruiting_games.each do |game| %>

<%= game.title %>

参加者: <%= game.participants.count %> / <%= game.participants_count %>

<% if game.password_protected? %>

パスワード保護

<% else %>

公開ゲーム

<% end %>
<%= link_to game, class: "inline-flex items-center text-sm font-bold text-green-900 hover:text-[#c5a059] transition-colors" do %> 詳細を見る <% end %>
<% end %>
<% end %>

すべてのゲーム

<% @games.each do |game| %>

<%= game.title %>

<% if game.status == 'finished' %>

履歴モード

<% else %>

<%= game.status %>

<% end %> <% if game.turns.present? %>

時期: <%= parse_phase(game.turns.sort_by(&:number).last&.phase) %>

<% end %>

参加人数: <%= game.participants.size %> / <%= game.participants_count %>

<%= link_to game, class: "text-sm font-medium text-gray-600 hover:text-gray-900" do %> Show <% end %>
<% end %>