741 lines
40 KiB
TypeScript
741 lines
40 KiB
TypeScript
import React from 'react';
|
|
import { BookOpen, Check } from 'lucide-react';
|
|
import type { ModuleItem, PublicPlan, Currency } from '../../types';
|
|
|
|
interface CatalogSectionProps {
|
|
curriculumModules: ModuleItem[];
|
|
publicPlans: PublicPlan[];
|
|
cart: ModuleItem[];
|
|
currency: Currency;
|
|
isModuleUnlocked: (code: string) => boolean;
|
|
getModulePrice: (item: ModuleItem) => {
|
|
priceInr: number;
|
|
priceUsd: number;
|
|
priceEur: number;
|
|
isActive: boolean;
|
|
};
|
|
toggleCartItem: (module: ModuleItem) => void;
|
|
showLockedByCategory: { [key: string]: boolean };
|
|
setShowLockedByCategory: React.Dispatch<React.SetStateAction<{ [key: string]: boolean }>>;
|
|
}
|
|
|
|
export const CatalogSection: React.FC<CatalogSectionProps> = ({
|
|
curriculumModules,
|
|
publicPlans,
|
|
cart,
|
|
currency,
|
|
isModuleUnlocked,
|
|
getModulePrice,
|
|
toggleCartItem,
|
|
showLockedByCategory,
|
|
setShowLockedByCategory,
|
|
}) => {
|
|
return (
|
|
<div className="xl:col-span-2 space-y-6">
|
|
<div className="space-y-2">
|
|
<div className="inline-flex items-center gap-1.5 bg-cyan-50 border border-cyan-200 text-cyan-700 text-xs px-3 py-1 rounded-full font-semibold">
|
|
<BookOpen className="h-3.5 w-3.5 animate-pulse" /> Mobile App Curriculum Catalog
|
|
</div>
|
|
<h2 className="text-3xl font-extrabold text-slate-900 tracking-tight">Unlock Professional TCM Modules</h2>
|
|
<p className="text-slate-500 max-w-2xl text-sm leading-relaxed font-semibold">
|
|
Unlock acupoint maps, organ syndrome references, and advanced dietetics. Entitling your login grants instant synchronization on your TCM iOS/Android app.
|
|
</p>
|
|
</div>
|
|
|
|
{/* 5 Premium Modules Structured Catalog */}
|
|
<div className="md:columns-2 columns-1 gap-6 space-y-6">
|
|
|
|
{/* CARD 1: Points Reference Module */}
|
|
<div className="rounded-3xl p-6 bg-white border border-slate-200/80 shadow-sm flex flex-col space-y-4 break-inside-avoid">
|
|
<div className="space-y-2">
|
|
<div className="flex justify-between items-center gap-2">
|
|
<div className="flex items-center gap-1.5 min-w-0">
|
|
<span className="text-[10px] bg-blue-50 text-blue-600 border border-blue-200 font-bold tracking-wider uppercase px-2 py-0.5 rounded-md whitespace-nowrap shrink-0">
|
|
Points
|
|
</span>
|
|
<button
|
|
onClick={() => setShowLockedByCategory(prev => ({ ...prev, Points: !prev.Points }))}
|
|
className="text-[9px] bg-slate-100 hover:bg-slate-200 text-slate-700 border border-slate-200 font-bold px-1.5 py-0.5 rounded transition-colors whitespace-nowrap shrink-0"
|
|
>
|
|
{showLockedByCategory.Points ? 'Hide Locked' : 'Show Locked'} ({curriculumModules.filter(m => m.category === 'Points' && !isModuleUnlocked(m.code)).length})
|
|
</button>
|
|
</div>
|
|
<span className="text-[10px] bg-slate-100/80 text-slate-500 border border-slate-200/70 font-extrabold uppercase tracking-wider px-2 py-0.5 rounded-md whitespace-nowrap shrink-0">
|
|
1-Year Access
|
|
</span>
|
|
</div>
|
|
<h3 className="text-lg font-bold text-slate-800">Points Reference Module</h3>
|
|
<p className="text-xs text-slate-500 leading-relaxed font-semibold">
|
|
Unlock high-definition acupuncture point mapping tables and clinical micro-systems.
|
|
</p>
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
{(() => {
|
|
const items = curriculumModules.filter(m => m.category === 'Points');
|
|
const visible = items.filter(sub => {
|
|
const isUnlocked = isModuleUnlocked(sub.code);
|
|
const live = getModulePrice(sub);
|
|
if (!isUnlocked && !live.isActive) return false;
|
|
if (!isUnlocked && !showLockedByCategory.Points) return false;
|
|
return true;
|
|
});
|
|
|
|
if (visible.length === 0) {
|
|
return (
|
|
<div className="py-6 text-center border border-dashed border-slate-200 rounded-2xl bg-slate-50/50">
|
|
<p className="text-xs text-slate-500 font-medium">Locked modules are currently hidden.</p>
|
|
<button
|
|
type="button"
|
|
onClick={() => setShowLockedByCategory(prev => ({ ...prev, Points: true }))}
|
|
className="mt-1 text-xs text-blue-600 hover:text-blue-700 font-bold hover:underline cursor-pointer"
|
|
>
|
|
Click here to show locked modules
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return visible.map((sub) => {
|
|
const isUnlocked = isModuleUnlocked(sub.code);
|
|
const isInCart = cart.some(item => item.code === sub.code);
|
|
const live = getModulePrice(sub);
|
|
|
|
return (
|
|
<div
|
|
key={`${sub.code}-${sub.name}`}
|
|
onClick={() => {
|
|
if (isUnlocked || !live.isActive) return;
|
|
toggleCartItem(sub);
|
|
}}
|
|
className={`flex justify-between items-center p-3 rounded-2xl border transition-all duration-300 select-none ${
|
|
isUnlocked
|
|
? 'border-emerald-100 bg-emerald-50/20 cursor-default'
|
|
: !live.isActive
|
|
? 'border-slate-100 bg-slate-50/50 opacity-60 cursor-not-allowed'
|
|
: isInCart
|
|
? 'border-indigo-400 bg-indigo-50/20 shadow-sm cursor-pointer'
|
|
: 'border-slate-100 bg-slate-50/80 hover:border-slate-300 cursor-pointer'
|
|
}`}
|
|
>
|
|
<div className="flex-1 pr-2">
|
|
<div className="flex items-center gap-1.5 flex-wrap">
|
|
<span className="text-xs font-bold text-slate-800">{sub.name.replace("Points: ", "")}</span>
|
|
{sub.code === 'POINTS_PACK' && (
|
|
<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">
|
|
Complete Pack
|
|
</span>
|
|
)}
|
|
{!isUnlocked && !live.isActive && (
|
|
<span className="text-[8px] bg-slate-200 text-slate-600 font-bold px-1.5 py-0.5 rounded tracking-wider uppercase">
|
|
Temporarily Unavailable
|
|
</span>
|
|
)}
|
|
</div>
|
|
<p className="text-[10px] text-slate-400 font-semibold mt-0.5 leading-tight">
|
|
{sub.desc.replace(/1 Year:\s*/i, '')}
|
|
</p>
|
|
</div>
|
|
|
|
<div className="flex items-center gap-3 flex-shrink-0">
|
|
{isUnlocked ? (
|
|
<span className="text-[10px] bg-emerald-50 text-emerald-700 font-extrabold tracking-wider px-2 py-0.5 rounded border border-emerald-200 flex items-center gap-0.5 shadow-sm">
|
|
<Check className="h-2.5 w-2.5" /> UNLOCKED
|
|
</span>
|
|
) : !live.isActive ? (
|
|
<span className="text-[10px] bg-slate-100 text-slate-400 font-bold tracking-wider px-2 py-0.5 rounded border border-slate-200">
|
|
INACTIVE
|
|
</span>
|
|
) : (
|
|
<span className="text-xs font-extrabold text-slate-700">
|
|
{currency === 'INR' ? `₹${live.priceInr}` : currency === 'EUR' ? `€${live.priceEur}` : `$${live.priceUsd}`}
|
|
</span>
|
|
)}
|
|
{!isUnlocked && live.isActive && (
|
|
<div className={`h-4.5 w-4.5 rounded-full border flex items-center justify-center transition-all duration-300 ${isInCart ? 'bg-indigo-600 border-indigo-500' : 'border-slate-300'}`}>
|
|
{isInCart && <div className="h-1.5 w-1.5 rounded-full bg-white" />}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
});
|
|
})()}
|
|
</div>
|
|
</div>
|
|
|
|
{/* CARD 2: Pattern Diagnosis Module */}
|
|
<div className="rounded-3xl p-6 bg-white border border-slate-200/80 shadow-sm flex flex-col space-y-4 break-inside-avoid">
|
|
<div className="space-y-2">
|
|
<div className="flex justify-between items-center gap-2">
|
|
<div className="flex items-center gap-1.5 min-w-0">
|
|
<span className="text-[10px] bg-rose-50 text-rose-600 border border-rose-200 font-bold tracking-wider uppercase px-2 py-0.5 rounded-md whitespace-nowrap shrink-0">
|
|
Pattern
|
|
</span>
|
|
<button
|
|
onClick={() => setShowLockedByCategory(prev => ({ ...prev, Pattern: !prev.Pattern }))}
|
|
className="text-[9px] bg-slate-100 hover:bg-slate-200 text-slate-700 border border-slate-200 font-bold px-1.5 py-0.5 rounded transition-colors whitespace-nowrap shrink-0"
|
|
>
|
|
{showLockedByCategory.Pattern ? 'Hide Locked' : 'Show Locked'} ({curriculumModules.filter(m => (m.category === 'Pattern' || m.category === 'Patterns') && !isModuleUnlocked(m.code)).length})
|
|
</button>
|
|
</div>
|
|
<span className="text-[10px] bg-slate-100/80 text-slate-500 border border-slate-200/70 font-extrabold uppercase tracking-wider px-2 py-0.5 rounded-md whitespace-nowrap shrink-0">
|
|
1-Year Access
|
|
</span>
|
|
</div>
|
|
<h3 className="text-lg font-bold text-slate-800">Pattern Diagnosis Module</h3>
|
|
<p className="text-xs text-slate-500 leading-relaxed font-semibold">
|
|
Full comprehensive study of professional TCM syndrome differentiation methodologies.
|
|
</p>
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
{(() => {
|
|
const items = curriculumModules.filter(m => m.category === 'Pattern' || m.category === 'Patterns');
|
|
const visible = items.filter(sub => {
|
|
const isUnlocked = isModuleUnlocked(sub.code);
|
|
const live = getModulePrice(sub);
|
|
if (!isUnlocked && !live.isActive) return false;
|
|
if (!isUnlocked && !showLockedByCategory.Pattern) return false;
|
|
return true;
|
|
});
|
|
|
|
if (visible.length === 0) {
|
|
return (
|
|
<div className="py-6 text-center border border-dashed border-slate-200 rounded-2xl bg-slate-50/50">
|
|
<p className="text-xs text-slate-500 font-medium">Locked modules are currently hidden.</p>
|
|
<button
|
|
type="button"
|
|
onClick={() => setShowLockedByCategory(prev => ({ ...prev, Pattern: true }))}
|
|
className="mt-1 text-xs text-rose-600 hover:text-rose-700 font-bold hover:underline cursor-pointer"
|
|
>
|
|
Click here to show locked modules
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return visible.map((sub) => {
|
|
const isUnlocked = isModuleUnlocked(sub.code);
|
|
const isInCart = cart.some(item => item.code === sub.code);
|
|
const live = getModulePrice(sub);
|
|
|
|
return (
|
|
<div
|
|
key={`${sub.code}-${sub.name}`}
|
|
onClick={() => {
|
|
if (isUnlocked || !live.isActive) return;
|
|
toggleCartItem(sub);
|
|
}}
|
|
className={`flex justify-between items-center p-3 rounded-2xl border transition-all duration-300 select-none ${
|
|
isUnlocked
|
|
? 'border-emerald-100 bg-emerald-50/20 cursor-default'
|
|
: !live.isActive
|
|
? 'border-slate-100 bg-slate-50/50 opacity-60 cursor-not-allowed'
|
|
: isInCart
|
|
? 'border-indigo-400 bg-indigo-50/20 shadow-sm cursor-pointer'
|
|
: 'border-slate-100 bg-slate-50/80 hover:border-slate-300 cursor-pointer'
|
|
}`}
|
|
>
|
|
<div className="flex-1 pr-2">
|
|
<div className="flex items-center gap-1.5 flex-wrap">
|
|
<span className="text-xs font-bold text-slate-800">{sub.name}</span>
|
|
{!isUnlocked && !live.isActive && (
|
|
<span className="text-[8px] bg-slate-200 text-slate-600 font-bold px-1.5 py-0.5 rounded tracking-wider uppercase">
|
|
Temporarily Unavailable
|
|
</span>
|
|
)}
|
|
</div>
|
|
<p className="text-[10px] text-slate-400 font-semibold mt-0.5 leading-tight">
|
|
{sub.desc.replace(/1 Year:\s*/i, '')}
|
|
</p>
|
|
</div>
|
|
|
|
<div className="flex items-center gap-3 flex-shrink-0">
|
|
{isUnlocked ? (
|
|
<span className="text-[10px] bg-emerald-50 text-emerald-700 font-extrabold tracking-wider px-2 py-0.5 rounded border border-emerald-200 flex items-center gap-0.5 shadow-sm">
|
|
<Check className="h-2.5 w-2.5" /> UNLOCKED
|
|
</span>
|
|
) : !live.isActive ? (
|
|
<span className="text-[10px] bg-slate-100 text-slate-400 font-bold tracking-wider px-2 py-0.5 rounded border border-slate-200">
|
|
INACTIVE
|
|
</span>
|
|
) : (
|
|
<span className="text-xs font-extrabold text-slate-700">
|
|
{currency === 'INR' ? `₹${live.priceInr}` : currency === 'EUR' ? `€${live.priceEur}` : `$${live.priceUsd}`}
|
|
</span>
|
|
)}
|
|
{!isUnlocked && live.isActive && (
|
|
<div className={`h-4.5 w-4.5 rounded-full border flex items-center justify-center transition-all duration-300 ${isInCart ? 'bg-indigo-600 border-indigo-500' : 'border-slate-300'}`}>
|
|
{isInCart && <div className="h-1.5 w-1.5 rounded-full bg-white" />}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
});
|
|
})()}
|
|
</div>
|
|
</div>
|
|
|
|
{/* CARD 3: TCM Nutrition & Dietetics */}
|
|
<div className="rounded-3xl p-6 bg-white border border-slate-200/80 shadow-sm flex flex-col space-y-4 break-inside-avoid">
|
|
<div className="space-y-2">
|
|
<div className="flex justify-between items-center gap-2">
|
|
<div className="flex items-center gap-1.5 min-w-0">
|
|
<span className="text-[10px] bg-emerald-50 text-emerald-600 border border-emerald-200 font-bold tracking-wider uppercase px-2 py-0.5 rounded-md whitespace-nowrap shrink-0">
|
|
Nutrition
|
|
</span>
|
|
<button
|
|
onClick={() => setShowLockedByCategory(prev => ({ ...prev, Nutrition: !prev.Nutrition }))}
|
|
className="text-[9px] bg-slate-100 hover:bg-slate-200 text-slate-700 border border-slate-200 font-bold px-1.5 py-0.5 rounded transition-colors whitespace-nowrap shrink-0"
|
|
>
|
|
{showLockedByCategory.Nutrition ? 'Hide Locked' : 'Show Locked'} ({curriculumModules.filter(m => m.category === 'Nutrition' && !isModuleUnlocked(m.code)).length})
|
|
</button>
|
|
</div>
|
|
<span className="text-[10px] bg-slate-100/80 text-slate-500 border border-slate-200/70 font-extrabold uppercase tracking-wider px-2 py-0.5 rounded-md whitespace-nowrap shrink-0">
|
|
1-Year Access
|
|
</span>
|
|
</div>
|
|
<h3 className="text-lg font-bold text-slate-800">TCM Nutrition & Dietetics</h3>
|
|
<p className="text-xs text-slate-500 leading-relaxed font-semibold">
|
|
Thermal nature, five-flavor dynamics, and clinical organ dietary prescriptions.
|
|
</p>
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
{(() => {
|
|
const items = curriculumModules.filter(m => m.category === 'Nutrition');
|
|
const visible = items.filter(sub => {
|
|
const isUnlocked = isModuleUnlocked(sub.code);
|
|
const live = getModulePrice(sub);
|
|
if (!isUnlocked && !live.isActive) return false;
|
|
if (!isUnlocked && !showLockedByCategory.Nutrition) return false;
|
|
return true;
|
|
});
|
|
|
|
if (visible.length === 0) {
|
|
return (
|
|
<div className="py-6 text-center border border-dashed border-slate-200 rounded-2xl bg-slate-50/50">
|
|
<p className="text-xs text-slate-500 font-medium">Locked modules are currently hidden.</p>
|
|
<button
|
|
type="button"
|
|
onClick={() => setShowLockedByCategory(prev => ({ ...prev, Nutrition: true }))}
|
|
className="mt-1 text-xs text-emerald-600 hover:text-emerald-700 font-bold hover:underline cursor-pointer"
|
|
>
|
|
Click here to show locked modules
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return visible.map((sub) => {
|
|
const isUnlocked = isModuleUnlocked(sub.code);
|
|
const isInCart = cart.some(item => item.code === sub.code);
|
|
const live = getModulePrice(sub);
|
|
|
|
return (
|
|
<div
|
|
key={`${sub.code}-${sub.name}`}
|
|
onClick={() => {
|
|
if (isUnlocked || !live.isActive) return;
|
|
toggleCartItem(sub);
|
|
}}
|
|
className={`flex justify-between items-center p-3 rounded-2xl border transition-all duration-300 select-none ${
|
|
isUnlocked
|
|
? 'border-emerald-100 bg-emerald-50/20 cursor-default'
|
|
: !live.isActive
|
|
? 'border-slate-100 bg-slate-50/50 opacity-60 cursor-not-allowed'
|
|
: isInCart
|
|
? 'border-indigo-400 bg-indigo-50/20 shadow-sm cursor-pointer'
|
|
: 'border-slate-100 bg-slate-50/80 hover:border-slate-300 cursor-pointer'
|
|
}`}
|
|
>
|
|
<div className="flex-1 pr-2">
|
|
<div className="flex items-center gap-1.5 flex-wrap">
|
|
<span className="text-xs font-bold text-slate-800">{sub.name}</span>
|
|
{!isUnlocked && !live.isActive && (
|
|
<span className="text-[8px] bg-slate-200 text-slate-600 font-bold px-1.5 py-0.5 rounded tracking-wider uppercase">
|
|
Temporarily Unavailable
|
|
</span>
|
|
)}
|
|
</div>
|
|
<p className="text-[10px] text-slate-400 font-semibold mt-0.5 leading-tight">
|
|
{sub.desc.replace(/1 Year:\s*/i, '')}
|
|
</p>
|
|
</div>
|
|
|
|
<div className="flex items-center gap-3 flex-shrink-0">
|
|
{isUnlocked ? (
|
|
<span className="text-[10px] bg-emerald-50 text-emerald-700 font-extrabold tracking-wider px-2 py-0.5 rounded border border-emerald-200 flex items-center gap-0.5 shadow-sm">
|
|
<Check className="h-2.5 w-2.5" /> UNLOCKED
|
|
</span>
|
|
) : !live.isActive ? (
|
|
<span className="text-[10px] bg-slate-100 text-slate-400 font-bold tracking-wider px-2 py-0.5 rounded border border-slate-200">
|
|
INACTIVE
|
|
</span>
|
|
) : (
|
|
<span className="text-xs font-extrabold text-slate-700">
|
|
{currency === 'INR' ? `₹${live.priceInr}` : currency === 'EUR' ? `€${live.priceEur}` : `$${live.priceUsd}`}
|
|
</span>
|
|
)}
|
|
{!isUnlocked && live.isActive && (
|
|
<div className={`h-4.5 w-4.5 rounded-full border flex items-center justify-center transition-all duration-300 ${isInCart ? 'bg-indigo-600 border-indigo-500' : 'border-slate-300'}`}>
|
|
{isInCart && <div className="h-1.5 w-1.5 rounded-full bg-white" />}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
});
|
|
})()}
|
|
</div>
|
|
</div>
|
|
|
|
{/* CARD 4: Clinical Therapeutics */}
|
|
<div className="rounded-3xl p-6 bg-white border border-slate-200/80 shadow-sm flex flex-col space-y-4 break-inside-avoid">
|
|
<div className="space-y-2">
|
|
<div className="flex justify-between items-center gap-2">
|
|
<div className="flex items-center gap-1.5 min-w-0">
|
|
<span className="text-[10px] bg-purple-50 text-purple-600 border border-purple-200 font-bold tracking-wider uppercase px-2 py-0.5 rounded-md whitespace-nowrap shrink-0">
|
|
Therapeutics
|
|
</span>
|
|
<button
|
|
onClick={() => setShowLockedByCategory(prev => ({ ...prev, Therapeutics: !prev.Therapeutics }))}
|
|
className="text-[9px] bg-slate-100 hover:bg-slate-200 text-slate-700 border border-slate-200 font-bold px-1.5 py-0.5 rounded transition-colors whitespace-nowrap shrink-0"
|
|
>
|
|
{showLockedByCategory.Therapeutics ? 'Hide Locked' : 'Show Locked'} ({curriculumModules.filter(m => m.category === 'Therapeutics' && !isModuleUnlocked(m.code)).length})
|
|
</button>
|
|
</div>
|
|
<span className="text-[10px] bg-slate-100/80 text-slate-500 border border-slate-200/70 font-extrabold uppercase tracking-wider px-2 py-0.5 rounded-md whitespace-nowrap shrink-0">
|
|
1-Year Access
|
|
</span>
|
|
</div>
|
|
<h3 className="text-lg font-bold text-slate-800">Clinical Therapeutics</h3>
|
|
<p className="text-xs text-slate-500 leading-relaxed font-semibold">
|
|
Master specific treatment modalities including Auricular Acupuncture and Gynaecology.
|
|
</p>
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
{(() => {
|
|
const items = curriculumModules.filter(m => m.category === 'Therapeutics');
|
|
const visible = items.filter(sub => {
|
|
const isUnlocked = isModuleUnlocked(sub.code);
|
|
const live = getModulePrice(sub);
|
|
if (!isUnlocked && !live.isActive) return false;
|
|
if (!isUnlocked && !showLockedByCategory.Therapeutics) return false;
|
|
return true;
|
|
});
|
|
|
|
if (visible.length === 0) {
|
|
return (
|
|
<div className="py-6 text-center border border-dashed border-slate-200 rounded-2xl bg-slate-50/50">
|
|
<p className="text-xs text-slate-500 font-medium">Locked modules are currently hidden.</p>
|
|
<button
|
|
type="button"
|
|
onClick={() => setShowLockedByCategory(prev => ({ ...prev, Therapeutics: true }))}
|
|
className="mt-1 text-xs text-purple-600 hover:text-purple-700 font-bold hover:underline cursor-pointer"
|
|
>
|
|
Click here to show locked modules
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return visible.map((sub) => {
|
|
const isUnlocked = isModuleUnlocked(sub.code);
|
|
const isInCart = cart.some(item => item.code === sub.code);
|
|
const live = getModulePrice(sub);
|
|
|
|
return (
|
|
<div
|
|
key={`${sub.code}-${sub.name}`}
|
|
onClick={() => {
|
|
if (isUnlocked || !live.isActive) return;
|
|
toggleCartItem(sub);
|
|
}}
|
|
className={`flex justify-between items-center p-3 rounded-2xl border transition-all duration-300 select-none ${
|
|
isUnlocked
|
|
? 'border-emerald-100 bg-emerald-50/20 cursor-default'
|
|
: !live.isActive
|
|
? 'border-slate-100 bg-slate-50/50 opacity-60 cursor-not-allowed'
|
|
: isInCart
|
|
? 'border-indigo-400 bg-indigo-50/20 shadow-sm cursor-pointer'
|
|
: 'border-slate-100 bg-slate-50/80 hover:border-slate-300 cursor-pointer'
|
|
}`}
|
|
>
|
|
<div className="flex-1 pr-2">
|
|
<div className="flex items-center gap-1.5 flex-wrap">
|
|
<span className="text-xs font-bold text-slate-800">{sub.name.replace("Therapeutics: ", "")}</span>
|
|
{sub.code === 'THERAPEUTICS_CORE' && (
|
|
<span className="text-[8px] bg-gradient-to-r from-indigo-500 to-cyan-500 text-white font-extrabold px-1.5 py-0.5 rounded tracking-wider uppercase">
|
|
Complete Pack
|
|
</span>
|
|
)}
|
|
{!isUnlocked && !live.isActive && (
|
|
<span className="text-[8px] bg-slate-200 text-slate-600 font-bold px-1.5 py-0.5 rounded tracking-wider uppercase">
|
|
Temporarily Unavailable
|
|
</span>
|
|
)}
|
|
</div>
|
|
<p className="text-[10px] text-slate-400 font-semibold mt-0.5 leading-tight">
|
|
{sub.desc.replace(/1 Year:\s*/i, '')}
|
|
</p>
|
|
</div>
|
|
|
|
<div className="flex items-center gap-3 flex-shrink-0">
|
|
{isUnlocked ? (
|
|
<span className="text-[10px] bg-emerald-50 text-emerald-700 font-extrabold tracking-wider px-2 py-0.5 rounded border border-emerald-200 flex items-center gap-0.5 shadow-sm">
|
|
<Check className="h-2.5 w-2.5" /> UNLOCKED
|
|
</span>
|
|
) : !live.isActive ? (
|
|
<span className="text-[10px] bg-slate-100 text-slate-400 font-bold tracking-wider px-2 py-0.5 rounded border border-slate-200">
|
|
INACTIVE
|
|
</span>
|
|
) : (
|
|
<span className="text-xs font-extrabold text-slate-700">
|
|
{currency === 'INR' ? `₹${live.priceInr}` : currency === 'EUR' ? `€${live.priceEur}` : `$${live.priceUsd}`}
|
|
</span>
|
|
)}
|
|
{!isUnlocked && live.isActive && (
|
|
<div className={`h-4.5 w-4.5 rounded-full border flex items-center justify-center transition-all duration-300 ${isInCart ? 'bg-indigo-600 border-indigo-500' : 'border-slate-300'}`}>
|
|
{isInCart && <div className="h-1.5 w-1.5 rounded-full bg-white" />}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
});
|
|
})()}
|
|
</div>
|
|
</div>
|
|
|
|
{/* CARD 5: Lifetime Unlimited Pass */}
|
|
<div className="rounded-3xl p-6 bg-gradient-to-br from-amber-500/10 via-yellow-500/5 to-amber-600/10 border border-amber-300/40 shadow-md flex flex-col justify-between space-y-4 relative overflow-hidden select-none break-inside-avoid">
|
|
<div className="absolute -top-12 -right-12 h-32 w-32 bg-amber-400/10 rounded-full blur-2xl pointer-events-none" />
|
|
<div className="flex flex-col md:flex-row justify-between items-start md:items-center gap-4">
|
|
<div className="space-y-1">
|
|
<div className="flex items-center gap-2">
|
|
<div className="inline-flex items-center gap-1.5 bg-amber-100 border border-amber-300 text-amber-800 text-[10px] font-black tracking-widest uppercase px-3 py-1 rounded-full shadow-sm">
|
|
👑 Elite Access Suite
|
|
</div>
|
|
<button
|
|
onClick={() => setShowLockedByCategory(prev => ({ ...prev, Lifetime: !prev.Lifetime }))}
|
|
className="text-[9px] bg-slate-100 hover:bg-slate-200 text-slate-700 border border-slate-200 font-bold px-2 py-1 rounded transition-colors"
|
|
>
|
|
{showLockedByCategory.Lifetime ? 'Hide Locked' : 'Show Locked'} ({curriculumModules.filter(m => m.category === 'Lifetime' && !isModuleUnlocked(m.code)).length})
|
|
</button>
|
|
</div>
|
|
<h3 className="text-xl font-black text-amber-900 tracking-tight">Lifetime Unlimited Access Pass</h3>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
{(() => {
|
|
const items = curriculumModules.filter(m => m.category === 'Lifetime');
|
|
const visible = items.filter(sub => {
|
|
const isUnlocked = isModuleUnlocked(sub.code);
|
|
const live = getModulePrice(sub);
|
|
if (!isUnlocked && !live.isActive) return false;
|
|
if (!isUnlocked && !showLockedByCategory.Lifetime) return false;
|
|
return true;
|
|
});
|
|
|
|
if (visible.length === 0) {
|
|
return (
|
|
<div className="py-6 text-center border border-dashed border-amber-300/60 rounded-2xl bg-amber-50/30">
|
|
<p className="text-xs text-amber-800 font-medium">Locked pass is currently hidden.</p>
|
|
<button
|
|
type="button"
|
|
onClick={() => setShowLockedByCategory(prev => ({ ...prev, Lifetime: true }))}
|
|
className="mt-1 text-xs text-amber-900 hover:text-amber-950 font-bold hover:underline cursor-pointer"
|
|
>
|
|
Click here to show locked pass
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return visible.map((sub) => {
|
|
const isUnlocked = isModuleUnlocked(sub.code);
|
|
const isInCart = cart.some(item => item.code === sub.code);
|
|
const live = getModulePrice(sub);
|
|
|
|
return (
|
|
<div
|
|
key={`${sub.code}-${sub.name}`}
|
|
onClick={() => {
|
|
if (isUnlocked || !live.isActive) return;
|
|
toggleCartItem(sub);
|
|
}}
|
|
className={`flex justify-between items-center p-3 rounded-2xl border transition-all duration-300 select-none ${
|
|
isUnlocked
|
|
? 'border-emerald-100 bg-emerald-50/20 cursor-default'
|
|
: !live.isActive
|
|
? 'border-amber-200/50 bg-amber-50/30 opacity-60 cursor-not-allowed'
|
|
: isInCart
|
|
? 'border-indigo-400 bg-indigo-50/20 shadow-sm cursor-pointer'
|
|
: 'border-slate-100 bg-slate-50/80 hover:border-slate-300 cursor-pointer'
|
|
}`}
|
|
>
|
|
<div className="flex-1 pr-2">
|
|
<div className="flex items-center gap-1.5 flex-wrap">
|
|
<span className="text-xs font-bold text-slate-800">{sub.name}</span>
|
|
{!isUnlocked && !live.isActive && (
|
|
<span className="text-[8px] bg-slate-200 text-slate-600 font-bold px-1.5 py-0.5 rounded tracking-wider uppercase">
|
|
Temporarily Unavailable
|
|
</span>
|
|
)}
|
|
</div>
|
|
<p className="text-[10px] text-slate-400 font-semibold mt-0.5 leading-tight">
|
|
{sub.desc.replace(/10 Years:\s*/i, '')}
|
|
</p>
|
|
</div>
|
|
|
|
<div className="flex items-center gap-3 flex-shrink-0">
|
|
{isUnlocked ? (
|
|
<span className="text-[10px] bg-emerald-50 text-emerald-700 font-extrabold tracking-wider px-2 py-0.5 rounded border border-emerald-200 flex items-center gap-0.5 shadow-sm">
|
|
<Check className="h-2.5 w-2.5" /> UNLOCKED
|
|
</span>
|
|
) : !live.isActive ? (
|
|
<span className="text-[10px] bg-slate-100 text-slate-400 font-bold tracking-wider px-2 py-0.5 rounded border border-slate-200">
|
|
INACTIVE
|
|
</span>
|
|
) : (
|
|
<span className="text-xs font-extrabold text-slate-700">
|
|
{currency === 'INR' ? `₹${live.priceInr}` : currency === 'EUR' ? `€${live.priceEur}` : `$${live.priceUsd}`}
|
|
</span>
|
|
)}
|
|
{!isUnlocked && live.isActive && (
|
|
<div className={`h-4.5 w-4.5 rounded-full border flex items-center justify-center transition-all duration-300 ${isInCart ? 'bg-indigo-600 border-indigo-500' : 'border-slate-300'}`}>
|
|
{isInCart && <div className="h-1.5 w-1.5 rounded-full bg-white" />}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
});
|
|
})()}
|
|
</div>
|
|
</div>
|
|
|
|
{/* CARD 6: Custom Packages & Bundles (Dynamic Admin Plans) */}
|
|
{(() => {
|
|
const customPlans = publicPlans.filter((p: any) => {
|
|
const code = p.base_code || p.code;
|
|
const isCustom = !['POINTS_ACU', 'POINTS_SCALP', 'POINTS_EAR', 'POINTS_TUNG', 'POINTS_PACK', 'PATTERN_CORE', 'NUTRITION_CORE', 'THERAPEUTICS_GYNAE', 'THERAPEUTICS_EAR', 'THERAPEUTICS_CORE', 'LIFETIME_ALL'].includes(code);
|
|
const isActive = p.is_active !== false;
|
|
return isCustom && isActive;
|
|
});
|
|
|
|
if (customPlans.length === 0) return null;
|
|
|
|
const firstPlan = customPlans[0];
|
|
const headerBadge = firstPlan.badge_text || 'Custom Packages & Bundles';
|
|
const headerTitle = firstPlan.heading || 'Special Curated Bundles';
|
|
const headerSubtitle = firstPlan.subtitle || 'Custom curriculum collections created exclusively for practitioners.';
|
|
|
|
return (
|
|
<div className="rounded-3xl p-6 bg-white border border-slate-200/80 shadow-sm flex flex-col space-y-4 break-inside-avoid">
|
|
<div className="space-y-2">
|
|
<div className="flex justify-between items-center gap-2">
|
|
<span className="text-[10px] bg-slate-100 text-slate-700 border border-slate-200 font-bold tracking-wider uppercase px-2 py-0.5 rounded-md whitespace-nowrap shrink-0">
|
|
{headerBadge}
|
|
</span>
|
|
<span className="text-[10px] bg-slate-100/80 text-slate-500 border border-slate-200/70 font-extrabold uppercase tracking-wider px-2 py-0.5 rounded-md whitespace-nowrap shrink-0">
|
|
Custom Bundle
|
|
</span>
|
|
</div>
|
|
<h3 className="text-lg font-bold text-slate-800">{headerTitle}</h3>
|
|
<p className="text-xs text-slate-500 leading-relaxed font-semibold">{headerSubtitle}</p>
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
{customPlans.map((cPlan: any) => {
|
|
const pCode = cPlan.base_code || cPlan.code;
|
|
const isUnlocked = isModuleUnlocked(pCode);
|
|
const isInCart = cart.some(item => item.code === pCode);
|
|
const pInr = cPlan.price_inr ?? 0;
|
|
const pUsd = cPlan.price_usd ?? 0;
|
|
|
|
const customModuleItem: ModuleItem = {
|
|
code: pCode,
|
|
name: cPlan.name,
|
|
category: 'Bundle',
|
|
priceInr: pInr,
|
|
priceUsd: pUsd,
|
|
priceEur: cPlan.price_eur ?? pUsd,
|
|
desc: cPlan.description || 'Custom bundled access.',
|
|
color: 'from-slate-700 to-slate-900'
|
|
};
|
|
|
|
return (
|
|
<div
|
|
key={pCode}
|
|
onClick={() => {
|
|
if (isUnlocked) return;
|
|
toggleCartItem(customModuleItem);
|
|
}}
|
|
className={`flex justify-between items-center p-3 rounded-2xl border transition-all duration-300 select-none ${
|
|
isUnlocked
|
|
? 'border-emerald-100 bg-emerald-50/20 cursor-default'
|
|
: isInCart
|
|
? 'border-indigo-400 bg-indigo-50/20 shadow-sm cursor-pointer'
|
|
: 'border-slate-100 bg-slate-50/80 hover:border-slate-300 cursor-pointer'
|
|
}`}
|
|
>
|
|
<div className="flex-1 pr-2">
|
|
<div className="flex items-center gap-1.5 flex-wrap">
|
|
<span className="text-xs font-bold text-slate-800">{cPlan.name}</span>
|
|
{cPlan.badge_text && (
|
|
<span className="text-[8px] bg-slate-200 text-slate-700 font-bold px-1.5 py-0.5 rounded tracking-wider uppercase">
|
|
{cPlan.badge_text}
|
|
</span>
|
|
)}
|
|
</div>
|
|
{cPlan.description && (
|
|
<p className="text-[10px] text-slate-400 font-semibold mt-0.5 leading-tight">
|
|
{cPlan.description}
|
|
</p>
|
|
)}
|
|
{cPlan.modules && cPlan.modules.length > 0 && (
|
|
<div className="flex flex-wrap gap-1 mt-1.5">
|
|
{cPlan.modules.map((m: any) => (
|
|
<span key={m.slug || m.id} className="text-[8px] bg-slate-100 text-slate-600 px-1.5 py-0.5 rounded font-medium">
|
|
{m.name}
|
|
</span>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
<div className="flex items-center gap-3 flex-shrink-0">
|
|
{isUnlocked ? (
|
|
<span className="text-[10px] bg-emerald-50 text-emerald-700 font-extrabold tracking-wider px-2 py-0.5 rounded border border-emerald-200 flex items-center gap-0.5 shadow-sm">
|
|
<Check className="h-2.5 w-2.5" /> UNLOCKED
|
|
</span>
|
|
) : (
|
|
<span className="text-xs font-extrabold text-slate-700">
|
|
{currency === 'INR' ? `₹${pInr}` : currency === 'EUR' ? `€${cPlan.price_eur ?? pUsd}` : `$${pUsd}`}
|
|
</span>
|
|
)}
|
|
{!isUnlocked && (
|
|
<div className={`h-4.5 w-4.5 rounded-full border flex items-center justify-center transition-all duration-300 ${isInCart ? 'bg-indigo-600 border-indigo-500' : 'border-slate-300'}`}>
|
|
{isInCart && <div className="h-1.5 w-1.5 rounded-full bg-white" />}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
})}
|
|
</div>
|
|
</div>
|
|
);
|
|
})()}
|
|
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|