Overview
New graphics step enabling users to upload team logos, sponsor graphics, and badges directly to the uniform builder. Files are uploaded to AWS S3 via pre-signed URLs and rendered on the 2D/3D canvas with full control over placement, dimensions, rotation, and layer ordering.
Features
Source Tabs
- Brand Library - Placeholder for future database-backed brand assets
- Team Upload - Functional drag-and-drop / click-to-upload zone with S3 integration
- Library - Placeholder for shared asset library (badges, sponsors)
File Upload
- Drag & Drop - Drop files directly onto the upload zone
- Click to Upload - Standard file picker fallback
- Accepted Formats - SVG, PNG, and JPG files
- Upload Progress - Spinner animation during upload with disabled interaction
- Error Handling - Inline error banner with dismiss action for failed uploads
- Parallel Processing - S3 upload and local image dimension detection run concurrently via
Promise.all
Graphic Item Properties
- Graphic Type - Categorize as Logo, Sponsor, or Badge
- Thumbnail Preview - Shows uploaded image in both the card trigger and expanded content
- File Name Display - Truncated file name in the collapsible trigger
Dimensions & Aspect Ratio
- Width / Height - Numeric inputs in millimeters
- Aspect Ratio Lock - Toggle button locks/unlocks proportional resizing
- Auto-Detection - Raster image dimensions detected locally via
createObjectURLand converted to approximate mm values - Unit Conversion -
dimensionToPx()andmmToPx()convert mm/inch to canvas pixels in 2048x2048 space
Placement & Layout
- 7 Placement Presets - Chest (center / left / right), Back, Back (top), Sleeve (left / right)
- Alignment - Left, center, or right within the placement zone
- Rotation - -360 to +360 degree rotation control
- Canonical Coordinate Mapping -
graphics-placement.tsmaps presets to (x, y) positions
Layer Ordering
- Bring Forward / Send Backward - Reorder graphics in the z-stack
- Layer Indicator - Shows current layer position (e.g. "Layer 2 of 3")
- Array-Based Z-Index - Later items in the array render on top
SVG Color Override
- Color Mode - Original or Single Color (SVG only)
- Fill Color - Color tabs picker appears when single-color mode is active on SVG assets
Technical Details
Component Structure
GraphicsStepmanages the field array and upload stateGraphicItemCardrenders individual graphic controls withuseWatchfor live trigger updatesuseS3Uploadhook handles the browser-to-S3 upload flowgraphics-placement.tsprovides coordinate mapping utilities
Upload Pipeline
- User drops/selects a file
- MIME type validated against allowed formats
useS3UploadPOSTs to/api/upload/presigned-urlfor a pre-signed URL- Browser PUTs the file directly to S3 (no server proxy)
- Public URL returned and stored in the form field
- Raster dimensions detected locally in parallel for default sizing