defmodule SimpleshopThemeWeb.Shop.Home do
  use SimpleshopThemeWeb, :live_view

  alias SimpleshopTheme.Products

  @impl true
  def mount(_params, _session, socket) do
    products = Products.list_visible_products(limit: 8)

    socket =
      socket
      |> assign(:page_title, "Home")
      |> assign(:products, products)

    {:ok, socket}
  end

  @impl true
  def render(assigns) do
    ~H"""
    <SimpleshopThemeWeb.PageTemplates.home {assigns} />
    """
  end
end
