Commit Graph
100 Commits
Author SHA1 Message Date
AndymickandClaude Haiku 4.5 07b43ac53d Fix undefined params reference in send button
Use designId prop instead of undefined params variable.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 19:24:23 +01:00
AndymickandClaude Haiku 4.5 6f07c38145 Add design reviews section to customer account page
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>
2026-07-18 19:22:20 +01:00
AndymickandClaude Haiku 4.5 87b269e57c Capture canvas preview when admin sends design to customer
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>
2026-07-18 19:19:38 +01:00
AndymickandClaude Haiku 4.5 b97d015cd1 Load design elements for admin editing
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>
2026-07-18 19:15:53 +01:00
AndymickandClaude Haiku 4.5 c0797bc45c Fix field name in DELETE endpoint - use designId not designApprovalId
The DesignApprovalMessage model uses designId as the foreign key,
not designApprovalId.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 19:13:57 +01:00
AndymickandClaude Haiku 4.5 c982c983e5 Add delete button to design approvals page
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>
2026-07-18 19:13:03 +01:00
AndymickandClaude Haiku 4.5 0d2e874f14 Fetch designs without relations to avoid database corruption issues
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>
2026-07-18 19:11:19 +01:00
AndymickandClaude Haiku 4.5 ca11baf1ae Fix Prisma query by excluding problematic designImageDimensions field
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>
2026-07-18 19:10:19 +01:00
AndymickandClaude Haiku 4.5 ae09d22004 Don't persist approval status to localStorage
The approval status should only be shown temporarily after submission,
not persisted across page loads. This allows users to start fresh
designs on the same product without seeing old approval messages.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 19:06:09 +01:00
AndymickandClaude Haiku 4.5 75518e3e5e Log approvalStatus value when rendering pending message
Add console log to show the actual value of approvalStatus when the
pending approval message is displayed.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 19:00:56 +01:00
AndymickandClaude Haiku 4.5 c9a7cab349 Add logging to debug approval status clearing
Log when addText is called and whether approvalStatus is being cleared
to help debug why the old approval message persists.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 18:58:05 +01:00
AndymickandClaude Haiku 4.5 63ae432793 Clear old approval status when user starts designing new item
When user adds text or image after a previous submission, clear the old
approval status and localStorage so they can design a fresh item on the
same product without seeing the old approval message.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 18:56:41 +01:00
AndymickandClaude Haiku 4.5 f64462c5fe Add logging to check if designDraft exists in localStorage
Log whether designDraft is found when component mounts to help debug
why old designs persist after submission.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 18:54:29 +01:00
AndymickandClaude Haiku 4.5 3a2bc24d69 Fix undefined customerName variable in design submission
Changed customerName to customer.name to use the actual customer object.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 18:52:44 +01:00
AndymickandClaude Haiku 4.5 8cba443f5a Display submission success/error message after design submission
The submissionMessage state was being set but never displayed in the UI.
Added message display to show feedback when user submits for approval.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 18:51:39 +01:00
AndymickandClaude Haiku 4.5 b61ce99157 Add debugging logs for localStorage draft removal
Added console logs to verify when the designDraft is being removed
from localStorage after successful submission, and to catch any errors.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 18:48:06 +01:00
AndymickandClaude Haiku 4.5 746179885f Reset all design state when submission succeeds
Clear not just elements but also color, size, dimensions, quantity,
and image dimensions so a fresh canvas is guaranteed after submission.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 18:46:43 +01:00
AndymickandClaude Haiku 4.5 dae1df444a Clear localStorage draft when design submitted for approval
Also remove the designDraft from localStorage when submission succeeds,
so the cleared state doesn't get reloaded when the user creates another design.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 18:44:48 +01:00
AndymickandClaude Haiku 4.5 5daa380e9d Clear design state after submission for approval
After a design is successfully submitted for approval, clear the
elementsFront and elementsBack state so users start with a blank
canvas when creating their next design.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 18:43:39 +01:00
AndymickandClaude Haiku 4.5 609cfdb7d6 Update local settings tracking
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 18:27:33 +01:00
AndymickandClaude Haiku 4.5 a5f09e9f75 Disable Submit for Approval button when admin is editing design
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>
2026-07-18 18:27:00 +01:00
AndymickandClaude Haiku 4.5 04f45c6e6b Fix loading state not being cleared when design data loads successfully
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>
2026-07-18 18:08:02 +01:00
Andymick 82f5c96fd3 Revert "Hide customer action buttons (Submit/Add to bag) when in admin editing mode"
This reverts commit 30e4a0c229.
2026-07-18 18:07:10 +01:00
AndymickandClaude Haiku 4.5 30e4a0c229 Hide customer action buttons (Submit/Add to bag) when in admin editing mode
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>
2026-07-18 18:05:55 +01:00
AndymickandClaude Haiku 4.5 fded2af63b Remove unused getCurrentAdmin from send-to-customer endpoint
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>
2026-07-18 17:59:27 +01:00
AndymickandClaude Haiku 4.5 dda63e559b Fix admin design edit page to properly parse JSON product fields
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>
2026-07-18 17:58:00 +01:00
AndymickandClaude Haiku 4.5 ac27cc554b Add design approval workflow infrastructure: PATCH endpoint, email notifications, and message types
- 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>
2026-07-18 17:11:10 +01:00
AndymickandClaude Haiku 4.5 4d124b1550 Add customer approval status messages and admin delete option
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>
2026-07-18 16:48:35 +01:00
AndymickandClaude Haiku 4.5 95c1255811 Make image dimensions and font properties collapsible sections
- Add expandedSections state to track which sections are open
- Image Dimensions section now collapses by default (click to expand)
- Font Properties section now collapses by default (click to expand)
- Shows count of items in each section
- Dramatically reduces vertical scrolling on the right sidebar
- More compact layout with accordion-style sections

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 16:32:09 +01:00
AndymickandClaude Haiku 4.5 5efc1155b9 Reorganize design canvas layout to be more compact
- Reduce main gap from gap-8 to gap-4 for tighter vertical spacing
- Put color and size in a 2-column grid layout
- Reduce image dimension section spacing and padding
- Reduce font properties section spacing and padding
- Smaller section headings to save vertical space
- More compact overall layout

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 16:26:03 +01:00
AndymickandClaude Haiku 4.5 10af792261 Remove reviews section from product pages
- Delete Reviews.tsx component
- Remove Reviews from standard product page
- Remove Reviews from made-to-order product page
- Simplify page layout by removing review section

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 16:24:28 +01:00
AndymickandClaude Haiku 4.5 74f9db6501 Remove feedback messages to simplify design canvas layout
- Remove submission status message display
- Remove approval status messages (pending/approved/rejected)
- Keep layout cleaner and more focused on design controls

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 16:23:13 +01:00
AndymickandClaude Haiku 4.5 5c4774be84 Add design approval workflow and per-image dimension tracking
- 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>
2026-07-18 16:21:19 +01:00
AndymickandClaude Haiku 4.5 10764f3a5b Fix JSX syntax errors in DesignCanvas - close bracket issues
- Line 245: Added closing brace for JSX expression in Horizontal Ruler
- Line 289: Added closing brace for JSX expression in Vertical Ruler
- Line 367: Removed extra closing paren before inner ternary else clause

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 16:00:39 +01:00
AndymickandClaude Haiku 4.5 313943aeaa Commit design approval workflow and related features
- 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>
2026-07-18 15:42:30 +01:00
AndymickandClaude Haiku 4.5 14fa3acc7a Add dragging support to curved text with path offset
- Make TextPath draggable
- On drag end, calculate delta (dx, dy) and add to element x/y
- Reset node position to 0 after drag so path offset recalculates
- Path is regenerated with new offset on next render
- Dragging now works smoothly without positioning conflicts

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:42:05 +01:00
AndymickandClaude Haiku 4.5 4807a6f3c3 Fix curved text positioning - bake offsets into path data
- Modify generateCurvePath to accept offsetX/offsetY parameters
- Path data now contains positioning - center at (280 + offsetX, 280 + offsetY)
- Remove confusing x/y/offset properties from TextPath element
- TextPath now renders with position baked into path, no additional positioning
- Curved text renders correctly without interfering with images or other elements
- Curved text not currently draggable (position set at creation time)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:38:59 +01:00
AndymickandClaude Haiku 4.5 5a228c2b08 Add dragging support to curved text
- Add x/y positioning and offset to TextPath for proper dragging
- Make TextPath draggable with onDragEnd handler
- Curved text can now be selected, moved, and toggled without issues
- Uses offset property to handle path-based positioning correctly

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:33:21 +01:00
AndymickandClaude Haiku 4.5 2718004ff4 Revert grid layout and fix curved text rendering
- Revert grid layout changes - boxes now stack vertically as before
- Remove Group wrapper from curved text - was causing image disappearance
- Curved text now renders as simple TextPath with click handlers
- Text can be selected but not dragged (will add dragging back safely later)
- Images should now display correctly when curved text is enabled

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:31:54 +01:00
AndymickandClaude Haiku 4.5 99aa9db6f8 Improve layout - wrap Image and Font Properties boxes in grid
- Add CSS Grid layout to Image Dimensions boxes (2 columns on lg screens)
- Add CSS Grid layout to Font Properties boxes (2 columns on lg screens)
- Boxes now wrap horizontally instead of stretching page vertically
- Mobile-first: stacks vertically on sm/md, wraps to 2 columns on lg+
- Reduces page scroll while keeping all controls accessible

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:29:42 +01:00
AndymickandClaude Haiku 4.5 f90a5adc44 Fix curved text rendering - move positioning to Group
- Move x/y positioning from TextPath to Group wrapper
- TextPath now renders at default position using only path data
- Group handles x/y positioning and dragging
- Remove fontStyle/letterSpacing from TextPath (not needed)
- This should fix text disappearing when curved text is enabled

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:27:34 +01:00
AndymickandClaude Haiku 4.5 8509c1f08f Fix curved text rendering - add x/y positioning and font properties
- Re-add x/y coordinates to TextPath for proper positioning within Group
- Add fontStyle and letterSpacing properties for complete font rendering
- Group remains draggable for movement
- Text content and font should now persist and render correctly when curves enabled

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:24:40 +01:00
AndymickandClaude Haiku 4.5 9f6dcccaa8 Re-add dragging support for curved text via Group wrapper
- Wrap TextPath in Group to enable dragging while preserving text on toggle
- Group handles x/y positioning and drag events
- TextPath is non-listening so Group events take priority
- Curved text can now be selected, dragged, and unchecked without losing content

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:20:36 +01:00
AndymickandClaude Haiku 4.5 6a1f4c7ca1 Fix TextPath positioning - remove x/y coordinates
- TextPath positioning is handled by the path data, not x/y coordinates
- Removed x={el.x} and y={el.y} from TextPath to prevent coordinate corruption
- Removes drag handlers from TextPath since curves are centered on canvas
- Text now properly persists when toggling between curved and straight

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:19:24 +01:00
AndymickandClaude Haiku 4.5 469ea49374 Fix text disappearing when unchecking curved text
- Initialize curvedPath: null when creating text elements
- Ensures all text elements have the curvedPath property from creation
- Prevents text loss when toggling curved text on/off
- Text content is now properly preserved when switching between curved and straight

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:17:39 +01:00
AndymickandClaude Haiku 4.5 8ec34a60c9 Fix curved text selection and dragging
- Remove Group wrapper that was preventing TextPath from receiving click events
- Make TextPath directly draggable and selectable with proper event handlers
- TextPath now supports: clicking to select, dragging to move, position persistence
- Users can now properly interact with curved text on the canvas

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:15:29 +01:00
AndymickandClaude Haiku 4.5 af4f21938d Add draggable curved text support
- Wrap TextPath in Group container to enable dragging of curved text
  Previously curved text couldn't be moved on canvas. Now users can:
  • Add curved text
  • Move it by dragging
  • Update position is saved correctly

