consolidate shop pages into unified LiveView for editor state persistence
All checks were successful
deploy / deploy (push) Successful in 1m27s
All checks were successful
deploy / deploy (push) Successful in 1m27s
Replace individual shop LiveViews with a single Shop.Page that dispatches to page modules based on live_action. This enables patch navigation between pages, preserving socket state (including editor state) across transitions. Changes: - Add Shop.Page unified LiveView with handle_params dispatch - Extract page logic into Shop.Pages.* modules (Home, Product, Collection, etc.) - Update router to use Shop.Page with live_action for all shop routes - Change navigate= to patch= in shop component links - Add maybe_sync_editing_blocks to reload editor state when page changes - Track editor_page_slug to detect cross-page navigation while editing - Fix picture element height when hover image disabled - Extract ThemeEditor components for shared use Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -266,7 +266,7 @@ defmodule BerrypodWeb.ShopComponents.Layout do
|
||||
</a>
|
||||
<% else %>
|
||||
<.link
|
||||
navigate={@href}
|
||||
patch={@href}
|
||||
class="mobile-nav-link"
|
||||
aria-current={if @is_current, do: "page", else: nil}
|
||||
>
|
||||
@@ -484,7 +484,7 @@ defmodule BerrypodWeb.ShopComponents.Layout do
|
||||
aria-selected="false"
|
||||
>
|
||||
<.link
|
||||
navigate={"/products/#{item.product.slug || item.product.id}"}
|
||||
patch={"/products/#{item.product.slug || item.product.id}"}
|
||||
class="search-result"
|
||||
phx-click={Phoenix.LiveView.JS.dispatch("close-search", to: "#search-modal")}
|
||||
>
|
||||
@@ -588,7 +588,7 @@ defmodule BerrypodWeb.ShopComponents.Layout do
|
||||
</a>
|
||||
<% else %>
|
||||
<.link
|
||||
navigate={item["href"]}
|
||||
patch={item["href"]}
|
||||
class="mobile-nav-link"
|
||||
aria-current={@active_page in (item["active_slugs"] || [item["slug"]]) && "page"}
|
||||
phx-click={Phoenix.LiveView.JS.dispatch("close-mobile-nav", to: "#mobile-nav-drawer")}
|
||||
@@ -615,7 +615,7 @@ defmodule BerrypodWeb.ShopComponents.Layout do
|
||||
</a>
|
||||
<% else %>
|
||||
<.link
|
||||
navigate={"/collections/#{category.slug}"}
|
||||
patch={"/collections/#{category.slug}"}
|
||||
class="mobile-nav-link"
|
||||
phx-click={
|
||||
Phoenix.LiveView.JS.dispatch("close-mobile-nav", to: "#mobile-nav-drawer")
|
||||
@@ -700,7 +700,7 @@ defmodule BerrypodWeb.ShopComponents.Layout do
|
||||
<% else %>
|
||||
<li>
|
||||
<.link
|
||||
navigate="/collections/all"
|
||||
patch="/collections/all"
|
||||
class="footer-link"
|
||||
>
|
||||
All products
|
||||
@@ -709,7 +709,7 @@ defmodule BerrypodWeb.ShopComponents.Layout do
|
||||
<%= for category <- @categories do %>
|
||||
<li>
|
||||
<.link
|
||||
navigate={"/collections/#{category.slug}"}
|
||||
patch={"/collections/#{category.slug}"}
|
||||
class="footer-link"
|
||||
>
|
||||
{category.name}
|
||||
@@ -735,7 +735,7 @@ defmodule BerrypodWeb.ShopComponents.Layout do
|
||||
{item["label"]}
|
||||
</a>
|
||||
<% else %>
|
||||
<.link navigate={item["href"]} class="footer-link">
|
||||
<.link patch={item["href"]} class="footer-link">
|
||||
{item["label"]}
|
||||
</.link>
|
||||
<% end %>
|
||||
@@ -929,7 +929,7 @@ defmodule BerrypodWeb.ShopComponents.Layout do
|
||||
/>
|
||||
</a>
|
||||
<% else %>
|
||||
<.link navigate="/" class="shop-logo-link">
|
||||
<.link patch="/" class="shop-logo-link">
|
||||
<.logo_inner
|
||||
theme_settings={@theme_settings}
|
||||
site_name={@site_name}
|
||||
@@ -1015,7 +1015,7 @@ defmodule BerrypodWeb.ShopComponents.Layout do
|
||||
{@label}
|
||||
</a>
|
||||
<% else %>
|
||||
<.link navigate={@href} class="nav-link">
|
||||
<.link patch={@href} class="nav-link">
|
||||
{@label}
|
||||
</.link>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user