mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Add public codes for player URLs and admin endgame search
Player-facing endgame links now use a 10-character Crockford base32 public code instead of the database UUID; admin routes keep the UUID. Existing rows are backfilled by migration, and the admin Show page displays and copies the code. The admin endgame index gains its own search box: exact database id, exact public code, or a FEN / FEN fragment. A single match opens the endgame; multiple matches list below; nothing found says so. Closes #44 Closes #45
This commit is contained in:
@@ -32,14 +32,23 @@ defmodule ChesstrainerWeb.EndgameLive.PlayerIndex do
|
||||
</:header>
|
||||
|
||||
<:row :let={endgame}>
|
||||
<tr id={"endgame-" <> endgame.id}>
|
||||
<td phx-click={JS.navigate(~p"/endgames/#{endgame}/play")} class="hover:cursor-pointer">
|
||||
<tr id={"endgame-" <> endgame.public_code}>
|
||||
<td
|
||||
phx-click={JS.navigate(~p"/endgames/#{endgame.public_code}/play")}
|
||||
class="hover:cursor-pointer"
|
||||
>
|
||||
{endgame.color}
|
||||
</td>
|
||||
<td phx-click={JS.navigate(~p"/endgames/#{endgame}/play")} class="hover:cursor-pointer">
|
||||
<td
|
||||
phx-click={JS.navigate(~p"/endgames/#{endgame.public_code}/play")}
|
||||
class="hover:cursor-pointer"
|
||||
>
|
||||
{endgame.result}
|
||||
</td>
|
||||
<td phx-click={JS.navigate(~p"/endgames/#{endgame}/play")} class="hover:cursor-pointer">
|
||||
<td
|
||||
phx-click={JS.navigate(~p"/endgames/#{endgame.public_code}/play")}
|
||||
class="hover:cursor-pointer"
|
||||
>
|
||||
{round(endgame.rating)}
|
||||
</td>
|
||||
<td>
|
||||
@@ -51,7 +60,7 @@ defmodule ChesstrainerWeb.EndgameLive.PlayerIndex do
|
||||
<span :if={endgame.themes == []} class="text-base-content/50">None</span>
|
||||
</td>
|
||||
<td class="w-0 font-semibold">
|
||||
<.link navigate={~p"/endgames/#{endgame}/play"}>Play</.link>
|
||||
<.link navigate={~p"/endgames/#{endgame.public_code}/play"}>Play</.link>
|
||||
</td>
|
||||
</tr>
|
||||
</:row>
|
||||
|
||||
Reference in New Issue
Block a user