bug fixed

This commit is contained in:
Malini 2026-02-20 17:22:41 +05:30
parent 52df438da4
commit 4db00f84fd

View File

@ -1162,9 +1162,7 @@ const EditCompanyProfile = () => {
if (productLimitMessage) return null;
if (checkedCountTotal >= MAX_TOTAL_SELECTED_PRODUCTS || allowedAddCount === 0) {
return (
<p className="text-xs text-[#B91C1C] mt-1">Maximum of {MAX_TOTAL_SELECTED_PRODUCTS} products can be selected.</p>
);
return null;
}
if (newlyAddedCheckedCount >= allowedAddCount) {
@ -1293,12 +1291,33 @@ const EditCompanyProfile = () => {
<h5 className="text-sm font-medium text-[#111827]">Selected Products</h5>
<div className="flex items-center gap-2">
<span className="bg-[#FEF3C7] text-[#92400E] text-xs font-medium px-2 py-0.5 rounded-full">
{selectedProducts.filter(p => checkedProducts.has(p.value || p.id || p.product_id)).length}/15 selected
</span>
{(() => {
const checkedCount = selectedProducts.filter(p => checkedProducts.has(p.value || p.id || p.product_id)).length;
const isMaxReached = checkedCount >= 15;
return (
<span
className={`text-xs font-medium px-2 py-0.5 rounded-full ${
isMaxReached
? 'bg-[#FEE2E2] text-[#B91C1C]'
: 'bg-[#FEF3C7] text-[#92400E]'
}`}
>
{checkedCount}/15 selected
</span>
);
})()}
</div>
</div>
{selectedProducts.filter(p => checkedProducts.has(p.value || p.id || p.product_id)).length >= 15 && (
<div className="px-4 pt-3">
<div className="border border-[#FCA5A5] bg-[#FEF2F2] text-[#B91C1C] rounded-md px-3 py-2 text-xs">
Maximum limit of 15 products reached. Remove a product to add another.
</div>
</div>
)}
<div className="p-4">
{selectedProducts.length > 0 ? (
<ul className="divide-y divide-[#E5E7EB] max-h-96 overflow-y-auto">