consolidate shop pages into unified LiveView for editor state persistence
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:
jamey
2026-03-09 14:47:50 +00:00
parent ae0a149ecd
commit bb5d220079
29 changed files with 1410 additions and 1037 deletions

View File

@@ -279,22 +279,22 @@ defmodule BerrypodWeb.Router do
{BerrypodWeb.PageEditorHook, :mount_page_editor},
{BerrypodWeb.NewsletterHook, :mount_newsletter}
] do
live "/", Shop.Home, :index
live "/about", Shop.Content, :about
live "/delivery", Shop.Content, :delivery
live "/privacy", Shop.Content, :privacy
live "/terms", Shop.Content, :terms
live "/contact", Shop.Contact, :index
live "/collections/:slug", Shop.Collection, :show
live "/products/:id", Shop.ProductShow, :show
live "/cart", Shop.Cart, :index
live "/search", Shop.Search, :index
live "/checkout/success", Shop.CheckoutSuccess, :show
live "/orders", Shop.Orders, :index
live "/orders/:order_number", Shop.OrderDetail, :show
live "/", Shop.Page, :home
live "/about", Shop.Page, :about
live "/delivery", Shop.Page, :delivery
live "/privacy", Shop.Page, :privacy
live "/terms", Shop.Page, :terms
live "/contact", Shop.Page, :contact
live "/collections/:slug", Shop.Page, :collection
live "/products/:id", Shop.Page, :product
live "/cart", Shop.Page, :cart
live "/search", Shop.Page, :search
live "/checkout/success", Shop.Page, :checkout_success
live "/orders", Shop.Page, :orders
live "/orders/:order_number", Shop.Page, :order_detail
# Catch-all for custom CMS pages — must be last
live "/:slug", Shop.CustomPage, :show
live "/:slug", Shop.Page, :custom_page
end
# Checkout (POST — creates Stripe session and redirects)