show date, hide puzzle search for non premium

This commit is contained in:
2026-11-05 16:14:04 +01:00
parent 0453e97897
commit 8d1876b13b
6 changed files with 108 additions and 8 deletions
@@ -88,7 +88,8 @@ defmodule ChesstrainerWeb.LandingComponents do
turn: turn_label(endgame),
title: title(endgame),
themes: theme_names(endgame),
orientation: orientation(endgame)
orientation: orientation(endgame),
date: Calendar.strftime(assigns.date || Date.utc_today(), "%d %b %Y")
)
~H"""
@@ -101,6 +102,7 @@ defmodule ChesstrainerWeb.LandingComponents do
<strong>{@turn}</strong>
</span>
</div>
<div>{@date}</div>
</div>
<.board_grid fen={@fen} orientation={@orientation} />
+10 -3
View File
@@ -109,9 +109,14 @@ defmodule ChesstrainerWeb.Layouts do
end
defp nav_links(scope) do
marketing = [
%{label: "Puzzle Search", href: "/endgames"}
]
marketing =
if premium?(scope) do
[
%{label: "Puzzle Search", href: "/endgames"}
]
else
[]
end
admin =
if admin?(scope) do
@@ -142,6 +147,8 @@ defmodule ChesstrainerWeb.Layouts do
defp admin?(%{user: %{role: role}}), do: Role.admin?(role)
defp admin?(_scope), do: false
defp premium?(scope), do: match?(%{user: %{plan: :premium}}, scope)
# Signed-in users start a puzzle session; visitors browse the public list.
defp start_href(%{user: %{}}), do: ~p"/train"
defp start_href(_scope), do: ~p"/endgames"