+ <.skip_link />
+
+ <%= if @theme_settings.announcement_bar do %>
+ <.announcement_bar theme_settings={@theme_settings} />
+ <% end %>
+
+ <.shop_header theme_settings={@theme_settings} logo_image={@logo_image} header_image={@header_image} active_page="home" mode={:shop} cart_count={0} />
+
+
+ <.hero_section
+ title="Original designs, printed on demand"
+ description="From art prints to apparel – unique products created by independent artists and delivered straight to your door."
+ cta_text="Shop the collection"
+ cta_page="collection"
+ mode={:shop}
+ />
+
+ <.category_nav categories={@preview_data.categories} mode={:shop} />
+
+ <.featured_products_section
+ title="Featured products"
+ products={@preview_data.products}
+ theme_settings={@theme_settings}
+ mode={:shop}
+ />
+
+ <.image_text_section
+ title="Made with passion, printed with care"
+ description="Every design starts with an idea. We work with quality print partners to bring those ideas to life on premium products – from gallery-quality art prints to everyday essentials."
+ image_url="/mockups/mountain-sunrise-print-3.jpg"
+ link_text="Learn more about the studio →"
+ link_page="about"
+ mode={:shop}
+ />
+
+
+ <.shop_footer theme_settings={@theme_settings} mode={:shop} />
+
+ <.cart_drawer cart_items={[]} subtotal="£0.00" mode={:shop} />
+
+ <.search_modal hint_text={~s(Try searching for "mountain", "forest", or "ocean")} />
+
diff --git a/lib/simpleshop_theme_web/plugs/load_theme.ex b/lib/simpleshop_theme_web/plugs/load_theme.ex
new file mode 100644
index 0000000..78183ec
--- /dev/null
+++ b/lib/simpleshop_theme_web/plugs/load_theme.ex
@@ -0,0 +1,39 @@
+defmodule SimpleshopThemeWeb.Plugs.LoadTheme do
+ @moduledoc """
+ Plug that loads theme settings and generated CSS for public shop pages.
+
+ This plug:
+ 1. Checks the ETS cache for pre-generated CSS
+ 2. Falls back to generating CSS from theme settings on cache miss
+ 3. Assigns both `theme_settings` and `generated_css` to the connection
+
+ The generated CSS contains only the active theme values (not all variants),
+ making it much smaller than the full theme-layer2-attributes.css file used
+ by the theme editor for live preview switching.
+ """
+
+ import Plug.Conn
+
+ alias SimpleshopTheme.Settings
+ alias SimpleshopTheme.Theme.{CSSGenerator, CSSCache}
+
+ def init(opts), do: opts
+
+ def call(conn, _opts) do
+ {theme_settings, generated_css} =
+ case CSSCache.get() do
+ {:ok, css} ->
+ {Settings.get_theme_settings(), css}
+
+ :miss ->
+ settings = Settings.get_theme_settings()
+ css = CSSGenerator.generate(settings)
+ CSSCache.put(css)
+ {settings, css}
+ end
+
+ conn
+ |> assign(:theme_settings, theme_settings)
+ |> assign(:generated_css, generated_css)
+ end
+end
diff --git a/lib/simpleshop_theme_web/router.ex b/lib/simpleshop_theme_web/router.ex
index 5333159..ce03774 100644
--- a/lib/simpleshop_theme_web/router.ex
+++ b/lib/simpleshop_theme_web/router.ex
@@ -17,10 +17,17 @@ defmodule SimpleshopThemeWeb.Router do
plug :accepts, ["json"]
end
- scope "/", SimpleshopThemeWeb do
- pipe_through :browser
+ pipeline :shop do
+ plug SimpleshopThemeWeb.Plugs.LoadTheme
+ end
- get "/", PageController, :home
+ # Public storefront (root level)
+ scope "/", SimpleshopThemeWeb do
+ pipe_through [:browser, :shop]
+
+ live_session :public_shop, layout: {SimpleshopThemeWeb.Layouts, :shop} do
+ live "/", ShopLive.Home, :index
+ end
end
# Image serving routes (public, no auth required)
diff --git a/test/simpleshop_theme_web/controllers/page_controller_test.exs b/test/simpleshop_theme_web/controllers/page_controller_test.exs
index 736ebca..c792246 100644
--- a/test/simpleshop_theme_web/controllers/page_controller_test.exs
+++ b/test/simpleshop_theme_web/controllers/page_controller_test.exs
@@ -1,8 +1,8 @@
defmodule SimpleshopThemeWeb.PageControllerTest do
use SimpleshopThemeWeb.ConnCase
- test "GET /", %{conn: conn} do
+ test "GET / renders the shop home page", %{conn: conn} do
conn = get(conn, ~p"/")
- assert html_response(conn, 200) =~ "Peace of mind from prototype to production"
+ assert html_response(conn, 200) =~ "Original designs, printed on demand"
end
end