berrypod/lib/berrypod_web/live/shop/home.ex
jamey 5b41f3fedf extract site_name and site_description from theme settings into standalone settings
site_name and site_description are shop identity, not theme concerns.
They now live in the Settings table as first-class settings with their
own assigns (@site_name, @site_description) piped through hooks and
plugs. The setup wizard writes site_name on account creation, and the
theme editor reads/writes via Settings.put_setting. Removed the
"configure your shop" checklist item since currency/country aren't
built yet. Also adds shop name field to setup wizard step 1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 14:52:31 +00:00

43 lines
894 B
Elixir

defmodule BerrypodWeb.Shop.Home do
use BerrypodWeb, :live_view
alias Berrypod.Pages
@impl true
def mount(_params, _session, socket) do
page = Pages.get_page("home")
extra = Pages.load_block_data(page.blocks, socket.assigns)
base = BerrypodWeb.Endpoint.url()
site_name = socket.assigns.site_name
org_ld =
Jason.encode!(
%{
"@context" => "https://schema.org",
"@type" => "Organization",
"name" => site_name,
"url" => base <> "/"
},
escape: :html_safe
)
socket =
socket
|> assign(:page_title, "Home")
|> assign(:og_url, base <> "/")
|> assign(:json_ld, org_ld)
|> assign(:page, page)
|> assign(extra)
{:ok, socket}
end
@impl true
def render(assigns) do
~H"""
<BerrypodWeb.PageRenderer.render_page {assigns} />
"""
end
end