- Confirm curved text is per-element: Each text element has its own
  curvedPath property, so you can mix curved and straight text on the
  same design (Font 1: circle, Font 2: wave, Font 3: straight, etc.)

- TextPath uses listening={false} since Group handles all interactions

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:14:11 +01:00
AndymickandClaude Haiku 4.5 859956b9d8 Fix design persistence and enhance font/image property controls
- Fix: Redirect users back to product page after login by passing 'next' parameter
  in LoginPromptModal. Previously users were redirected to /account and lost
  design context. Now they return to where they started (e.g., /made-to-order/
  classic-t-shirt) where design drafts are restored from localStorage.

- Fix: Clear design draft from localStorage only AFTER successful cart addition,
  not immediately. This ensures draft persists if user needs to login mid-design.

- Feature: Add Font Properties boxes (Font 1, Font 2, etc.) similar to Image
  Dimensions. Each text element now displays with editable controls for:
  • Text content
  • Font family (dropdown with all fonts)
  • Font size (slider 10-80pt with display)
  • Text color (color picker)
  • Rotation (slider 0-360 degrees)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 15:09:45 +01:00
AndymickandClaude Haiku 4.5 0e14fc7981 Add reference size fields to product admin editor
- Add referenceWidthCm and referenceHeightCm to ProductDTO
- Update toProductDTO to include reference size fields
- Add reference size inputs to admin product edit page
- Update updateProduct action to handle reference sizes
- Rulers on personalization page use product reference size

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 12:26:16 +01:00
AndymickandClaude Haiku 4.5 740d2bbd29 Remove reference size inputs from personalization page
- Remove Reference Size input fields from customer design page
- Rulers now use product.referenceWidthCm and product.referenceHeightCm
- Reference size is set by admin when editing product (not customer)
- Simplify Add to bag validation - only check for design elements
- Remove reference size state from DesignCanvas component

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 12:24:22 +01:00
AndymickandClaude Haiku 4.5 2595adc305 Add reference size input for custom garment dimensions
- Add Reference Size (cm) section with Width and Height inputs
- Rulers now use reference size instead of product print area dimensions
- Measurements scale to garment size specified by user
- Add to bag button disabled until reference sizes are provided
- Rulers span full canvas and show custom scale (e.g., 0-40cm x 0-60cm)
- Reference size required for personalization checkout

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 12:19:35 +01:00
AndymickandClaude Haiku 4.5 c20c696ccb Fix measurement display and ruler rendering
- Add printAreaWidthMm and printAreaHeightMm to ProductDTO type
- Include these fields in toProductDTO conversion function
- Refactor ruler calculations to use simple for loops
- Rulers now display correctly showing 2cm increments on both axes
- Position & Size panel now shows accurate cm measurements

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 12:08:14 +01:00
AndymickandClaude Haiku 4.5 4658b5a8b8 Fix: Pass product prop to PrintSurface for ruler calculations
- Add product parameter to PrintSurface component props
- Pass product to both front and back PrintSurface calls
- Allows rulers to access product.printAreaWidthMm for cm calculations
- Fixes ReferenceError: product is not defined

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 11:54:05 +01:00
AndymickandClaude Haiku 4.5 11a9305bce Add rulers to design specification sheet for reference
- 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>
2026-07-18 11:51:31 +01:00
AndymickandClaude Haiku 4.5 c60491deca Add rulers and cm measurements to personalization canvas
- Display X and Y rulers with 2cm increments
- Show position and size in centimeters (cm) instead of pixels
- Calculate cmPerPx from product print area for accurate conversion
- Rulers positioned above and to the left of design canvas
- Labels show cm measurements for easy reference while personalizing

