This commit is contained in:
@@ -71,6 +71,13 @@ export default async function ProfilePage({ params }: Props) {
|
||||
.filter((t) => t.type === 'SELL_LONG' || t.type === 'SELL_SHORT')
|
||||
.reduce((sum, t) => sum + t.profit, 0)
|
||||
|
||||
const lotteryAggregate = await prisma.trade.aggregate({
|
||||
where: { userId: user.id, type: 'LOTTERY_WIN' },
|
||||
_sum: { profit: true },
|
||||
_count: true,
|
||||
})
|
||||
const lotteryWinnings = lotteryAggregate._sum.profit ?? 0
|
||||
const lotteryCount = lotteryAggregate._count
|
||||
return (
|
||||
<div className="max-w-4xl mx-auto space-y-8">
|
||||
{/* Header */}
|
||||
@@ -108,6 +115,11 @@ export default async function ProfilePage({ params }: Props) {
|
||||
<div className="text-right">
|
||||
<p className="text-3xl font-bold">{formatCurrency(totalValue)}</p>
|
||||
<p className="text-sm text-slate-400">total portfolio value</p>
|
||||
{lotteryCount > 0 && (
|
||||
<p className="text-xs text-amber-400 mt-1">
|
||||
🎰 {formatCurrency(lotteryWinnings)} from Lucky Dip ({lotteryCount} spin{lotteryCount !== 1 ? 's' : ''})
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user