wire collection, PDP, cart, and search pages to page renderer

Stage 4 of the page builder: all shop pages now render via
PageRenderer instead of inline templates or PageTemplates.

- Collection: full filter bar moved to renderer (category pills,
  sort dropdown, CollectionFilters hook, empty state)
- PDP: related_products and reviews loaded via block data loaders
  instead of manual queries
- Cart: page definition loaded in mount, subtotal computed in render
- Search: page definition loaded in mount, handle_params unchanged
- Added Phoenix.VerifiedRoutes to PageRenderer for ~p sigil
- Net -55 lines (128 added, 183 removed)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-26 19:13:00 +00:00
parent 914e0661a1
commit 16ebc29fa9
7 changed files with 128 additions and 183 deletions

View File

@@ -1,6 +1,6 @@
# Page builder plan
Status: In progress (Stage 3 complete)
Status: In progress (Stage 4 complete)
## Context
@@ -635,21 +635,19 @@ Each stage is a commit point. Tests pass, all pages work, nothing is broken. Pic
---
### Stage 4: Wire up shop pages (Collection, PDP, Cart, Search)
### Stage 4: Wire up shop pages (Collection, PDP, Cart, Search)
**Goal:** the complex shop pages switch to PageRenderer. These have URL-driven state, streams, JS hooks, and event handlers.
**Status:** Complete
- [ ] Update `Shop.Collection``Pages.get_page("collection")`, keep filter/sort handle_params
- [ ] Update `Shop.ProductShow``Pages.get_page("pdp")`, keep variant selection in handle_params, product_hero receives computed data
- [ ] Update `Shop.Cart``Pages.get_page("cart")`, cart events still handled by CartHook
- [ ] Update `Shop.Search``Pages.get_page("search")`, keep search handle_params
- [ ] Page-level CSS: PDP layout rules (product_hero handles two-column internally)
- [ ] Verify JS hooks survive: gallery carousel, lightbox, collection filters
- [ ] Verify variant selection, cart add/remove, search all work
**Commit:** `wire collection, PDP, cart, and search pages to page renderer`
**Verify:** `mix test` passes, full manual walkthrough of product browsing → add to cart → search flow
- [x] Update `Shop.Collection``Pages.get_page("collection")`, keep filter/sort handle_params
- [x] Update `Shop.ProductShow``Pages.get_page("pdp")`, keep variant selection in handle_params, product_hero receives computed data. Related products + reviews loaded via block data loaders instead of manual queries.
- [x] Update `Shop.Cart``Pages.get_page("cart")`, cart events still handled by CartHook
- [x] Update `Shop.Search``Pages.get_page("search")`, keep search handle_params
- [x] Renderer `filter_bar` block updated with full collection filter bar (category pills with live navigation, sort dropdown with phx-change, CollectionFilters hook, noscript fallback)
- [x] Renderer `product_grid` block updated with dynamic show_category and empty state
- [x] Added `Phoenix.VerifiedRoutes` to PageRenderer for `~p` sigil support
- [x] Added `collection_path/2` helper and `page_main_class("collection")` to renderer
- [x] 1284 tests pass, all pages verified visually
---