mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
Full-width list/show pages and trim the admin table
List and show pages now use a wide container (max-w-7xl) while the form and play pages keep the narrow column. The admin table drops Fen, Message, Notes, Attempted and Solved — all already shown on the show page — so it fits without right-overflow. Closes #16
This commit is contained in:
@@ -31,12 +31,16 @@ defmodule ChesstrainerWeb.Layouts do
|
||||
default: nil,
|
||||
doc: "the current [scope](https://phoenix.hexdocs.pm/scopes.html)"
|
||||
|
||||
attr :wide, :boolean,
|
||||
default: false,
|
||||
doc: "use a wide container instead of the default narrow column"
|
||||
|
||||
slot :inner_block, required: true
|
||||
|
||||
def app(assigns) do
|
||||
~H"""
|
||||
<main class="px-4 py-20 sm:px-6 lg:px-8">
|
||||
<div class="mx-auto max-w-2xl space-y-4">
|
||||
<div class={["mx-auto space-y-4", if(@wide, do: "max-w-7xl", else: "max-w-2xl")]}>
|
||||
{render_slot(@inner_block)}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -8,7 +8,7 @@ defmodule ChesstrainerWeb.EndgameLive.Index do
|
||||
@impl true
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<Layouts.app flash={@flash}>
|
||||
<Layouts.app flash={@flash} wide>
|
||||
<.header>
|
||||
Listing Endgames
|
||||
<:actions>
|
||||
@@ -29,39 +29,22 @@ defmodule ChesstrainerWeb.EndgameLive.Index do
|
||||
<.grouped_list :if={@groups != []} groups={@groups}>
|
||||
<:header>
|
||||
<tr>
|
||||
<th>Fen</th>
|
||||
<th>Color</th>
|
||||
<th>Key</th>
|
||||
<th>Rating</th>
|
||||
<th>Message</th>
|
||||
<th>Notes</th>
|
||||
<th>Color</th>
|
||||
<th>Result</th>
|
||||
<th>Themes</th>
|
||||
<th>Attempted</th>
|
||||
<th>Solved</th>
|
||||
<th>Rating</th>
|
||||
<th><span class="sr-only">Actions</span></th>
|
||||
</tr>
|
||||
</:header>
|
||||
|
||||
<:row :let={endgame}>
|
||||
<tr id={"endgame-" <> endgame.id}>
|
||||
<td phx-click={JS.navigate(~p"/admin/endgames/#{endgame}")} class="hover:cursor-pointer">
|
||||
{endgame.fen}
|
||||
</td>
|
||||
<td phx-click={JS.navigate(~p"/admin/endgames/#{endgame}")} class="hover:cursor-pointer">
|
||||
{endgame.color}
|
||||
</td>
|
||||
<td phx-click={JS.navigate(~p"/admin/endgames/#{endgame}")} class="hover:cursor-pointer">
|
||||
{endgame.key}
|
||||
</td>
|
||||
<td phx-click={JS.navigate(~p"/admin/endgames/#{endgame}")} class="hover:cursor-pointer">
|
||||
{endgame.rating}
|
||||
</td>
|
||||
<td phx-click={JS.navigate(~p"/admin/endgames/#{endgame}")} class="hover:cursor-pointer">
|
||||
{endgame.message}
|
||||
</td>
|
||||
<td phx-click={JS.navigate(~p"/admin/endgames/#{endgame}")} class="hover:cursor-pointer">
|
||||
{endgame.notes}
|
||||
{endgame.color}
|
||||
</td>
|
||||
<td phx-click={JS.navigate(~p"/admin/endgames/#{endgame}")} class="hover:cursor-pointer">
|
||||
{endgame.result}
|
||||
@@ -75,10 +58,7 @@ defmodule ChesstrainerWeb.EndgameLive.Index do
|
||||
<span :if={endgame.themes == []} class="text-base-content/50">None</span>
|
||||
</td>
|
||||
<td phx-click={JS.navigate(~p"/admin/endgames/#{endgame}")} class="hover:cursor-pointer">
|
||||
{endgame.times_attempted}
|
||||
</td>
|
||||
<td phx-click={JS.navigate(~p"/admin/endgames/#{endgame}")} class="hover:cursor-pointer">
|
||||
{endgame.times_solved}
|
||||
{endgame.rating}
|
||||
</td>
|
||||
<td class="w-0 font-semibold">
|
||||
<div class="flex gap-4">
|
||||
|
||||
@@ -6,7 +6,7 @@ defmodule ChesstrainerWeb.EndgameLive.PlayerIndex do
|
||||
@impl true
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<Layouts.app flash={@flash}>
|
||||
<Layouts.app flash={@flash} wide>
|
||||
<.header>
|
||||
Endgames
|
||||
<:subtitle>Pick an endgame to play.</:subtitle>
|
||||
|
||||
@@ -25,7 +25,7 @@ defmodule ChesstrainerWeb.EndgameLive.Show do
|
||||
|> assign(:game_type, :endgame)
|
||||
|
||||
~H"""
|
||||
<Layouts.app flash={@flash}>
|
||||
<Layouts.app flash={@flash} wide>
|
||||
<.header>
|
||||
Endgame {@endgame.id}
|
||||
<:subtitle>This is a endgame record from your database.</:subtitle>
|
||||
|
||||
Reference in New Issue
Block a user