add order status lookup for customers
All checks were successful
deploy / deploy (push) Successful in 1m17s

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>
This commit is contained in:
jamey
2026-02-24 08:40:08 +00:00
parent 4e36b654d3
commit 01ff8decd5
19 changed files with 1030 additions and 8 deletions

View File

@@ -132,21 +132,72 @@ defmodule BerrypodWeb.ShopComponents.Content do
@doc """
Renders the order tracking card.
Submits `lookup_orders` to the parent LiveView. The `:sent` state shows a
confirmation message; `:not_found` shows the form again with an error note.
## Attributes
* `tracking_state` - Optional. `:idle | :sent | :not_found`. Defaults to `:idle`.
## Examples
<.order_tracking_card />
<.order_tracking_card tracking_state={@tracking_state} />
"""
attr :tracking_state, :atom, default: :idle
def order_tracking_card(%{tracking_state: :sent} = assigns) do
~H"""
<.shop_card class="card-section">
<h3 class="card-heading">Check your inbox</h3>
<p class="card-text card-text--spaced">
We've sent a link to your email address. It'll expire after an hour.
</p>
<button phx-click="reset_tracking" class="order-tracking-reset">
Try a different email
</button>
</.shop_card>
"""
end
def order_tracking_card(%{tracking_state: :not_found} = assigns) do
~H"""
<.shop_card class="card-section">
<h3 class="card-heading">Track your order</h3>
<p class="card-text card-text--spaced">
No orders found for that address. Make sure you use the same email you checked out with.
</p>
<form phx-submit="lookup_orders" class="card-inline-form">
<.shop_input
type="email"
name="email"
placeholder="your@email.com"
class="email-input"
required
/>
<.shop_button type="submit">Try again</.shop_button>
</form>
</.shop_card>
"""
end
def order_tracking_card(assigns) do
~H"""
<.shop_card class="card-section">
<h3 class="card-heading">Track your order</h3>
<p class="card-text card-text--spaced">
Enter your email and I'll send you a link to check your order status.
Enter the email address you used at checkout and we'll send you a link.
</p>
<div class="card-inline-form">
<.shop_input type="email" placeholder="your@email.com" class="email-input" />
<.shop_button>Send</.shop_button>
</div>
<form phx-submit="lookup_orders" class="card-inline-form">
<.shop_input
type="email"
name="email"
placeholder="your@email.com"
class="email-input"
required
/>
<.shop_button type="submit">Send link</.shop_button>
</form>
</.shop_card>
"""
end