berrypod/lib/berrypod_web/components/page_templates.ex
jamey 01ff8decd5
All checks were successful
deploy / deploy (push) Successful in 1m17s
add order status lookup for customers
Magic link flow on contact page: customer enters email, gets a
time-limited signed link, clicks through to /orders showing all their
paid orders and full detail pages with thumbnails and product links.

- OrderLookupController generates/verifies Phoenix.Token signed links
- Contact LiveView handles lookup_orders + reset_tracking events
- Orders and OrderDetail LiveViews gated by session email
- Order detail shows thumbnails, links to products still available
- .themed-button gets base padding/font-weight so all usages are consistent
- order-summary-card sticky scoped to .cart-grid (was leaking to orders list)
- 27 new tests (1095 total)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 08:40:08 +00:00

31 lines
1.2 KiB
Elixir

defmodule BerrypodWeb.PageTemplates do
@moduledoc """
Shared page templates used by both the public shop and theme preview.
These templates accept a `mode` parameter to control navigation behavior:
- `:shop` - Links navigate normally (real shop pages)
- `:preview` - Links send events to parent LiveView (theme editor)
All templates expect these common assigns:
- `theme_settings` - Current theme configuration
- `logo_image` - Logo image struct or nil
- `header_image` - Header image struct or nil
- `mode` - `:shop` or `:preview`
- `cart_items` - List of cart items (can be empty)
- `cart_count` - Number of items in cart
"""
use Phoenix.Component
use BerrypodWeb.ShopComponents
embed_templates "page_templates/*"
def format_order_status("unfulfilled"), do: "Being prepared"
def format_order_status("submitted"), do: "Sent to printer"
def format_order_status("processing"), do: "In production"
def format_order_status("shipped"), do: "On its way"
def format_order_status("delivered"), do: "Delivered"
def format_order_status("failed"), do: "Issue — contact us"
def format_order_status("cancelled"), do: "Cancelled"
def format_order_status(status), do: status
end