From 8cd2145f0647d408932a32f0bae09b085d898015 Mon Sep 17 00:00:00 2001 From: mihir Date: Thu, 26 Nov 2026 12:42:50 +0530 Subject: [PATCH] feat: show product photos and let staff upload them Catalog cards show each product's main photo and product pages show the gallery. Admin catalog adds a Photos panel to upload (JPEG/PNG/WebP, 2 MiB, up to 8) and remove photos. Nginx allows the upload size on the new route. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- deploy/nginx-locations.conf | 2 +- nginx.conf | 2 +- src/components/Catalog.tsx | 18 +- src/lib/api.ts | 8 + src/lib/commerce.ts | 18 ++ src/pages/CatalogAdminPage.tsx | 56 +++++- src/pages/ProductPage.tsx | 14 +- src/pages/products.css | 350 +++++++++++++++++---------------- test/product-images.test.ts | 24 +++ 10 files changed, 312 insertions(+), 182 deletions(-) create mode 100644 test/product-images.test.ts diff --git a/README.md b/README.md index 5c11df4..2e892ce 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ docker run --rm -p 8080:80 manicandles-frontend:uat After the one-time [server setup](docs/STATIC-DEPLOYMENT.md), main-branch Drone pushes upload the checked static build over SSH and activate it through the existing Nginx HTTPS site. Readiness failure restores the previous release. Drone requires the `manicandles_deploy_key` secret. Feature branches run validation without uploading or activating a release. -Storefront list returns only id/name/slug; details return prices/attributes/groups. The API has no product-media fields, so catalog cards use a generic branded placeholder rather than assigning local photos to unknown records. Existing marketing imagery remains intact. +Storefront list returns id/name/slug and the main photo; details return prices/attributes/groups and all photos. Staff upload up to 8 JPEG/PNG/WebP photos per product (2 MiB each) under Admin catalog; products without photos show a branded placeholder. Existing marketing imagery remains intact. Addresses, cart/checkout, orders, catalog, access, stock, coupons and pricing tools are available after sign-in. Customers can create their own account at `/workspace` (requires the backend `/auth/register` endpoint). There is no contact-message endpoint; simulated success was replaced with an availability notice. Newsletter signup awaits consent/messaging flows. diff --git a/deploy/nginx-locations.conf b/deploy/nginx-locations.conf index 477114f..2633283 100644 --- a/deploy/nginx-locations.conf +++ b/deploy/nginx-locations.conf @@ -23,7 +23,7 @@ location /api/ { proxy_hide_header Access-Control-Allow-Origin; proxy_hide_header Access-Control-Allow-Credentials; - location ~ "^/api/v1/(?:supplier-documents|b2b/artworks)/[0-9a-fA-F-]{36}/versions$" { + location ~ "^/api/v1/(?:(?:supplier-documents|b2b/artworks)/[0-9a-fA-F-]{36}/versions|products/[0-9a-fA-F-]{36}/images)$" { client_max_body_size 3m; proxy_pass https://manicandles-backend.midastix.com; } diff --git a/nginx.conf b/nginx.conf index 1915496..19d5bea 100644 --- a/nginx.conf +++ b/nginx.conf @@ -23,7 +23,7 @@ server { proxy_hide_header Access-Control-Allow-Origin; proxy_hide_header Access-Control-Allow-Credentials; - location ~ "^/api/v1/(?:supplier-documents|b2b/artworks)/[0-9a-fA-F-]{36}/versions$" { + location ~ "^/api/v1/(?:(?:supplier-documents|b2b/artworks)/[0-9a-fA-F-]{36}/versions|products/[0-9a-fA-F-]{36}/images)$" { client_max_body_size 3m; proxy_pass https://manicandles-backend.midastix.com; } diff --git a/src/components/Catalog.tsx b/src/components/Catalog.tsx index 13e8285..954c953 100644 --- a/src/components/Catalog.tsx +++ b/src/components/Catalog.tsx @@ -4,7 +4,7 @@ import Alert from "@mui/material/Alert"; import Button from "@mui/material/Button"; import Skeleton from "@mui/material/Skeleton"; import { Flame } from "lucide-react"; -import { listProducts } from "@/lib/api"; +import { listProducts, productImageUrl } from "@/lib/api"; import { usePlatform } from "@/lib/platform"; import { ApiNotice } from "./ApiNotice"; import "@/pages/products.css"; @@ -75,11 +75,21 @@ export function Catalog({
-