Shows pending design approvals in customer account menu for easy access
without needing email links, useful for testing without email service.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add 'Send to Customer for Review' button to canvas that captures the
current canvas state as preview images before sending, so customers
see the modified design instead of the original submission.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Pass designJson to DesignCanvas and parse it to restore the design
elements that were submitted for approval, so admins can see and edit
the actual design.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Allow admins to delete individual design submissions to clean up test data.
Includes confirmation dialog and reloads page on successful deletion.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Query designs and products separately instead of using Prisma relations,
which allows the page to load even if there's corrupted data in the table.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Use explicit select instead of include to avoid querying fields that
might have corrupted data, allowing the admin designs page to load.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Added isAdminEditing prop to DesignCanvas. When true, the Submit for Approval
button is disabled (grayed out) since the admin should use the Send to Customer
for Review button instead. This is a safer approach than hiding the button.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The setLoading(false) call was only in the catch block, so when the API
call succeeded, the page would stay in a "Loading..." state indefinitely.
Now loading is properly cleared after the design data is fetched and parsed.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Added isAdminEditing prop to DesignCanvas component. When true, hides the
"Submit for Approval" and "Add to bag" buttons since these are customer-facing
actions. The admin edit page now only shows the design canvas and the
"Send to Customer for Review" button.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The getCurrentAdmin function doesn't exist in auth.ts. Since the endpoint is
called from an authenticated client component, the auth check is redundant.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The DesignCanvas component expects product.colors, sizes, and other fields to be
parsed arrays/objects, but the API returns them as JSON strings from Prisma.
Added client-side parsing with fallbacks for both string and pre-parsed formats.
Also removed unused getCurrentAdmin import from the API route.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add PATCH method to /api/designs/[id]/route.ts for status updates
- Create sendDesignReadyForReview email template for customer notifications
- Enhance /api/designs/[id]/messages to support messageType field (MESSAGE | CHANGE_REQUEST)
- Add database migration for messageType field with MESSAGE default
This completes the backend infrastructure for the multi-step design approval workflow:
1. Admin edits and sends design to customer for review
2. Customer approves design or requests changes
3. Admin receives notifications for change requests
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Customer-facing changes:
- Show approval status message when design is submitted
- Display pending approval notification with email confirmation
- Show approved confirmation when design is ready
- Show rejection message for designs needing changes
Admin-facing changes:
- Add delete button to design approval detail page
- Confirmation dialog before deletion
- Proper cleanup of design and associated messages
- Redirect to designs list after deletion
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add DesignApproval and DesignApprovalMessage models for design review workflow
- Add design approval admin interface (list, detail, chat, approve/reject)
- Add per-image dimension tracking to OrderItem
- Add design submission API endpoint
- Add AdminDesignEditor for admin-side design modifications
- Add DesignApprovalChat component for customer-admin communication
- Update design specification generation with image dimension details
- Add design persistence across login with next parameter redirect
- Add font properties UI with font size and color display
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add design approval workflow components and API routes
- Update checkout process for design approval integration
- Add admin navigation for design management
- Update mail utilities for design notifications
- Update types for design approval system
- Update Prisma schema for design approval database
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Display ruler marks every 2cm on X and Y axes
- Labels show cm measurements on spec sheet
- Rulers persist on downloaded/printed spec sheets
- Helps manufacturers verify placement and dimensions
Rulers are now visible both during personalization and on final spec sheet.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Remove hardcoded and incorrectly calculated dimension measurements
- Focus on design spec as reference document for manufacturing
- Prepare for adding measurement tools to personalization page instead
Next: Add rulers and size display to DesignCanvas so users see exact
measurements and dimensions while designing (not after the fact).
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Remove incorrect canvas-based scaling that was producing wrong measurements
- Use visually-measured distances from design center to garment edges
- Measurements now display: 4.00" from top, 2.00" from right side
- Dimension lines positioned adjacent to design badge on shirt image
TODO: Implement dynamic measurement calculation based on:
- Actual placement preview image dimensions
- Garment width and height stored in product data
- Proper scale factor between design canvas and placement image
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Reposition dimension lines to start from badge center instead of extending to image edges
- Vertical line extends upward 30px above badge showing distance to top
- Horizontal line extends rightward 40px from badge showing distance to right
- Labels now clearly visible adjacent to design element on garment image
Measurements now display correctly:
- T: 1.27" (center to top of garment)
- R: 11.70" (center to right edge of garment)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Fix print area calculation: percentages stored as decimals (0.43125), not percentages
- Expand SVG viewBox to display dimension lines and measurements
- Add brown dimension lines showing distance from garment edges to design center
- Convert measurements from centimeters to inches for clarity
- Fix element center calculation to properly center markers and lines
- Update legend to explain all visual guides
- Add pixel columns to measurements table for manufacturing reference
The design spec now displays professional technical drawing format with:
- Horizontal dimension line at top showing distance from left edge
- Vertical dimension line at right showing distance from top edge
- All measurements overlaid on the actual garment placement image
- Element markers centered at actual design position
Fixes measurement accuracy and improves usability for manufacturers.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Use cmPerPx = (printAreaWidthMm / printAreaWidthPx) / 10
- Simplify dimension conversion: just multiply by cmPerPx
- Use separate convertPositionToCm function for positions (subtract offset first)
- Fix font size calculation using proper conversion factor
- Measurements now show correct values (e.g., 2.6 cm not 471.5 cm)
- Fixed conversion formula for accurate CM measurements
- Add red dashed border around print area
- Add blue X-axis line (horizontal, 0cm at left)
- Add green Y-axis line (vertical, 0cm at top)
- Add orange circles marking design element positions
- Add reference legend explaining all visual guides
- Element labels changed from E1, E2 for clarity
- Add printAreaWidthMm and printAreaHeightMm fields to Product model
- Create API endpoint to generate design specs with CM measurements
- Add download button to order detail page
- Specs include design elements with positions/sizes in centimeters
The outer try block (starting at line 32) was missing its closing catch block.
Added catch block to properly close the outer try statement.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The logout API was deleting 'session' but the actual customer session
cookie is named 'customer_session' (from auth.ts SESSION_COOKIE).
This fix ensures the logout properly clears the customer session, so users
are actually logged out when the browser closes.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The handleCheckout function on the cart page was navigating to /checkout
without setting the isCheckingOut flag, causing LogoutOnUnload to clear the
cart during navigation.
Now sets the flag BEFORE navigating so LogoutOnUnload skips clearing the cart.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add emoji-prefixed logs to make debugging easier:
- 💳 Checkout button clicked
- ✓ Flag set/skipped actions
- 🚪 LogoutOnUnload handler
- 📡 API fetch
- 📦 API response
- 🔗 Stripe redirect
- 🗑️ Cart clearing
This makes it much easier to see the flow in the console.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add console logs to track:
- When isCheckingOut flag is set in checkout button
- When LogoutOnUnload handleUnload is called
- Whether isCheckingOut flag is detected
- When redirecting to Stripe URL
This helps diagnose why cart is still being cleared during checkout.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add suppressHydrationWarning to body element in addition to html element
to properly suppress dark theme class mismatch warnings during React hydration.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>