This commit is contained in:
+28
-28
@@ -42,8 +42,9 @@ export default async function GlobalTradesPage({ searchParams }: PageProps) {
|
||||
<div className="bg-surface-card border border-surface-border rounded-xl overflow-hidden">
|
||||
<div className="divide-y divide-surface-border">
|
||||
{trades.map((t) => (
|
||||
<div key={t.id} className="flex items-center justify-between px-4 py-3 text-sm">
|
||||
<div className="flex items-center gap-3">
|
||||
<div key={t.id} className="px-4 py-3 text-sm space-y-1.5">
|
||||
{/* Primary row: type badge · hashtag · total value */}
|
||||
<div className="flex items-center gap-2">
|
||||
<span
|
||||
className={`text-xs font-medium px-2 py-0.5 rounded shrink-0 ${
|
||||
t.type.startsWith('BUY')
|
||||
@@ -53,34 +54,33 @@ export default async function GlobalTradesPage({ searchParams }: PageProps) {
|
||||
>
|
||||
{t.type.replace('_', ' ')}
|
||||
</span>
|
||||
<div>
|
||||
<div className="flex items-center gap-1.5">
|
||||
{t.user.isFund ? (
|
||||
<span className="text-xs text-indigo-400">🏦</span>
|
||||
) : null}
|
||||
<Link
|
||||
href={t.user.isFund ? `/fund/${t.user.username.replace('fund:', '')}` : `/profile/${t.user.username}`}
|
||||
className="text-slate-300 hover:text-white"
|
||||
>
|
||||
{t.user.displayUsername ?? t.user.username}
|
||||
</Link>
|
||||
<span className="text-slate-600">·</span>
|
||||
<Link href={`/hashtag/${t.hashtag!.tag}`} className="text-indigo-300 hover:text-indigo-200">
|
||||
#{t.hashtag!.displayTag}
|
||||
</Link>
|
||||
</div>
|
||||
<p className="text-xs text-slate-500 mt-0.5">
|
||||
{formatDistanceToNow(t.createdAt, { addSuffix: true })}
|
||||
</p>
|
||||
<Link
|
||||
href={`/hashtag/${t.hashtag!.tag}`}
|
||||
className="text-indigo-300 hover:text-indigo-200 font-medium truncate flex-1 min-w-0"
|
||||
>
|
||||
#{t.hashtag!.displayTag}
|
||||
</Link>
|
||||
<span className="shrink-0 font-medium tabular-nums">{formatCurrency(t.total)}</span>
|
||||
</div>
|
||||
{/* Secondary row: user · time (left) shares @ price (right) */}
|
||||
<div className="flex items-center justify-between text-xs text-slate-500">
|
||||
<div className="flex items-center gap-1.5 min-w-0">
|
||||
{t.user.isFund && <span className="text-indigo-400 shrink-0">🏦</span>}
|
||||
<Link
|
||||
href={t.user.isFund ? `/fund/${t.user.username.replace('fund:', '')}` : `/profile/${t.user.username}`}
|
||||
className="text-slate-400 hover:text-slate-200 truncate"
|
||||
>
|
||||
{t.user.displayUsername ?? t.user.username}
|
||||
</Link>
|
||||
<span className="text-slate-700 shrink-0">·</span>
|
||||
<span className="shrink-0">{formatDistanceToNow(t.createdAt, { addSuffix: true })}</span>
|
||||
</div>
|
||||
<span className="shrink-0 tabular-nums ml-3">{formatNumber(t.shares)} sh @ {formatCurrency(t.price)}</span>
|
||||
</div>
|
||||
<div className="text-right shrink-0">
|
||||
<p>{formatNumber(t.shares)} sh @ {formatCurrency(t.price)}</p>
|
||||
<p className="text-xs text-slate-500">{formatCurrency(t.total)}</p>
|
||||
{(t.type === 'SELL_LONG' || t.type === 'SELL_SHORT') && (
|
||||
<p className={`text-xs ${pnlColor(t.profit)}`}>{formatPnl(t.profit)}</p>
|
||||
)}
|
||||
</div>
|
||||
{/* PnL: sell trades only */}
|
||||
{(t.type === 'SELL_LONG' || t.type === 'SELL_SHORT') && (
|
||||
<div className={`text-xs text-right ${pnlColor(t.profit)}`}>{formatPnl(t.profit)}</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user