Users can now see exact placement and dimensions in cm during design,
with visual ruler guides for precise positioning.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 11:51:07 +01:00
AndymickandClaude Haiku 4.5 209af186b3 Add position and size display to personalization canvas
- Display X and Y coordinates of selected elements
- Show width and height of selected images in pixels
- Add "Position & Size" panel below design controls
- Helps users understand exact placement during design

Users can now see precise measurements while personalizing
instead of guessing or calculating after the fact.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 11:48:28 +01:00
AndymickandClaude Haiku 4.5 5cef95f2c6 Simplify design spec sheet and remove complex measurement calculations
- 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>
2026-07-18 11:47:37 +01:00
AndymickandClaude Haiku 4.5 32c86b246e Fix design placement measurements to match actual garment dimensions
- 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>
2026-07-18 11:43:01 +01:00
AndymickandClaude Haiku 4.5 3975c9964f Fix dimension line positioning to display near design badge
- 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>
2026-07-18 11:38:51 +01:00
AndymickandClaude Haiku 4.5 bacad4efe2 Add technical drawing dimension lines to design specification sheets
- 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>
2026-07-18 11:34:37 +01:00
Andymick c6f041760a Fix measurement conversion formula - correct decimal precision
- 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)
2026-07-18 10:47:59 +01:00
Andymick 58869263bd Fix design spec SVG overlay and decimal point in measurements
- Use preserveAspectRatio='none' to properly scale SVG lines to image
- Fix measurement formula: subtract print area offset, multiply by mmPerPx
- Add axis labels showing 0cm origin points
- Correct decimal precision in all dimension calculations
- Lines now properly overlay on product mockup image
2026-07-18 10:45:02 +01:00
Andymick a1c6e022b8 Fix design spec measurements and add visual X/Y axis guides
- 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
2026-07-18 10:36:51 +01:00
Andymick 4d9cfa4023 Add product dimensions and downloadable design specification sheet
- 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
2026-07-18 10:29:37 +01:00
Andymick ac61d95ac8 Add design element details (size, position, rotation) to order detail page 2026-07-18 10:25:37 +01:00
Andymick ac777efc46 Allow checkout pages to bypass maintenance mode 2026-07-18 10:23:57 +01:00
Andymick bda02c4add Add error handling to success page database queries 2026-07-18 10:23:34 +01:00
Andymick a13be65796 Fix: use personalised pricing for items with design elements at checkout 2026-07-18 10:22:02 +01:00
Andymick 0145f425b1 Add filter to show only personalised orders 2026-07-18 10:13:21 +01:00
Andymick 64b57b8680 Add 'Personalised' badge to orders with custom designs 2026-07-18 10:12:51 +01:00
Andymick 095e8ad459 Add error handling to checkout page database queries 2026-07-18 10:08:08 +01:00
Andymick f6c464372f Disable add to bag button if no personalization added and show prompt message 2026-07-18 10:01:54 +01:00
Andymick 755b7e786d Fix: check both elementsFront and elementsBack for price update 2026-07-18 09:58:40 +01:00
Andymick 0038d792b0 Update 'Add to bag' button price to show personalized price when design elements are added 2026-07-18 09:57:41 +01:00
Andymick a9513e7284 Add 'For personalized design' label to product price 2026-07-18 09:56:11 +01:00
Andymick de06222190 Switch database from SQLite to PostgreSQL 2026-07-18 09:36:53 +01:00
Andymick cee1013a7a Add error handling to customers/mailing list page 2026-07-18 08:54:32 +01:00
Andymick a891acca63 Add error handling to orders page 2026-07-18 08:54:21 +01:00
Andymick 2db94f6bd3 Add error handling to accounts/ledger page 2026-07-18 08:54:04 +01:00
Andymick 3b5d1947dd Add error handling to stock page for Prisma queries 2026-07-18 08:53:05 +01:00
Andymick cf1d40b1c1 Fix color name detection with fuzzy matching, fix checkout syntax errors, add error handling for products page 2026-07-18 08:44:59 +01:00
AndymickandClaude Haiku 4.5 c6850372cb Fix outer try-catch block structure in checkout route
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>
2026-07-18 07:32:47 +01:00
AndymickandClaude Haiku 4.5 52950b7f8e Remove duplicate catch block in checkout route
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 07:24:01 +01:00
AndymickandClaude Haiku 4.5 1481b6e466 Redesign product cards with unique, professional styling
- Split layout: image + info with left border accent
- Product names prominently displayed using serif font
- Unique left border that animates on hover
- Better visual hierarchy and spacing
- Smooth animations (scale, color transitions)
- Clear "Explore" CTA with arrow
- Distinctive design that stands out from generic e-commerce sites

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 07:19:36 +01:00
AndymickandClaude Haiku 4.5 f5fbf1f338 Add hydration safety to AccountMenu
- Add mounted state to prevent hydration mismatches
- Only render component after hydration completes
- Close logout dialog when clicking outside
- Prevent logout dialog from showing unexpectedly

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 07:16:23 +01:00
AndymickandClaude Haiku 4.5 0cafa62713 Fix logout cookie name mismatch
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>
2026-07-18 07:14:40 +01:00
AndymickandClaude Haiku 4.5 345e4b9656 Fix cart clearing on success page
Use empty dependency array to ensure clear() runs once on mount.
Add logging and also clear isCheckingOut flag.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 07:10:17 +01:00
AndymickandClaude Haiku 4.5 24a20d0caa Fix nested try-catch structure in checkout route
Add missing catch and closing brace for outer try block.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 07:08:46 +01:00
AndymickandClaude Haiku 4.5 b7ad243941 Fix syntax error in checkout route - remove extra closing brace
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 07:06:21 +01:00
AndymickandClaude Haiku 4.5 6ca99fa118 Fix cart clearing when navigating to checkout
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>
2026-07-18 07:05:07 +01:00
AndymickandClaude Haiku 4.5 eff9a72409 Improve debug logging for checkout flow
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>
2026-07-18 06:59:59 +01:00
AndymickandClaude Haiku 4.5 7434b68a79 Add debug logging for checkout and LogoutOnUnload
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>
2026-07-18 06:53:56 +01:00
AndymickandClaude Haiku 4.5 4dfbffc9ce Suppress hydration warnings on body element
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>
2026-07-18 06:39:48 +01:00
AndymickandClaude Haiku 4.5 6c1053e985 Add typeof window checks for sessionStorage access in checkout
Prevents ReferenceError when sessionStorage is accessed during SSR or
server-side rendering contexts. Wraps all sessionStorage calls in
typeof window !== 'undefined' checks.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 06:38:01 +01:00
AndymickandClaude Haiku 4.5 570be6430c Add isCheckingOut flag to guest checkout flow
Guest checkout handler was missing the sessionStorage flag that prevents
LogoutOnUnload from clearing cart during Stripe redirect. Adds flag before
API call and removes on error.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 06:28:47 +01:00
AndymickandClaude Haiku 4.5 eda518d1be Fix cart clearing during Stripe checkout redirect
Use sessionStorage flag to prevent LogoutOnUnload from clearing cart and logging
out when navigating to Stripe checkout.

