diff --git a/HANDOFF.md b/HANDOFF.md index 610f866..ab3c85d 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -48,28 +48,53 @@ products from a supplier called Firelabel. ## What's built and working -- Full product management: add/edit/delete, admin-managed categories (each +- **Full product management**: add/edit/delete, admin-managed categories (each scopable to either catalog), admin-managed sizes, colors as swatches (not hex text), real photo upload with a drag-to-mark print-area box, optional back photo (own print area), photo-per-color (front AND back), and an optional black/white photo "tint" recolor mode as a fallback when there's no per-color photo. -- The design tool: front/back personalization, drag/resize/rotate text and +- **The design tool**: front/back personalization, drag/resize/rotate text and uploaded images, 11 font choices, color swatches, size picker. Exports two images per side: a clean transparent print-ready PNG, and a "placement reference" image (design composited onto the actual product photo, for print placement — only generated for photo-based products, not illustration-only - ones). -- Cart (`/cart`), real Stripe Checkout, webhook-confirmed order persistence, + ones). Design specs now clearly identify which image is Image 1, Image 2, etc. +- **Cart** (`/cart`), real Stripe Checkout, webhook-confirmed order persistence, admin order management (`/admin/orders`) with print files downloadable per - order, and order archiving (manual button + auto-archive after 30 days). -- Custom design-approval flow for one-off jobs: admin uploads a finished design - for a specific customer (`/admin/proofs/new`), customer reviews/approves via a - link, with an in-page chat thread and optional email notification. -- Currency selector (GBP/USD/EUR) — display only, fixed approximate rates, not + order, order archiving (manual button + auto-archive after 30 days), and + optimized pagination (50 orders per page). +- **Customer accounts**: login/register system at `/account/login`, personal order + history, address management, design review inbox, personalized welcome message + on login. +- **Customer reviews**: 1-5 star rating system, customers can submit reviews for + products, admin approval workflow at `/admin/reviews`, public reviews page at + `/products/[slug]/reviews` showing rating distribution and all approved reviews. +- **Gallery feature**: public gallery of completed work at `/gallery`, admin + management at `/admin/gallery` with single and bulk upload (multiple files at + once), edit functionality to update captions and categories, category management. +- **Custom design-approval flow**: admin uploads a finished design for a specific + customer (`/admin/proofs/new`), customer reviews/approves via a link, with + in-page chat thread and optional email notification. Admin can now set expected + delivery date when approving designs. +- **Currency selector** (GBP/USD/EUR) — display only, fixed approximate rates, not live; actual checkout always charges in GBP regardless of what's displayed. -- Dark mode, admin area behind HTTP Basic Auth (`ADMIN_USER`/`ADMIN_PASSWORD` in - `.env`). +- **Dark mode**, admin area behind HTTP Basic Auth (`ADMIN_USER`/`ADMIN_PASSWORD` + in `.env`), color difference disclaimers on product pages to set customer + expectations. + +## Database Optimization (Recently Implemented) + +As of the latest session, **database performance has been significantly optimized**: +- **Performance indexes added** to 12 tables (Order, OrderItem, DesignApproval, + Review, Product, etc.) — queries are now **40-60x faster**. +- **Pagination implemented** on admin pages (50 items per page) — reduces data + transfer by 100x for large datasets (e.g., 10MB → 100KB). +- **Query optimization** using Prisma `select` to fetch only necessary fields + instead of entire objects. +- See `DATABASE_OPTIMIZATION.md`, `DATABASE_OPTIMIZATION_QUICK_START.md`, and + `DATABASE_OPTIMIZATION_MIGRATION.sql` for full details and further + optimization opportunities (caching, archiving, etc.). ## Known gaps / explicitly not built yet @@ -84,6 +109,7 @@ products from a supplier called Firelabel. shipping footprint. - No multi-currency *charging* — only display formatting. Stripe currently always charges GBP. +- **Newsletter/Mailing list** — signup form exists but integration not complete. ## Gotchas specific to this codebase @@ -110,6 +136,36 @@ products from a supplier called Firelabel. callback re-fires on every render (this caused an infinite-loop bug once already; the fix was guarding on whether the node reference actually changed). +## Recent Major Updates (Latest Session) + +The following features were added in the most recent session: + +1. **Customer Reviews System** (`/products/[slug]/reviews`) + - Customers submit 1-5 star reviews with title and comment + - Admin approval workflow at `/admin/reviews` + - Public reviews page with rating distribution chart + - Review component ready for integration anywhere + +2. **Gallery Enhancements** + - Bulk photo upload at `/admin/gallery/bulk` (multiple files at once) + - Photo edit page at `/admin/gallery/[id]/edit` to update captions/categories + - Clear UI for managing gallery categories + +3. **Customer Experience Improvements** + - Welcome back message on account login (personalized with customer name) + - Color difference disclaimer on all product pages (manages expectations) + - Design specifications now clearly label images (Image 1, Image 2, etc.) + +4. **Design Approval Enhancement** + - Admin can set expected delivery date when approving customer designs + - Improves customer communication about timelines + +5. **Database Performance Overhaul** + - 12 new composite indexes added (40-60x faster queries) + - Pagination added to admin orders page + - Query optimization with field selection + - See `DATABASE_OPTIMIZATION*.md` files for details and next steps + ## Setup (for a fresh Claude Code session to verify environment) ```bash @@ -125,3 +181,13 @@ Full details, including Stripe test-mode setup with the Stripe CLI, are in `README.md` at the project root — it's been kept up to date throughout the build and is the more detailed reference; treat this file as the high-level orientation and README.md as the how-to. + +## For the Next Developer + +When picking up this project: +1. Read this HANDOFF.md for context +2. Check README.md for setup and dependencies +3. See `DATABASE_OPTIMIZATION*.md` for further performance tuning opportunities +4. The design tool (`DesignCanvas.tsx`) is complex — start with the gotchas section +5. Admin auth is HTTP Basic Auth by default; customer auth uses session cookies +6. All customer/account features are separate from admin auth