feat: Fix responsive layout breakdowns in UserDashboard profile sections

This commit is contained in:
parsa aghaei committed 2026-07-25 11:40:21 +03:30
1 parent 20a1b225c8
commit 6638eaa10a
1 file changed
+36 -35
@@ -142,91 +142,92 @@ export default function UserDashboard() {
<div className="min-h-screen bg-medical-gray-50 pt-12 pb-24 px-4 font-vazir" dir="rtl">
<div className="max-w-6xl mx-auto">
{/* Breadcrumb */}
<div className="flex items-center gap-2 text-[10px] font-black text-medical-gray-400 uppercase tracking-widest mb-10">
<div className="flex items-center gap-2 text-[10px] font-black text-medical-gray-400 uppercase tracking-widest mb-10 overflow-x-auto whitespace-nowrap pb-2">
<span className="cursor-pointer hover:text-canina-blue" onClick={() => router.push('/')}>خانه</span>
<ChevronRight className="w-2.5 h-2.5" />
<ChevronRight className="w-2.5 h-2.5 flex-shrink-0" />
<span className="text-canina-blue">پنل کاربری</span>
</div>
<div className="grid lg:grid-cols-12 gap-8">
{/* Sidebar */}
<div className="lg:col-span-4 space-y-6">
<div className="bg-white rounded-[3rem] border border-medical-gray-200 p-8 shadow-xl">
<div className="flex items-center gap-4 mb-10">
<div className="w-16 h-16 bg-canina-blue rounded-3xl flex items-center justify-center text-white shadow-lg">
<User className="w-8 h-8" />
<div className="bg-white rounded-[2rem] sm:rounded-[3rem] border border-medical-gray-200 p-6 sm:p-8 shadow-xl">
<div className="flex items-center gap-4 mb-8 sm:mb-10">
<div className="w-14 h-14 sm:w-16 sm:h-16 bg-canina-blue rounded-2xl sm:rounded-3xl flex items-center justify-center text-white shadow-lg flex-shrink-0">
<User className="w-7 h-7 sm:w-8 sm:h-8" />
</div>
<div>
<h2 className="text-xl font-black text-medical-gray-900">{profile.firstName} {profile.lastName}</h2>
<p className="text-sm font-bold text-medical-gray-400">{profile.email}</p>
<div className="min-w-0">
<h2 className="text-lg sm:text-xl font-black text-medical-gray-900 truncate">{profile.firstName} {profile.lastName}</h2>
<p className="text-xs sm:text-sm font-bold text-medical-gray-400 truncate">{profile.email}</p>
</div>
</div>
<div className="space-y-2">
{/* Responsive Tab Bar: Horizontal Scroll on Mobile, Vertical Stack on Desktop */}
<div className="flex lg:flex-col gap-2 overflow-x-auto lg:overflow-x-visible pb-3 lg:pb-0 whitespace-nowrap">
{tabs.map(tab => (
<button
key={tab.id}
onClick={() => setActiveTab(tab.id as any)}
className={`w-full flex items-center gap-3 p-4 rounded-2xl transition-all font-bold ${activeTab === tab.id ? "bg-canina-blue text-white shadow-lg shadow-canina-blue/20" : "text-medical-gray-600 hover:bg-medical-gray-50"}`}
className={`flex items-center gap-2.5 px-4 py-3 sm:py-4 rounded-xl sm:rounded-2xl transition-all font-bold text-xs sm:text-sm flex-shrink-0 ${activeTab === tab.id ? "bg-canina-blue text-white shadow-lg shadow-canina-blue/20" : "text-medical-gray-600 hover:bg-medical-gray-50 bg-medical-gray-50/50 lg:bg-transparent"}`}
>
{tab.icon}
{tab.label}
<div className="flex-shrink-0">{tab.icon}</div>
<span>{tab.label}</span>
</button>
))}
<button
onClick={handleLogout}
className="w-full flex items-center gap-3 p-4 rounded-2xl text-red-500 hover:bg-red-50 transition-all font-bold mt-4"
className="flex items-center gap-2.5 px-4 py-3 sm:py-4 rounded-xl sm:rounded-2xl text-red-500 hover:bg-red-50 transition-all font-bold text-xs sm:text-sm flex-shrink-0 lg:mt-4 bg-red-50/30 lg:bg-transparent"
>
<LogOut className="w-5 h-5" />
خروج از حساب
<LogOut className="w-4 h-4 sm:w-5 sm:h-5 flex-shrink-0" />
<span>خروج</span>
</button>
</div>
</div>
<div className="bg-medical-gray-900 rounded-[3rem] p-8 text-white relative overflow-hidden shadow-2xl">
<div className="bg-medical-gray-900 rounded-[2rem] sm:rounded-[3rem] p-6 sm:p-8 text-white relative overflow-hidden shadow-2xl">
<div className="absolute top-0 left-0 p-6 opacity-20">
<Wallet className="w-12 h-12 text-canina-blue" />
</div>
<div className="relative z-10">
<div className="text-[10px] font-black uppercase tracking-widest text-white mb-2">موجودی کیف پول</div>
<div className="text-[10px] font-black uppercase tracking-widest text-white/70 mb-2">موجودی کیف پول</div>
<div className="flex items-baseline gap-2 flex-row-reverse justify-end">
<div className="text-4xl font-black italic">{toPersian((profile.walletBalance ?? 0).toLocaleString())}</div>
<span className="text-sm not-italic font-bold text-white/80">تومان</span>
<div className="text-3xl sm:text-4xl font-black italic">{toPersian((profile.walletBalance ?? 0).toLocaleString())}</div>
<span className="text-xs sm:text-sm not-italic font-bold text-white/80">تومان</span>
</div>
<button
onClick={() => { setActiveTab("wallet"); setIsTopUpModalOpen(true); }}
disabled={isTopUpModalOpen}
className="mt-8 bg-canina-blue w-full py-4 rounded-2xl font-black hover:bg-white hover:text-canina-blue transition-all shadow-lg shadow-black/20 flex items-center justify-center gap-2"
className="mt-6 sm:mt-8 bg-canina-blue w-full py-3.5 sm:py-4 rounded-xl sm:rounded-2xl font-black hover:bg-white hover:text-canina-blue transition-all shadow-lg shadow-black/20 flex items-center justify-center gap-2 text-xs sm:text-sm"
>
شارژ کیف پول
</button>
</div>
</div>
<div className="bg-pink-500 rounded-[3rem] p-8 text-white relative overflow-hidden shadow-2xl shadow-pink-200">
<div className="bg-pink-500 rounded-[2rem] sm:rounded-[3rem] p-6 sm:p-8 text-white relative overflow-hidden shadow-2xl shadow-pink-200">
<div className="absolute -top-4 -right-4 opacity-10">
<Heart className="w-40 h-40 fill-white" />
<Heart className="w-32 sm:w-40 h-32 sm:h-40 fill-white" />
</div>
<div className="relative z-10">
<div className="flex items-center gap-3 mb-6">
<Heart className="w-5 h-5 fill-white" />
<h4 className="text-sm font-black italic tracking-widest">ردپای مهربانی</h4>
<div className="flex items-center gap-3 mb-4 sm:mb-6">
<Heart className="w-5 h-5 fill-white flex-shrink-0" />
<h4 className="text-xs sm:text-sm font-black italic tracking-widest">ردپای مهربانی</h4>
</div>
<div className="space-y-6">
<div className="space-y-4 sm:space-y-6">
<div>
<p className="text-[10px] font-bold text-white/70 mb-1">مجموع کمک‌های اهدایی</p>
<div className="flex items-baseline gap-2 flex-row-reverse justify-end">
<span className="text-3xl font-black italic">{toPersian(profile.charityDonationTotal?.toLocaleString() || "0")}</span>
<span className="text-2xl sm:text-3xl font-black italic">{toPersian(profile.charityDonationTotal?.toLocaleString() || "0")}</span>
<span className="text-xs font-bold opacity-60">تومان</span>
</div>
</div>
<div className="p-4 bg-white/10 rounded-2xl border border-white/20 backdrop-blur-sm">
<div className="flex items-center gap-3">
<div className="w-8 h-8 bg-white/20 rounded-xl flex items-center justify-center">
<Sparkles className="w-4 h-4 text-white" />
<div className="p-3 sm:p-4 bg-white/10 rounded-xl sm:rounded-2xl border border-white/20 backdrop-blur-sm">
<div className="flex items-start gap-3">
<div className="w-7 h-7 sm:w-8 sm:h-8 bg-white/20 rounded-lg sm:rounded-xl flex items-center justify-center flex-shrink-0 mt-0.5">
<Sparkles className="w-3.5 h-3.5 sm:w-4 sm:h-4 text-white" />
</div>
<p className="text-[10px] font-black leading-tight">
همکاری شما باعث تامین هزینه <span className="text-sm text-yellow-300 mx-1">{toPersian(Math.floor((profile.charityDonationTotal || 0) / 15000).toString())} وعده غذا</span> برای حیوانات بی‌پناه شده است.
<p className="text-[10px] sm:text-xs font-black leading-relaxed">
همکاری شما باعث تامین هزینه <span className="text-xs sm:text-sm text-yellow-300 mx-1">{toPersian(Math.floor((profile.charityDonationTotal || 0) / 15000).toString())} وعده غذا</span> برای حیوانات بی‌پناه شده است.
</p>
</div>
</div>
@@ -241,7 +242,7 @@ export default function UserDashboard() {
key={activeTab}
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
className="bg-white rounded-[3.5rem] border border-medical-gray-200 p-10 min-h-[600px] shadow-sm overflow-hidden"
className="bg-white rounded-[2rem] sm:rounded-[3.5rem] border border-medical-gray-200 p-5 sm:p-10 min-h-[500px] sm:min-h-[600px] shadow-sm overflow-hidden"
>
{activeTab === "profile" && (
<div>