Home, Content (about/delivery/privacy/terms), Contact, and ErrorHTML now render through the generic PageRenderer instead of hardcoded templates. Block wrapper divs enable CSS grid targeting. Featured products block supports layout/card_variant/columns settings for different page contexts. Contact page uses CSS grid on data-block-type attributes for two-column layout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
54 lines
1.3 KiB
Elixir
54 lines
1.3 KiB
Elixir
defmodule BerrypodWeb.Shop.Contact do
|
|
use BerrypodWeb, :live_view
|
|
|
|
alias Berrypod.Orders
|
|
alias Berrypod.Orders.OrderNotifier
|
|
alias Berrypod.Pages
|
|
alias BerrypodWeb.OrderLookupController
|
|
|
|
@impl true
|
|
def mount(_params, _session, socket) do
|
|
page = Pages.get_page("contact")
|
|
|
|
{:ok,
|
|
socket
|
|
|> assign(:page_title, "Contact")
|
|
|> assign(
|
|
:page_description,
|
|
"Get in touch with us for any questions or help with your order."
|
|
)
|
|
|> assign(:og_url, BerrypodWeb.Endpoint.url() <> "/contact")
|
|
|> assign(:tracking_state, :idle)
|
|
|> assign(:page, page)}
|
|
end
|
|
|
|
@impl true
|
|
def handle_event("lookup_orders", %{"email" => email}, socket) do
|
|
orders = Orders.list_orders_by_email(email)
|
|
|
|
state =
|
|
if orders == [] do
|
|
:not_found
|
|
else
|
|
token = OrderLookupController.generate_token(email)
|
|
link = BerrypodWeb.Endpoint.url() <> ~p"/orders/verify/#{token}"
|
|
OrderNotifier.deliver_order_lookup(email, link)
|
|
:sent
|
|
end
|
|
|
|
{:noreply, assign(socket, :tracking_state, state)}
|
|
end
|
|
|
|
@impl true
|
|
def handle_event("reset_tracking", _params, socket) do
|
|
{:noreply, assign(socket, :tracking_state, :idle)}
|
|
end
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
~H"""
|
|
<BerrypodWeb.PageRenderer.render_page {assigns} />
|
|
"""
|
|
end
|
|
end
|