Merge pull request 'fix(store): display storefront and subscriptions navigation tabs on mobile' (#85) from fix/mobile-storefront-subscriptions-nav into main

Reviewed-on: https://git.zedobject.local/AcuPedia/acupedia-store-ui/pulls/85
Reviewed-by: Amit Salunke <amit@noreply.localhost>
This commit is contained in:
Amit Salunke 2026-11-06 05:03:20 +00:00
commit 54ce5bcd85
3 changed files with 125 additions and 77 deletions

View File

@ -1178,6 +1178,10 @@ export default function App() {
setShowProfileDrawer(false); setShowProfileDrawer(false);
switchTab('storefront'); switchTab('storefront');
}} }}
onViewSubscriptions={() => {
setShowProfileDrawer(false);
switchTab('subscriptions');
}}
curriculumModules={curriculumModules} curriculumModules={curriculumModules}
onDownloadInvoice={handleDownloadCheckoutInvoice} onDownloadInvoice={handleDownloadCheckoutInvoice}
/> />

View File

@ -36,6 +36,7 @@ interface ProfileDrawerProps {
onChangePassword: (e: React.FormEvent) => Promise<void>; onChangePassword: (e: React.FormEvent) => Promise<void>;
onLogout: () => void; onLogout: () => void;
onBrowseStorefront: () => void; onBrowseStorefront: () => void;
onViewSubscriptions?: () => void;
curriculumModules: ModuleItem[]; curriculumModules: ModuleItem[];
onDownloadInvoice?: (paymentId: string, directUrl?: string) => void; onDownloadInvoice?: (paymentId: string, directUrl?: string) => void;
} }
@ -69,6 +70,7 @@ export const ProfileDrawer: React.FC<ProfileDrawerProps> = ({
onChangePassword, onChangePassword,
onLogout, onLogout,
onBrowseStorefront, onBrowseStorefront,
onViewSubscriptions,
curriculumModules, curriculumModules,
onDownloadInvoice, onDownloadInvoice,
}) => { }) => {
@ -314,9 +316,20 @@ export const ProfileDrawer: React.FC<ProfileDrawerProps> = ({
{/* Subscriptions Nested Details */} {/* Subscriptions Nested Details */}
<div className="space-y-4"> <div className="space-y-4">
<h4 className="text-xs font-bold text-slate-400 uppercase tracking-widest flex items-center gap-1.5"> <div className="flex items-center justify-between">
<CheckCircle className="h-4 w-4 text-emerald-500" /> Ongoing subscriptions <h4 className="text-xs font-bold text-slate-400 uppercase tracking-widest flex items-center gap-1.5">
</h4> <CheckCircle className="h-4 w-4 text-emerald-500" /> Ongoing subscriptions
</h4>
{onViewSubscriptions && (
<button
type="button"
onClick={onViewSubscriptions}
className="text-xs text-indigo-600 hover:text-indigo-500 font-bold hover:underline"
>
View All
</button>
)}
</div>
{!loggedInUser.active_subscriptions || loggedInUser.active_subscriptions.length === 0 ? ( {!loggedInUser.active_subscriptions || loggedInUser.active_subscriptions.length === 0 ? (
<div className="bg-slate-50 border border-slate-200/60 rounded-2xl p-6 text-center space-y-2"> <div className="bg-slate-50 border border-slate-200/60 rounded-2xl p-6 text-center space-y-2">

View File

@ -18,85 +18,116 @@ export const StoreHeader: React.FC<StoreHeaderProps> = ({
onOpenAuth, onOpenAuth,
}) => { }) => {
return ( return (
<header className="w-full bg-[#0A0A0E] text-slate-300 border-b border-slate-800 px-6 py-4 flex items-center justify-between shadow-lg flex-shrink-0"> <header className="w-full bg-[#0A0A0E] text-slate-300 border-b border-slate-800 px-4 sm:px-6 py-3 sm:py-4 shadow-lg flex-shrink-0">
<div className="flex items-center gap-6"> <div className="flex items-center justify-between">
<div <div className="flex items-center gap-6">
onClick={() => onSwitchTab('storefront')} <div
className="flex items-center gap-3 cursor-pointer group" onClick={() => onSwitchTab('storefront')}
> className="flex items-center gap-3 cursor-pointer group"
<div className="h-10 w-10 rounded-xl bg-gradient-to-tr from-indigo-500 to-cyan-400 flex items-center justify-center shadow-md shadow-indigo-500/20 group-hover:scale-105 transition-transform"> >
<Sparkles className="h-5 w-5 text-white" /> <div className="h-10 w-10 rounded-xl bg-gradient-to-tr from-indigo-500 to-cyan-400 flex items-center justify-center shadow-md shadow-indigo-500/20 group-hover:scale-105 transition-transform">
</div> <Sparkles className="h-5 w-5 text-white" />
<div> </div>
<h1 className="text-base font-black tracking-tight text-white flex items-center gap-1"> <div>
ACUPEDIA <h1 className="text-base font-black tracking-tight text-white flex items-center gap-1">
</h1> ACUPEDIA
<p className="text-[9px] text-slate-400 font-bold tracking-widest uppercase">TCM PLATFORM</p> </h1>
<p className="text-[9px] text-slate-400 font-bold tracking-widest uppercase">TCM PLATFORM</p>
</div>
</div> </div>
{/* Desktop Navigation Tabs */}
<nav className="hidden sm:flex items-center bg-slate-900/80 border border-slate-800 rounded-xl p-1 gap-1">
<button
onClick={() => onSwitchTab('storefront')}
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-bold transition-colors ${
activeTab === 'storefront'
? 'bg-indigo-600 text-white shadow-sm'
: 'text-slate-400 hover:text-slate-200'
}`}
>
<BookOpen className="h-3.5 w-3.5" /> Storefront
</button>
<button
onClick={() => onSwitchTab('subscriptions')}
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-bold transition-colors ${
activeTab === 'subscriptions'
? 'bg-indigo-600 text-white shadow-sm'
: 'text-slate-400 hover:text-slate-200'
}`}
>
<CheckCircle className="h-3.5 w-3.5" /> My Subscriptions
{loggedInUser?.active_subscriptions && loggedInUser.active_subscriptions.length > 0 && (
<span className="bg-indigo-900 text-indigo-200 text-[10px] px-1.5 py-0.2 rounded-full ml-0.5">
{loggedInUser.active_subscriptions.length}
</span>
)}
</button>
</nav>
</div> </div>
{/* Navigation Tabs */} <div className="flex items-center gap-3">
<nav className="hidden sm:flex items-center bg-slate-900/80 border border-slate-800 rounded-xl p-1 gap-1"> {loggedInUser ? (
<button <button
onClick={() => onSwitchTab('storefront')} onClick={onOpenProfile}
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-bold transition-colors ${ className="flex items-center gap-3 hover:text-white transition-colors group focus:outline-none"
activeTab === 'storefront' >
? 'bg-indigo-600 text-white shadow-sm' <div className="text-right hidden sm:block">
: 'text-slate-400 hover:text-slate-200' <p className="text-xs font-bold text-white truncate max-w-[150px]">
}`} {loggedInUser.display_name || loggedInUser.email}
> </p>
<BookOpen className="h-3.5 w-3.5" /> Storefront </div>
</button> <div className="h-9 w-9 rounded-lg bg-indigo-950/60 border border-indigo-500/30 flex items-center justify-center text-indigo-400 font-bold text-sm group-hover:border-indigo-400 transition-colors">
<button {(loggedInUser.display_name || loggedInUser.email || 'U')[0].toUpperCase()}
onClick={() => onSwitchTab('subscriptions')} </div>
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-bold transition-colors ${ </button>
activeTab === 'subscriptions' ) : (
? 'bg-indigo-600 text-white shadow-sm' <div className="flex gap-2">
: 'text-slate-400 hover:text-slate-200' <button
}`} onClick={() => onOpenAuth('login')}
> className="flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-xl text-xs font-bold bg-slate-800 hover:bg-slate-700 text-slate-300 transition-colors"
<CheckCircle className="h-3.5 w-3.5" /> My Subscriptions >
{loggedInUser?.active_subscriptions && loggedInUser.active_subscriptions.length > 0 && ( <LogIn className="h-3.5 w-3.5" /> Login
<span className="bg-indigo-900 text-indigo-200 text-[10px] px-1.5 py-0.2 rounded-full ml-0.5"> </button>
{loggedInUser.active_subscriptions.length} <button
</span> onClick={() => onOpenAuth('register')}
)} className="flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-xl text-xs font-bold bg-indigo-600 hover:bg-indigo-500 text-white transition-colors shadow shadow-indigo-600/10"
</button> >
</nav> <UserPlus className="h-3.5 w-3.5" /> Join
</button>
</div>
)}
</div>
</div> </div>
<div className="flex items-center gap-3"> {/* Mobile Navigation Tabs */}
{loggedInUser ? ( <nav className="sm:hidden flex items-center bg-slate-900/90 border border-slate-800 rounded-xl p-1 mt-3 gap-1 w-full">
<button <button
onClick={onOpenProfile} onClick={() => onSwitchTab('storefront')}
className="flex items-center gap-3 hover:text-white transition-colors group focus:outline-none" className={`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg text-xs font-bold transition-colors ${
> activeTab === 'storefront'
<div className="text-right hidden sm:block"> ? 'bg-indigo-600 text-white shadow-sm'
<p className="text-xs font-bold text-white truncate max-w-[150px]"> : 'text-slate-400 hover:text-slate-200'
{loggedInUser.display_name || loggedInUser.email} }`}
</p> >
</div> <BookOpen className="h-3.5 w-3.5" /> Storefront
<div className="h-9 w-9 rounded-lg bg-indigo-950/60 border border-indigo-500/30 flex items-center justify-center text-indigo-400 font-bold text-sm group-hover:border-indigo-400 transition-colors"> </button>
{(loggedInUser.display_name || loggedInUser.email || 'U')[0].toUpperCase()} <button
</div> onClick={() => onSwitchTab('subscriptions')}
</button> className={`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg text-xs font-bold transition-colors ${
) : ( activeTab === 'subscriptions'
<div className="flex gap-2"> ? 'bg-indigo-600 text-white shadow-sm'
<button : 'text-slate-400 hover:text-slate-200'
onClick={() => onOpenAuth('login')} }`}
className="flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-xl text-xs font-bold bg-slate-800 hover:bg-slate-700 text-slate-300 transition-colors" >
> <CheckCircle className="h-3.5 w-3.5" /> My Subscriptions
<LogIn className="h-3.5 w-3.5" /> Login {loggedInUser?.active_subscriptions && loggedInUser.active_subscriptions.length > 0 && (
</button> <span className="bg-indigo-900 text-indigo-200 text-[10px] px-1.5 py-0.2 rounded-full ml-1 font-semibold">
<button {loggedInUser.active_subscriptions.length}
onClick={() => onOpenAuth('register')} </span>
className="flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-xl text-xs font-bold bg-indigo-600 hover:bg-indigo-500 text-white transition-colors shadow shadow-indigo-600/10" )}
> </button>
<UserPlus className="h-3.5 w-3.5" /> Join </nav>
</button>
</div>
)}
</div>
</header> </header>
); );
}; };