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"}