2026-02-18 21:23:15 +00:00
|
|
|
defmodule BerrypodWeb.Shop.Home do
|
|
|
|
|
use BerrypodWeb, :live_view
|
2026-01-17 16:19:35 +00:00
|
|
|
|
2026-02-18 21:23:15 +00:00
|
|
|
alias Berrypod.Products
|
2026-01-17 16:19:35 +00:00
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
|
def mount(_params, _session, socket) do
|
2026-02-13 08:27:26 +00:00
|
|
|
products = Products.list_visible_products(limit: 8)
|
2026-01-17 16:19:35 +00:00
|
|
|
|
|
|
|
|
socket =
|
|
|
|
|
socket
|
|
|
|
|
|> assign(:page_title, "Home")
|
2026-02-13 08:27:26 +00:00
|
|
|
|> assign(:products, products)
|
2026-01-17 16:19:35 +00:00
|
|
|
|
|
|
|
|
{:ok, socket}
|
|
|
|
|
end
|
2026-01-17 22:17:59 +00:00
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
|
def render(assigns) do
|
|
|
|
|
~H"""
|
2026-02-18 21:23:15 +00:00
|
|
|
<BerrypodWeb.PageTemplates.home {assigns} />
|
2026-01-17 22:17:59 +00:00
|
|
|
"""
|
|
|
|
|
end
|
2026-01-17 16:19:35 +00:00
|
|
|
end
|