mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
* commented out lesson and learning strip until lessons are established * reword the hero section * change layout and working on puzzle section - remove top div as it was redundant * amend flash message on replay * switch cancel session for return home * remove system theme toggle since this is the default, leaving only light and dark toggles * add keyboard and screen reader support for play (#72) First draft covering the accessibility work in #72:\n\n- labelled SAN/UCI move input, validated against the tablebase and applied\n by the board hook, plus an accessible promotion picker\n- live-region announcements for moves, checks, checkmates and solve/fail,\n and a hidden text summary of the position\n- accessible labels, focus ring, skip link, keyboard-friendly review table\n and non-colour grade cues\n- WCAG AA text contrast roles and a responsive play surface\n- regression tests for move entry, announcements and link-style CTAs
This commit is contained in:
@@ -82,6 +82,7 @@ defmodule ChesstrainerWeb.EndgameLive.Train do
|
||||
<PlayComponents.play_surface
|
||||
session={true}
|
||||
endgame={@endgame}
|
||||
fen={@fen}
|
||||
status={@status}
|
||||
blocked_reason={@blocked_reason}
|
||||
best_move={@best_move}
|
||||
@@ -94,6 +95,10 @@ defmodule ChesstrainerWeb.EndgameLive.Train do
|
||||
awaiting_reply={@awaiting_reply}
|
||||
last_grade={@last_grade}
|
||||
awaiting_best_line={@awaiting_best_line}
|
||||
move_input={@move_input}
|
||||
move_input_error={@move_input_error}
|
||||
last_check={@last_check}
|
||||
last_checkmate={@last_checkmate}
|
||||
/>
|
||||
<% else %>
|
||||
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4">
|
||||
@@ -164,7 +169,7 @@ defmodule ChesstrainerWeb.EndgameLive.Train do
|
||||
<% end %>
|
||||
</div>
|
||||
<.button navigate={~p"/"} variant="ghost" class="mt-2 w-full justify-center">
|
||||
Cancel
|
||||
<.icon name="hero-arrow-left" />Return Home
|
||||
</.button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -255,6 +260,13 @@ defmodule ChesstrainerWeb.EndgameLive.Train do
|
||||
{:noreply, account_completion(socket)}
|
||||
end
|
||||
|
||||
def handle_event("submit_move", params, socket), do: PlayCore.submit_move(socket, params)
|
||||
|
||||
def handle_event("move_input", params, socket), do: PlayCore.move_input_changed(socket, params)
|
||||
|
||||
def handle_event("move_input_error", params, socket),
|
||||
do: PlayCore.move_input_error(socket, params)
|
||||
|
||||
def handle_event("opponent_reply_applied", params, socket) do
|
||||
{:noreply, socket} = PlayCore.opponent_reply_applied(socket, params)
|
||||
{:noreply, account_completion(socket)}
|
||||
@@ -374,6 +386,6 @@ defmodule ChesstrainerWeb.EndgameLive.Train do
|
||||
end
|
||||
|
||||
defp gain_class(delta) when is_number(delta) and delta > 0, do: "text-success-text"
|
||||
defp gain_class(delta) when is_number(delta) and delta < 0, do: "text-error"
|
||||
defp gain_class(delta) when is_number(delta) and delta < 0, do: "text-error-text"
|
||||
defp gain_class(_delta), do: "text-muted"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user