# Status

## Current State

The repository is a Next.js/Prisma bullion e-commerce platform for Elit Gold/Silver Exchange / ELIT Trade. The current priority is public storefront UI polish toward reference-grade bullion ecommerce. The public storefront has a stronger dense commerce header, ticker-style market reference strip, controlled mega menu, search-first shopping, homepage merchandising sections, product listing pages, product details, cart, checkout, service pages, admin pages, and a CSS-based bullion product visual system.

## Existing Public Pages

- `/`
- `/products`
- `/products/[slug]`
- `/gold`
- `/silver`
- `/cart`
- `/checkout`
- `/payment-success`
- `/payment-failed`
- `/faq`
- `/support`
- `/contact`
- `/service-fees`
- `/ira-trust`
- `/vault-storage`
- `/sell-back`
- `/digital-gold-silver`
- `/legal/[slug]`

## Product Grid/Listing/Detail Progress

Product grids filter to `itemKind = PHYSICAL_BULLION` and `isPublicProduct = true` on homepage, listing, metal category, detail, cart hydration, and checkout creation paths. Product cards now use a reusable `ProductVisual` system for gold bars, silver bars, coins, rounds, and assay-card visuals, plus consistent height, stronger price hierarchy, brand/mint line, Price updated, Add to Cart, and Details. Product detail pages include a visual gallery, stronger sticky purchase panel, specs table, description, shipping/fulfillment section, FAQ, secure checkout notes, and related products.

## Current Critical Issues

- `/admin` Internal Error was addressed with preview-safe middleware redirect and safer session lookup.
- `/checkout` Internal Error was addressed with client-only cart guards, timeout-backed safe cart hydration, empty state, and checkout API guards.
- `/cart` stuck loading was addressed with timeout-backed cart hydration, skeleton loading, corrupted-cart reset, and polished empty cart state.
- Possible redirect/auth issue: middleware now redirects with `new URL("/admin/login", request.url)` and avoids localhost hardcoding.
- Checkout empty state exists with Shop Gold, Shop Silver, and View All Products.
- Admin layout separation is handled by `PublicChrome` hiding public chrome for `/admin`; future work should consider route groups for stronger server-side separation.
- Final visual polish remains ongoing.
- Product/service separation is implemented in key public product queries; keep checking every new grid.
- Header/homepage/product card/listing/detail/cart/footer polish was upgraded in the reference-grade storefront pass.
- Visual rebuild sprint completed: storefront design tokens, CSS bullion visuals, card/detail/cart visual integration, checkout polish, and footer final disclaimer strip were added.
- Client-ready broken-route sprint completed: `/cart`, `/checkout`, and `/admin` were hardened against stuck loading/Internal Error states, and dashboard data fetch failures now show an admin-safe fallback.
- Bullion retailer UI surgery pass completed: cart/checkout empty and loading states were polished, checkout cards were split into contact/shipping/billing/payment, product listing received a stronger category header panel, product detail duplicate trust copy was reduced, and focus/form micro-polish was added.

## Verification Notes

- `npm.cmd run typecheck` passed on June 27, 2026.
- `npm.cmd run lint` passed on June 27, 2026, with existing `<img>` optimization warnings.
- `npx.cmd next build` passed on June 27, 2026, using the existing generated Prisma client.
- `npm.cmd run build` was blocked during Prisma generate by a Windows EPERM rename on `node_modules/.prisma/client/query_engine-windows.dll.node`, even when retried with elevated permissions. Retry after closing processes that may lock Prisma files.
- After the reference-grade UI pass, `npm.cmd run typecheck`, `npm.cmd run lint`, and `npx.cmd next build` passed on June 27, 2026. `npm.cmd run build` still fails at Prisma generate with the same Windows EPERM DLL rename.
- After the visual rebuild sprint, `npm.cmd run typecheck`, `npm.cmd run lint`, and `npx.cmd next build` passed on June 27, 2026. Lint warnings remain for `<img>` in admin products and `ProductVisual` real-image fallback. `npm.cmd run build` still fails at Prisma generate with the same Windows EPERM DLL rename.
- After the client-ready route sprint, `npm.cmd run typecheck`, `npm.cmd run lint`, and `npx.cmd next build` passed on June 27, 2026. Lint warnings remain for `<img>` in admin products and `ProductVisual` real-image fallback. `npm.cmd run build` still fails at Prisma generate with the same Windows EPERM DLL rename.
- After the bullion retailer UI surgery pass, `npm.cmd run typecheck`, `npm.cmd run lint`, and `npx.cmd next build` passed on June 27, 2026. Lint warnings remain for `<img>` in admin products and `ProductVisual` real-image fallback. `npm.cmd run build` still fails at Prisma generate with the same Windows EPERM DLL rename.
- Dev smoke checks on June 27, 2026: `/`, `/products`, `/gold`, `/silver`, `/cart`, `/checkout`, `/admin/login`, and `/products/1-gram-24k-gold-bar-nadir` returned 200. `/admin` returned 307 to `/admin/login`.
- After the reference-grade UI pass, dev smoke checks on June 27, 2026 returned 200 for `/`, `/products`, `/gold`, `/silver`, `/cart`, `/checkout`, `/admin/login`, and `/products/1-gram-24k-gold-bar-nadir`; `/admin` returned 307 to `/admin/login`.
- After the visual rebuild sprint, dev smoke checks on June 27, 2026 returned 200 for `/`, `/products`, `/gold`, `/silver`, `/cart`, `/checkout`, `/admin/login`, and `/products/1-gram-24k-gold-bar-nadir`; `/admin` returned 307 to `/admin/login`.
- After the client-ready route sprint, dev smoke checks on June 27, 2026 returned 200 for `/`, `/products`, `/cart`, `/checkout`, `/admin/login`, and `/products/1-gram-24k-gold-bar-nadir`; `/admin` returned 307 to `/admin/login`. The first cold `/products` request in dev once returned 500, then repeated warm checks returned 200.
- After the bullion retailer UI surgery pass, warm dev smoke checks on June 27, 2026 returned 200 for `/`, `/products`, `/products/gold-krugerrand-1-oz`, `/cart`, `/checkout`, and `/admin/login`; `/admin` returned 307 to `/admin/login`. The first cold `/products` request in dev again returned 500 once, then repeated warm checks returned 200.
- Plain `git branch --show-current` and `git -C ... branch --show-current` reported "not a git repository" even though a `.git` directory entry is visible. Check repository metadata before relying on git operations.

## Check After Each Codex Session

- Homepage, `/products`, `/gold`, `/silver`, a product detail page, `/cart`, and `/checkout`.
- `/admin` unauthenticated redirect and `/admin/login` layout.
- Product grids exclude services and digital request items.
- Public copy contains no developer/internal wording.
- `npm.cmd run typecheck`, `npm.cmd run lint`, and `npm.cmd run build` where possible.
