From 5338505bfc265a225c88bc7fe91a36e190fa9c80 Mon Sep 17 00:00:00 2001 From: shafi54 <108669266+shafi-aviz@users.noreply.github.com> Date: Tue, 21 Jul 2026 10:07:27 +0530 Subject: [PATCH] Update floating-cart-bar.tsx --- apps/user-ui/components/floating-cart-bar.tsx | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/user-ui/components/floating-cart-bar.tsx b/apps/user-ui/components/floating-cart-bar.tsx index fff1dc8..044e055 100644 --- a/apps/user-ui/components/floating-cart-bar.tsx +++ b/apps/user-ui/components/floating-cart-bar.tsx @@ -29,6 +29,13 @@ import { LinearGradient } from "expo-linear-gradient"; const { height: screenHeight } = Dimensions.get("window"); +const formatQuantity = (quantity: number, unit: string): { value: string; display: string } => { + if (unit?.toLowerCase() === 'kg' && quantity < 1) { + return { value: `${Math.round(quantity * 1000)} g`, display: `${Math.round(quantity * 1000)}g` }; + } + return { value: `${quantity} ${unit}(s)`, display: `${quantity}${unit}` }; +}; + interface FloatingCartBarProps { isFlashDelivery?: boolean; isExpanded?: boolean; @@ -259,10 +266,15 @@ const FloatingCartBar: React.FC = ({ - + + + + {formatQuantity(productsById[item.productId]?.productQuantity || 1, productsById[item.productId]?.unitNotation || '').display} + + @@ -283,7 +295,7 @@ const FloatingCartBar: React.FC = ({ }} step={productsById[item.productId]?.incrementStep || 1} showUnits={true} - unit={productsById[item.productId]?.unitNotation} + // unit={productsById[item.productId]?.unitNotation} />