prelaunch env var prevents the site from being operational

This commit is contained in:
2026-11-09 20:49:25 +01:00
parent 9d3dd426db
commit 79782dc778
23 changed files with 510 additions and 98 deletions
@@ -11,22 +11,27 @@ defmodule ChesstrainerWeb.PageController do
"Learn to see the winning move and make the endgame your strongest phase."
def home(conn, _params) do
endgames = Endgames.curated_endgames()
if prelaunch?() do
render_coming_soon(conn)
else
endgames = Endgames.curated_endgames()
conn
|> assign(:js_entry, ~p"/assets/js/marketing.js")
|> assign(:page_title, Branding.home_title())
|> assign(:title_suffix, "")
|> assign(:meta_description, @description)
|> assign(:canonical_url, current_url(conn))
|> render(:home,
endgames: endgames,
active_endgame: DailyPuzzles.today(),
puzzle_count: Endgames.count_endgames(),
user_count: Attempts.count_users_with_attempts(),
logged_in_count: Accounts.count_logged_in_users(),
today: Date.utc_today()
)
conn
|> assign(:js_entry, ~p"/assets/js/marketing.js")
|> assign(:page_title, Branding.home_title())
|> assign(:title_suffix, "")
|> assign(:meta_description, @description)
|> assign(:canonical_url, current_url(conn))
|> assign(:mailing_list_enabled, mailing_list_enabled?())
|> render(:home,
endgames: endgames,
active_endgame: DailyPuzzles.today(),
puzzle_count: Endgames.count_endgames(),
user_count: Attempts.count_users_with_attempts(),
logged_in_count: Accounts.count_logged_in_users(),
today: Date.utc_today()
)
end
end
def privacy(conn, _params) do
@@ -61,4 +66,22 @@ defmodule ChesstrainerWeb.PageController do
|> assign(:noindex, true)
|> render(:not_found)
end
defp render_coming_soon(conn) do
conn
|> assign(:js_entry, ~p"/assets/js/marketing.js")
|> assign(:page_title, Branding.home_title())
|> assign(:title_suffix, "")
|> assign(:meta_description, @description)
|> assign(:canonical_url, current_url(conn))
|> assign(:noindex, true)
|> assign(:mailing_list_enabled, mailing_list_enabled?())
|> render(:coming_soon)
end
defp prelaunch?, do: Application.get_env(:chesstrainer, :prelaunch, false)
defp mailing_list_enabled? do
Application.get_env(:chesstrainer, :mailing_list_enabled, true)
end
end