<%= render "games/header", game: @game, display_turn: @game.latest_turn, current_participant: @current_participant, hide_controls: true %>
<%= link_to game_boards_path(@game), class: "mr-4 text-gray-500 hover:text-gray-700" do %> <% end %>

<% if @board.global? %> Global Board <% else %> Negotiation Board <% end %>

<% if @board.is_public? %> 公開中 <% end %> <% if @board.history_mode? %> 履歴モード <% end %>
メンバー: <% @active_members.each do |m| %> <%= m.power %> <% end %>
<% if @board.negotiation? && @board.member?(@current_participant) && !@board.history_mode? %> <%= button_to toggle_public_game_board_path(@game, @board), method: :patch, class: "inline-flex items-center px-3 py-1.5 border border-gray-300 shadow-sm text-sm font-medium rounded text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" do %> <% if @board.is_public? %> 非公開にする <% else %> 公開する <% end %> <% end %> <% end %> <% if @board.negotiation? && @board.member?(@current_participant) && !@board.history_mode? %> <%= button_to leave_game_board_board_memberships_path(@game, @board), method: :delete, data: { turbo_confirm: "本当に退出しますか?退出後はこの掲示板に投稿できなくなります。" }, class: "inline-flex items-center px-3 py-1.5 border border-transparent shadow-sm text-sm font-medium rounded text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500" do %> 退出 <% end %> <% end %>
<% if @board.member?(@current_participant) && !@board.history_mode? %>
<%= form_with model: [@game, @board, @new_post], local: true, class: "flex items-end space-x-2" do |f| %>
<%= f.text_area :body, rows: 2, placeholder: "メッセージを入力...", class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md", required: true %>
<% end %>
<% elsif @board.history_mode? %>
履歴モードのため投稿できません
<% else %>
この掲示板には参加していません
<% end %>
<% if @posts.empty? %>

まだ投稿がありません。最初のメッセージを投稿しましょう。

<% else %> <% @posts.each do |post| %> <%= render partial: "post", locals: { post: post, current_participant: @current_participant } %> <% end %> <% end %>
<% if @board.negotiation? %>
条約・提案
<% @board.board_proposals.order(created_at: :desc).each do |proposal| %>
<%= proposal.proposer.power %> <% if proposal.phase %> <%= proposal.phase %> <% end %>
<%= l proposal.created_at, format: :short %>

<%= proposal.body %>

<%= proposal.status.upcase %> <% if proposal.pending? && @board.member?(@current_participant) && !@board.history_mode? %>
<%= button_to "承認", game_board_board_proposal_path(@game, @board, proposal, board_proposal: { status: 'accepted' }), method: :patch, class: "text-xs bg-green-100 hover:bg-green-200 text-green-800 px-2 py-1 rounded" %> <%= button_to "拒否", game_board_board_proposal_path(@game, @board, proposal, board_proposal: { status: 'rejected' }), method: :patch, class: "text-xs bg-red-100 hover:bg-red-200 text-red-800 px-2 py-1 rounded" %>
<% end %>
<% end %> <% if @board.member?(@current_participant) && !@board.history_mode? %>
<% end %>
<% end %> <% if @board.negotiation? && @board.member?(@current_participant) && !@board.history_mode? %>
メンバー追加
<% if @candidates.present? %> <%= form_with url: game_board_board_memberships_path(@game, @board), local: true do |f| %>
<%= f.collection_select :participant_id, @candidates, :id, :power, { prompt: "国を選択" }, { class: "block w-full text-xs border-gray-300 rounded" } %> <%= f.submit "招待", class: "bg-indigo-600 text-white text-xs px-3 py-1 rounded hover:bg-indigo-700" %>
<% end %> <% else %>

招待可能なプレイヤーがいません

<% end %>
<% end %>
参加メンバー
    <% @board.board_memberships.includes(:participant).each do |membership| %>
  • <%= membership.participant.power %> <% if membership.participant.user == current_user %> (YOU) <% end %>
    <% if membership.left_at %> 退出済 <% end %>
  • <% end %>