Merge branch 'fix/consistent-complete-package-cart-ui' into fix/standardized-phone-validation-and-billing

This commit is contained in:
Urvish Prajapati 2026-11-11 12:57:46 +05:30
commit 62c7a4aead
1 changed files with 48 additions and 29 deletions

View File

@ -113,36 +113,55 @@ export const CartDrawer: React.FC<CartDrawerProps> = ({
</div>
) : (
<div className="space-y-3 max-h-[220px] overflow-y-auto pr-1">
{cart.map((item) => (
<div
key={item.code}
className="flex justify-between items-center gap-4 bg-slate-50 border border-slate-200/60 p-3 rounded-2xl"
>
<div className="flex-1 min-w-0">
<p className="text-xs font-bold text-slate-800 truncate">{item.name}</p>
<p className="text-[9px] text-slate-400 tracking-wider uppercase font-semibold">{item.category}</p>
{cart.map((item) => {
const isCompletePackage =
item.code === 'POINTS_PACK' ||
item.code === 'PATTERN_CORE' ||
item.code === 'NUTRITION_CORE' ||
item.code === 'THERAPEUTICS_CORE' ||
item.name.toLowerCase().includes('complete pack') ||
item.name.toLowerCase().includes('complete package') ||
item.name.toLowerCase().includes('complete bundle') ||
item.category === 'Bundle';
return (
<div
key={item.code}
className="flex justify-between items-center gap-4 bg-slate-50 border border-slate-200/60 p-3 rounded-2xl"
>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-1.5 flex-wrap min-w-0">
<p className="text-xs font-bold text-slate-800 truncate">{item.name}</p>
{isCompletePackage && (
<span className="text-[8px] bg-gradient-to-r from-indigo-500 to-purple-600 text-white font-extrabold px-1.5 py-0.5 rounded tracking-wider uppercase flex-shrink-0">
Complete Pack
</span>
)}
</div>
<p className="text-[9px] text-slate-400 tracking-wider uppercase font-semibold">{item.category}</p>
</div>
<div className="flex items-center gap-3">
<span className="text-xs font-bold text-indigo-600">
{(() => {
const calculatedItem = activePricing?.cart_items?.find((ci: any) => ci.code === item.code);
const price = calculatedItem
? calculatedItem.price
: (currency === 'INR' ? item.priceInr : currency === 'EUR' ? item.priceEur : item.priceUsd);
const symbol = currency === 'INR' ? '₹' : currency === 'EUR' ? '€' : '$';
return `${symbol}${price}`;
})()}
</span>
<button
onClick={() => toggleCartItem(item)}
className="h-7 w-7 rounded-lg bg-rose-50 text-rose-500 hover:bg-rose-100 flex items-center justify-center transition-colors"
title="Remove item"
>
<Trash2 className="h-3.5 w-3.5" />
</button>
</div>
</div>
<div className="flex items-center gap-3">
<span className="text-xs font-bold text-indigo-600">
{(() => {
const calculatedItem = activePricing?.cart_items?.find((ci: any) => ci.code === item.code);
const price = calculatedItem
? calculatedItem.price
: (currency === 'INR' ? item.priceInr : currency === 'EUR' ? item.priceEur : item.priceUsd);
const symbol = currency === 'INR' ? '₹' : currency === 'EUR' ? '€' : '$';
return `${symbol}${price}`;
})()}
</span>
<button
onClick={() => toggleCartItem(item)}
className="h-7 w-7 rounded-lg bg-rose-50 text-rose-500 hover:bg-rose-100 flex items-center justify-center transition-colors"
title="Remove item"
>
<Trash2 className="h-3.5 w-3.5" />
</button>
</div>
</div>
))}
);
})}
</div>
)}