From a18b71319edd9531aec5b6ffebfab851f28d94d7 Mon Sep 17 00:00:00 2001 From: Xor290 Date: Wed, 4 Mar 2026 17:03:08 +0100 Subject: [PATCH] chore: fix unit --- mobile/src/api/api_types.ts | 1 + mobile/src/components/ProductCard.tsx | 3 ++- mobile/src/screens/client/ProductDetailScreen.tsx | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mobile/src/api/api_types.ts b/mobile/src/api/api_types.ts index 847c3ebb..39e482ff 100644 --- a/mobile/src/api/api_types.ts +++ b/mobile/src/api/api_types.ts @@ -366,6 +366,7 @@ export interface Product { description?: string; category: string; stock: number; + unit?: string; prices?: ProductPrice[]; media?: Array<{ // ✅ CHANGÉ diff --git a/mobile/src/components/ProductCard.tsx b/mobile/src/components/ProductCard.tsx index 00677d36..a118fd61 100644 --- a/mobile/src/components/ProductCard.tsx +++ b/mobile/src/components/ProductCard.tsx @@ -27,6 +27,7 @@ interface ProductCardProps { name: string; category: string; stock: number; + unit?: string; prices?: Array<{ quantity: number; price: number }>; media?: Array<{ url: string; type: string }>; }; @@ -289,7 +290,7 @@ export default function ProductCard({ product, onPress }: ProductCardProps) { { color: colors.textWhite }, ]} > - {p.quantity}g + {p.quantity}{product.unit || "g"} {selectedPrice.toFixed(2)} €{" "} - {selectedGrams && `pour ${selectedGrams}g`} + {selectedGrams && `pour ${selectedGrams}${product.unit || "g"}`} )} @@ -557,7 +557,7 @@ export default function ProductDetailScreen() { > {selectedGrams !== null - ? `${selectedGrams}g - ${selectedPrice.toFixed(2)} €` + ? `${selectedGrams}${product.unit || "g"} - ${selectedPrice.toFixed(2)} €` : "Choisir une quantite"} - {p.quantity}g + {p.quantity}{product.unit || "g"}