feat: include fund information in trade display and enhance fund trade styling
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m19s

This commit is contained in:
2026-03-20 19:55:37 -04:00
parent 840345d093
commit ef01ea9a3a
+20 -7
View File
@@ -40,7 +40,10 @@ export default async function ProfilePage({ params }: Props) {
trades: { trades: {
orderBy: { createdAt: 'desc' }, orderBy: { createdAt: 'desc' },
take: 30, take: 30,
include: { hashtag: { select: { tag: true, displayTag: true } } }, include: {
hashtag: { select: { tag: true, displayTag: true } },
fund: { select: { name: true, slug: true } },
},
}, },
managedFunds: { managedFunds: {
orderBy: { addedAt: 'asc' }, orderBy: { addedAt: 'asc' },
@@ -293,6 +296,7 @@ export default async function ProfilePage({ params }: Props) {
const isLottery = t.type === 'LOTTERY_WIN' const isLottery = t.type === 'LOTTERY_WIN'
const isLiquidation = t.type === 'LIQUIDATE_LONG' || t.type === 'LIQUIDATE_SHORT' const isLiquidation = t.type === 'LIQUIDATE_LONG' || t.type === 'LIQUIDATE_SHORT'
const isSystemReset = t.type === 'DONATION' || t.type === 'BANKRUPTCY' || t.type === 'ACCOUNT_OPEN' const isSystemReset = t.type === 'DONATION' || t.type === 'BANKRUPTCY' || t.type === 'ACCOUNT_OPEN'
const isFundTrade = t.type === 'FUND_INVEST' || t.type === 'FUND_REDEEM'
return ( return (
<div key={t.id} className="px-4 py-3 text-sm space-y-1.5"> <div key={t.id} className="px-4 py-3 text-sm space-y-1.5">
{/* Primary row: badge · hashtag/label · total */} {/* Primary row: badge · hashtag/label · total */}
@@ -307,9 +311,11 @@ export default async function ProfilePage({ params }: Props) {
? 'bg-purple-500/15 text-purple-400' ? 'bg-purple-500/15 text-purple-400'
: t.type === 'ACCOUNT_OPEN' : t.type === 'ACCOUNT_OPEN'
? 'bg-emerald-500/15 text-emerald-400' ? 'bg-emerald-500/15 text-emerald-400'
: t.type.startsWith('BUY') : isFundTrade
? 'bg-emerald-500/15 text-emerald-400' ? 'bg-indigo-500/15 text-indigo-400'
: 'bg-red-500/15 text-red-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, ' ')} {isLiquidation ? 'LIQUIDATED' : t.type.replace(/_/g, ' ')}
@@ -324,6 +330,13 @@ export default async function ProfilePage({ params }: Props) {
? 'Bankruptcy declared' ? 'Bankruptcy declared'
: 'Account opened'} : 'Account opened'}
</span> </span>
) : isFundTrade ? (
<Link
href={`/fund/${t.fund!.slug}`}
className="text-indigo-300 hover:text-indigo-200 font-medium truncate flex-1 min-w-0"
>
{t.fund!.name}
</Link>
) : ( ) : (
<Link <Link
href={`/hashtag/${t.hashtag!.tag}`} href={`/hashtag/${t.hashtag!.tag}`}
@@ -340,11 +353,11 @@ export default async function ProfilePage({ params }: Props) {
<div className="flex items-center justify-between text-xs text-slate-500"> <div className="flex items-center justify-between text-xs text-slate-500">
<span>{formatDistanceToNow(t.createdAt, { addSuffix: true })}</span> <span>{formatDistanceToNow(t.createdAt, { addSuffix: true })}</span>
{!isLottery && !isSystemReset && ( {!isLottery && !isSystemReset && (
<span className="tabular-nums ml-3">{formatNumber(t.shares)} sh @ {formatCurrency(t.price)}</span> <span className="tabular-nums ml-3">{formatNumber(isFundTrade ? t.shares : t.shares)} sh @ {formatCurrency(t.price)}</span>
)} )}
</div> </div>
{/* PnL: sell, liquidation, and reset trades */} {/* 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 === 'SELL_LONG' || t.type === 'SELL_SHORT' || isLiquidation || t.type === 'DONATION' || t.type === 'BANKRUPTCY' || t.type === 'FUND_REDEEM') && (
<div className={`text-xs text-right ${pnlColor(t.profit)}`}>{formatPnl(t.profit)}</div> <div className={`text-xs text-right ${pnlColor(t.profit)}`}>{formatPnl(t.profit)}</div>
)} )}
</div> </div>