- <.page_title text="Your basket" />
-
- <%= if @cart_items == [] do %>
- <.cart_empty_state mode={@mode} />
- <% else %>
-
-
-
- <%= for item <- @cart_items do %>
-
- <.shop_card class="cart-page-card">
- <.cart_item_row item={item} size={:default} show_quantity_controls mode={@mode} />
-
-
- <% end %>
-
-
-
-
- <.order_summary
- subtotal={@cart_page_subtotal}
- shipping_estimate={assigns[:shipping_estimate]}
- country_code={assigns[:country_code] || "GB"}
- available_countries={assigns[:available_countries] || []}
- mode={@mode}
- />
-
-
- <% end %>
-
-
diff --git a/lib/berrypod_web/components/page_templates/checkout_success.html.heex b/lib/berrypod_web/components/page_templates/checkout_success.html.heex
deleted file mode 100644
index 741c0d0..0000000
--- a/lib/berrypod_web/components/page_templates/checkout_success.html.heex
+++ /dev/null
@@ -1,134 +0,0 @@
-<.shop_layout {layout_assigns(assigns)} active_page="checkout">
-
- <%= if @order && @order.payment_status == "paid" do %>
-
-
- <.shop_card class="checkout-card">
-
- Order details
-
-
-
- <%= for item <- @order.items do %>
-
-
-
- {item.product_name}
-
- <%= if item.variant_title do %>
-
- {item.variant_title}
-
- <% end %>
-
- Qty: {item.quantity}
-
-
-
- {Berrypod.Cart.format_price(item.unit_price * item.quantity)}
-
-
- <% end %>
-
-
-
-
- Total
-
- {Berrypod.Cart.format_price(@order.total)}
-
-
-
-
-
- <%= if @order.shipping_address != %{} do %>
- <.shop_card class="checkout-card">
-
- Shipping to
-
-
-
{@order.shipping_address["name"]}
-
{@order.shipping_address["line1"]}
- <%= if @order.shipping_address["line2"] do %>
-
{@order.shipping_address["line2"]}
- <% end %>
-
- {@order.shipping_address["city"]}, {@order.shipping_address["postal_code"]}
-
-
{@order.shipping_address["country"]}
-
-
- <% end %>
-
-
- <.shop_link_button href="/collections/all" class="checkout-cta">
- Continue shopping
-
-
- <% else %>
- <%!-- Payment pending or order not found --%>
-
- <% end %>
-
-
diff --git a/lib/berrypod_web/components/page_templates/collection.html.heex b/lib/berrypod_web/components/page_templates/collection.html.heex
deleted file mode 100644
index 3d3ebc7..0000000
--- a/lib/berrypod_web/components/page_templates/collection.html.heex
+++ /dev/null
@@ -1,21 +0,0 @@
-<.shop_layout {layout_assigns(assigns)} active_page="collection">
-
- <.collection_header title="All Products" product_count={length(assigns[:products] || [])} />
-
-
- <.filter_bar categories={assigns[:categories] || []} />
-
- <.product_grid theme_settings={@theme_settings}>
- <%= for product <- assigns[:products] || [] do %>
- <.product_card
- product={product}
- theme_settings={@theme_settings}
- mode={@mode}
- variant={:default}
- show_category={true}
- />
- <% end %>
-
-
-
-
diff --git a/lib/berrypod_web/components/page_templates/contact.html.heex b/lib/berrypod_web/components/page_templates/contact.html.heex
deleted file mode 100644
index 9fb2ffa..0000000
--- a/lib/berrypod_web/components/page_templates/contact.html.heex
+++ /dev/null
@@ -1,30 +0,0 @@
-<.shop_layout {layout_assigns(assigns)} active_page="contact">
-
- <.hero_section
- variant={:page}
- title="Get in touch"
- description="Sample contact page for the demo store. Add your own message here – something friendly about how customers can reach you."
- />
-
-
- <.contact_form email="hello@example.com" />
-
-
-
-
-
diff --git a/lib/berrypod_web/components/page_templates/content.html.heex b/lib/berrypod_web/components/page_templates/content.html.heex
deleted file mode 100644
index 6f62480..0000000
--- a/lib/berrypod_web/components/page_templates/content.html.heex
+++ /dev/null
@@ -1,33 +0,0 @@
-<.shop_layout {layout_assigns(assigns)}>
-
- <%= if assigns[:hero_background] do %>
- <.hero_section
- title={@hero_title}
- description={@hero_description}
- background={@hero_background}
- />
- <% else %>
- <.hero_section
- variant={:page}
- title={@hero_title}
- description={@hero_description}
- />
- <% end %>
-
-
- <%= if assigns[:image_src] do %>
-
- <.responsive_image
- src={@image_src}
- source_width={1200}
- alt={@image_alt}
- sizes="(max-width: 800px) 100vw, 800px"
- class="content-hero-image"
- />
-
- <% end %>
-
- <.rich_text blocks={@content_blocks} />
-
-
-
diff --git a/lib/berrypod_web/components/page_templates/error.html.heex b/lib/berrypod_web/components/page_templates/error.html.heex
deleted file mode 100644
index 434cde8..0000000
--- a/lib/berrypod_web/components/page_templates/error.html.heex
+++ /dev/null
@@ -1,33 +0,0 @@
-<.shop_layout {layout_assigns(assigns)} active_page="error" error_page>
-
-
- <.hero_section
- variant={:error}
- pre_title={@error_code}
- title={@error_title}
- description={@error_description}
- cta_text="Go to Homepage"
- cta_page="home"
- cta_href="/"
- secondary_cta_text="Browse Products"
- secondary_cta_page="collection"
- secondary_cta_href="/collections/all"
- mode={@mode}
- />
-
- <.product_grid columns={:fixed_4}>
- <%= for product <- Enum.take(assigns[:products] || [], 4) do %>
- <.product_card
- product={product}
- theme_settings={@theme_settings}
- mode={@mode}
- variant={:minimal}
- />
- <% end %>
-
-
-
-
diff --git a/lib/berrypod_web/components/page_templates/home.html.heex b/lib/berrypod_web/components/page_templates/home.html.heex
deleted file mode 100644
index 3e215b2..0000000
--- a/lib/berrypod_web/components/page_templates/home.html.heex
+++ /dev/null
@@ -1,31 +0,0 @@
-<.shop_layout {layout_assigns(assigns)} active_page="home">
-
- <%= if @order do %>
-
-
- <%= if @order.tracking_number || @order.tracking_url do %>
- <.shop_card class="order-detail-tracking-card">
-
-
-
-
-
-
Shipment tracking
- <%= if @order.tracking_number do %>
-
{@order.tracking_number}
- <% end %>
-
- <%= if @order.tracking_url do %>
-
- Track parcel
-
- <% end %>
-
-
- <% end %>
-
- <.shop_card class="checkout-card">
- Items ordered
-
- <%= for item <- @order.items do %>
- <% info = @thumbnails[item.variant_id] %>
-
- <%= if info && info.thumb do %>
-
- <% end %>
-
- <%= if info && info.slug do %>
- <.link
- navigate={"/products/#{info.slug}"}
- class="checkout-item-name checkout-item-link"
- >
- {item.product_name}
-
- <% else %>
-
{item.product_name}
- <% end %>
- <%= if item.variant_title && item.variant_title != "" do %>
-
{item.variant_title}
- <% end %>
-
Qty: {item.quantity}
-
-
- {Berrypod.Cart.format_price(item.unit_price * item.quantity)}
-
-
- <% end %>
-
-
-
-
- Total
-
- {Berrypod.Cart.format_price(@order.total)}
-
-
-
-
-
- <%= if @order.shipping_address != %{} do %>
- <.shop_card class="checkout-card">
- Shipping to
-
-
{@order.shipping_address["name"]}
-
{@order.shipping_address["line1"]}
- <%= if @order.shipping_address["line2"] do %>
-
{@order.shipping_address["line2"]}
- <% end %>
-
- {@order.shipping_address["city"]}, {@order.shipping_address["postal_code"]}
-
-
{@order.shipping_address["country"]}
-
-
- <% end %>
-
-
- <.shop_link_button href="/collections/all">
- Continue shopping
-
-
- <% end %>
-
-
diff --git a/lib/berrypod_web/components/page_templates/orders.html.heex b/lib/berrypod_web/components/page_templates/orders.html.heex
deleted file mode 100644
index e1d1b40..0000000
--- a/lib/berrypod_web/components/page_templates/orders.html.heex
+++ /dev/null
@@ -1,71 +0,0 @@
-<.shop_layout {layout_assigns(assigns)} active_page="contact">
-
-
-
- <%= cond do %>
- <% is_nil(@orders) -> %>
-
-
This link has expired or is invalid.
-
- Head back to the <.link navigate="/contact">contact page to request a new one.
-
-
- <% @orders == [] -> %>
-
-
No orders found for that email address.
-
- If something doesn't look right, <.link navigate="/contact">get in touch.
-
-
- <% true -> %>
-
- <%= for order <- @orders do %>
- <.link navigate={"/orders/#{order.order_number}"} class="order-summary-card">
-
-
-
{order.order_number}
-
- {Calendar.strftime(order.inserted_at, "%-d %B %Y")}
-
-
-
- {format_order_status(order.fulfilment_status)}
-
-
-
-
- <%= for item <- Enum.take(order.items, 2) do %>
-
- {item.quantity}× {item.product_name}
- <%= if item.variant_title && item.variant_title != "" do %>
- · {item.variant_title}
- <% end %>
-
- <% end %>
- <%= if length(order.items) > 2 do %>
-
- +{length(order.items) - 2} more
-
- <% end %>
-
-
-
-
- <% end %>
-
- <% end %>
-
-
diff --git a/lib/berrypod_web/components/page_templates/pdp.html.heex b/lib/berrypod_web/components/page_templates/pdp.html.heex
deleted file mode 100644
index 59475c0..0000000
--- a/lib/berrypod_web/components/page_templates/pdp.html.heex
+++ /dev/null
@@ -1,78 +0,0 @@
-<.shop_layout {layout_assigns(assigns)} active_page="pdp">
-
- <.breadcrumb
- items={
- if @product.category do
- [
- %{
- label: @product.category,
- page: "collection",
- href:
- "/collections/#{@product.category |> String.downcase() |> String.replace(" ", "-")}"
- }
- ]
- else
- []
- end ++
- [%{label: @product.title, current: true}]
- }
- mode={@mode}
- />
-
-
- <.product_gallery images={@gallery_images} product_name={@product.title} />
-
-
- <.product_info product={@product} display_price={@display_price} />
-
-
- <.trust_badges :if={@theme_settings.pdp_trust_badges} />
- <.product_details product={@product} />
-
-
-
- <.reviews_section
- :if={@theme_settings.pdp_reviews}
- reviews={Berrypod.Theme.PreviewData.reviews()}
- average_rating={5}
- total_count={24}
- />
-
- <.related_products_section
- :if={@theme_settings.pdp_related_products}
- products={@related_products}
- theme_settings={@theme_settings}
- mode={@mode}
- />
-
-
diff --git a/lib/berrypod_web/live/admin/theme/index.ex b/lib/berrypod_web/live/admin/theme/index.ex
index d11fd92..6af1512 100644
--- a/lib/berrypod_web/live/admin/theme/index.ex
+++ b/lib/berrypod_web/live/admin/theme/index.ex
@@ -1,7 +1,7 @@
defmodule BerrypodWeb.Admin.Theme.Index do
use BerrypodWeb, :live_view
- alias Berrypod.Settings
+ alias Berrypod.{Pages, Settings}
alias Berrypod.Media
alias Berrypod.Theme.{CSSGenerator, Presets, PreviewData}
alias Berrypod.Workers.FaviconGeneratorWorker
@@ -403,7 +403,7 @@ defmodule BerrypodWeb.Admin.Theme.Index do
})
end
- # Preview page component — delegates to shared PageTemplates with preview-specific assigns
+ # Unified preview — loads page definition, applies context, renders via PageRenderer
attr :page, :atom, required: true
attr :preview_data, :map, required: true
attr :theme_settings, :map, required: true
@@ -411,17 +411,24 @@ defmodule BerrypodWeb.Admin.Theme.Index do
attr :header_image, :any, required: true
attr :cart_drawer_open, :boolean, default: false
- defp preview_page(%{page: :home} = assigns) do
- assigns = preview_assigns(assigns)
- ~H"