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

  alias SimpleshopTheme.Theme.PreviewData

  @impl true
  def mount(_params, _session, socket) do
    preview_data = %{
      products: PreviewData.products(),
      categories: PreviewData.categories()
    }

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

    {:ok, socket}
  end

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