diff --git a/backlog/features.json b/backlog/features.json index 3c9e42c..ba5e474 100644 --- a/backlog/features.json +++ b/backlog/features.json @@ -3316,6 +3316,39 @@ "close": true }, "completed_at": "2026-08-19T15:22:39Z" + }, + { + "id": "F-067", + "type": "fix", + "title": "Product card image left-aligned and checkout does not see saved customer addresses", + "problem": "Product listing cards use aspect-5/7 max-h-72 which collapses to ~205x288 inside a wider card so the image container is left-aligned. The checkout page never fetches the customer saved addresses so even if the admin saved them via /customers/[id] the storefront checkout shows an empty form", + "goal": "Make flow better", + "scope_in": [ + "Card image visually centred inside its grid cell; when a logged-in customer reaches /checkout their saved addresses are listed and the default one pre-fills the shipping form" + ], + "scope_out": [ + "No redesign" + ], + "priority": "low", + "risk": "low", + "description": "Problem: Product listing cards use aspect-5/7 max-h-72 which collapses to ~205x288 inside a wider card so the image container is left-aligned. The checkout page never fetches the customer saved addresses so even if the admin saved them via /customers/[id] the storefront checkout shows an empty form. Goal: Make flow better. Scope IN: Card image visually centred inside its grid cell; when a logged-in customer reaches /checkout their saved addresses are listed and the default one pre-fills the shipping form. Scope OUT: No redesign. Type: fix. Priority: low. Risk: low.", + "acceptance": [ + "high", + "Listing cards have the image visually centred inside the card", + "Checkout fetches saved addresses when user is logged in", + "Default saved address pre-fills the shipping form on first render", + "User can pick a different saved address and the form updates", + "verify.sh is green" + ], + "status": "done", + "created_at": "2026-08-19", + "gates": { + "reviewer": true, + "security": true, + "qa": true, + "close": true + }, + "completed_at": "2026-08-19T15:30:00Z" } ] } diff --git a/project/frontend/src/app/api/users/[id]/addresses/route.ts b/project/frontend/src/app/api/users/[id]/addresses/route.ts new file mode 100644 index 0000000..7ddcdaa --- /dev/null +++ b/project/frontend/src/app/api/users/[id]/addresses/route.ts @@ -0,0 +1,40 @@ +import { NextRequest, NextResponse } from 'next/server'; + +const API = process.env.NEXT_PUBLIC_API_URL ?? 'http://127.0.0.1:3000'; + +interface RouteParams { + params: Promise<{ id: string }>; +} + +export async function GET(_request: NextRequest, { params }: RouteParams) { + const { id } = await params; + const cookie = _request.headers.get('cookie') ?? ''; + try { + const res = await fetch(`${API}/users/${id}/addresses`, { + headers: { Cookie: cookie }, + cache: 'no-store', + }); + const body = await res.json().catch(() => ({ items: [] })); + return NextResponse.json(body, { status: res.status }); + } catch { + return NextResponse.json({ items: [] }, { status: 502 }); + } +} + +export async function POST(request: NextRequest, { params }: RouteParams) { + const { id } = await params; + const cookie = request.headers.get('cookie') ?? ''; + const payload = await request.text(); + try { + const res = await fetch(`${API}/users/${id}/addresses`, { + method: 'POST', + headers: { 'Content-Type': 'application/json', Cookie: cookie }, + body: payload, + cache: 'no-store', + }); + const body = await res.json().catch(() => ({})); + return NextResponse.json(body, { status: res.status }); + } catch { + return NextResponse.json({ error: 'Proxy error' }, { status: 502 }); + } +} \ No newline at end of file diff --git a/project/frontend/src/app/brands/[slug]/page.tsx b/project/frontend/src/app/brands/[slug]/page.tsx index 2992f17..d4ae52a 100644 --- a/project/frontend/src/app/brands/[slug]/page.tsx +++ b/project/frontend/src/app/brands/[slug]/page.tsx @@ -79,7 +79,7 @@ export default async function BrandPage({ params }: Props) { {products.map((product) => (
+ También puedes editar los campos manualmente debajo; se aplicarán al pedido sin guardar nada en tu cuenta. +
+