Changes:
- Checkout button sets 'isCheckingOut' flag in sessionStorage before API call
- LogoutOnUnload checks this flag and skips logout if checkout in progress
- Flag is removed if API returns an error
- Flag persists during navigation to Stripe URL

This ensures cart and login persist through Stripe payment flow.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 06:25:30 +01:00
AndymickandClaude Haiku 4.5 017b68f17b Fix React hydration mismatch errors
Add suppressHydrationWarning to html element to prevent hydration mismatch
caused by theme script setting dark class before React hydration completes.

The hydration errors were preventing checkout and other interactive features
from working properly. This tells React to ignore the mismatch on the html
element since we intentionally modify it before hydration.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 06:18:02 +01:00
AndymickandClaude Haiku 4.5 3d48e4d545 Add comprehensive logging to debug checkout issues
Added console.log statements to track:
- Client: API response status, data, and errors
- Server: Stripe configuration check, rate limiting, order creation, Stripe session creation

This will help identify exactly where the checkout flow is failing.

Check browser console for client-side errors and server logs for API errors.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 06:13:15 +01:00
AndymickandClaude Haiku 4.5 c9f5626984 Fix checkout loop by preventing logout during Stripe navigation
Critical fix: Don't clear cart or logout when navigating to Stripe checkout.

The issue was:
1. User clicks 'Continue to payment'
2. API call to /api/checkout succeeds
3. Client redirects to Stripe URL with window.location.href
4. This triggers beforeunload event
5. LogoutOnUnload component logs out and clears cart
6. User is logged out and cart is empty during checkout

Solution:
- Detect when /api/checkout is being called
- Set isCheckingOut flag
- Skip logout/cart-clear in beforeunload if checkout in progress
- User stays logged in and cart persists through Stripe flow

This allows logout on browser close but not during payment navigation.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 06:11:25 +01:00
AndymickandClaude Haiku 4.5 15e1f92490 Ensure session cookies are properly cleared on logout
Fix session persistence issue by:
- Using cookies().delete() method for both adminSession and session
- Adding explicit Set-Cookie headers with Max-Age=0 to force browser deletion
- This ensures cookies are cleared both via Next.js API and HTTP headers

Previously, sendBeacon logout calls weren't reliably deleting session cookies,
causing users to remain logged in after closing/reopening the browser.

This double approach ensures the cookies are removed from the browser cache.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-18 06:09:17 +01:00