diff --git a/src/app/profile/[username]/page.tsx b/src/app/profile/[username]/page.tsx index d003906..074fb92 100644 --- a/src/app/profile/[username]/page.tsx +++ b/src/app/profile/[username]/page.tsx @@ -40,7 +40,10 @@ export default async function ProfilePage({ params }: Props) { trades: { orderBy: { createdAt: 'desc' }, take: 30, - include: { hashtag: { select: { tag: true, displayTag: true } } }, + include: { + hashtag: { select: { tag: true, displayTag: true } }, + fund: { select: { name: true, slug: true } }, + }, }, managedFunds: { orderBy: { addedAt: 'asc' }, @@ -293,6 +296,7 @@ export default async function ProfilePage({ params }: Props) { const isLottery = t.type === 'LOTTERY_WIN' const isLiquidation = t.type === 'LIQUIDATE_LONG' || t.type === 'LIQUIDATE_SHORT' const isSystemReset = t.type === 'DONATION' || t.type === 'BANKRUPTCY' || t.type === 'ACCOUNT_OPEN' + const isFundTrade = t.type === 'FUND_INVEST' || t.type === 'FUND_REDEEM' return (
{/* Primary row: badge · hashtag/label · total */} @@ -307,9 +311,11 @@ export default async function ProfilePage({ params }: Props) { ? 'bg-purple-500/15 text-purple-400' : t.type === 'ACCOUNT_OPEN' ? 'bg-emerald-500/15 text-emerald-400' - : t.type.startsWith('BUY') - ? 'bg-emerald-500/15 text-emerald-400' - : 'bg-red-500/15 text-red-400' + : isFundTrade + ? 'bg-indigo-500/15 text-indigo-400' + : t.type.startsWith('BUY') + ? 'bg-emerald-500/15 text-emerald-400' + : 'bg-red-500/15 text-red-400' }`} > {isLiquidation ? 'LIQUIDATED' : t.type.replace(/_/g, ' ')} @@ -324,6 +330,13 @@ export default async function ProfilePage({ params }: Props) { ? 'Bankruptcy declared' : 'Account opened'} + ) : isFundTrade ? ( + + {t.fund!.name} + ) : ( {formatDistanceToNow(t.createdAt, { addSuffix: true })} {!isLottery && !isSystemReset && ( - {formatNumber(t.shares)} sh @ {formatCurrency(t.price)} + {formatNumber(isFundTrade ? t.shares : t.shares)} sh @ {formatCurrency(t.price)} )}
- {/* PnL: sell, liquidation, and reset trades */} - {(t.type === 'SELL_LONG' || t.type === 'SELL_SHORT' || isLiquidation || t.type === 'DONATION' || t.type === 'BANKRUPTCY') && ( + {/* PnL: sell, liquidation, reset, and fund redeem trades */} + {(t.type === 'SELL_LONG' || t.type === 'SELL_SHORT' || isLiquidation || t.type === 'DONATION' || t.type === 'BANKRUPTCY' || t.type === 'FUND_REDEEM') && (
{formatPnl(t.profit)}
)}