1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00
chess/lib/chess_web/templates/game/game_info.html.leex

42 lines
1.5 KiB
Plaintext

<div class="game-info">
<p>
Playing <%= opponent(@game, @user.id).name %>
<%= if Map.has_key?(@presence, opponent(@game, @user.id).id) do %>
<img class="game-info__opponent-status" src="/images/eye-open.svg" alt="online">
<% else %>
<img class="game-info__opponent-status" src="/images/eye-closed.svg" alt="offline">
<% end %>
</p>
</div>
<div class="move-list">
<table class="table table--condensed">
<thead>
<tr>
<th class="move-list__line-number"><span class="visually-hidden">Move no.</span></th>
<th class="move-list__header--white">White</th>
<th class="move-list__header--black">Black</th>
</tr>
</thead>
<tbody>
<%= for {move_pair, i} <- @game.moves |>
Enum.chunk_every(2) |> Enum.with_index do %>
<tr>
<th scope="row" class="move-list__line-number"><%= i + 1 %>.</th>
<%= case move_pair do %>
<% [white_move, black_move] -> %>
<td class="move-list__move move-list__move--<%=
white_move.piece["colour"] %>"><%= move_text(white_move) %></td>
<td class="move-list__move move-list__move--<%=
black_move.piece["colour"] %>"><%= move_text(black_move) %></td>
<% [white_move] -> %>
<td class="move-list__move move-list__move--<%=
white_move.piece["colour"] %>"><%= move_text(white_move) %></td>
<td></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>