fix(dashboard): calculate total charity dynamically from order history and profile total
This commit is contained in:
parent
377ec7fb34
commit
5be2b9693d
@ -670,7 +670,9 @@ export default function UserDashboard() {
|
||||
<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-xl sm:text-3xl font-black italic">{toPersian(profile.charityDonationTotal?.toLocaleString() || "0")}</span>
|
||||
<span className="text-xl sm:text-3xl font-black italic">
|
||||
{toPersian((Math.max(profile.charityDonationTotal || 0, orders.reduce((sum, o) => sum + Number(o.charityDonation || 0), 0))).toLocaleString())}
|
||||
</span>
|
||||
<span className="text-xs font-bold opacity-60">تومان</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user