From 6064d484177b314ade0e88a2645cba2c58d68172 Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Thu, 2 Apr 2026 12:01:10 +0100 Subject: [PATCH] [#749] Remove Donations/Trades from Reader tab, add Activity Stats dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Remove Donations section and Trading History from Portfolio/Reader tab — only Portfolio summary + Story Token Holdings remain 2. Add Activity Stats 4-box dashboard at top of Activity tab: Trades count, Trade Volume, Donations count, Donated amount 3. Stats computed from existing feed data (no extra queries) Fixes #749 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/app/profile/[address]/page.tsx | 91 ++++++++++-------------------- 1 file changed, 31 insertions(+), 60 deletions(-) diff --git a/src/app/profile/[address]/page.tsx b/src/app/profile/[address]/page.tsx index b6873c0d..8e5bb31d 100644 --- a/src/app/profile/[address]/page.tsx +++ b/src/app/profile/[address]/page.tsx @@ -1515,65 +1515,7 @@ function PortfolioTab({ address, isOwnProfile }: { address: string; isOwnProfile )} - {/* Donations — structured card */} - {(hasDonationsReceived || (isOwnProfile && hasDonationsGiven)) && ( -
-

Donations

-
- {hasDonationsReceived && ( -
-
{formatPrice(formatUnits(donationsReceived!.total, 18))}
-
Received · {donationsReceived!.count}
-
- )} - {isOwnProfile && hasDonationsGiven && ( -
-
{formatPrice(formatUnits(totalDonated, 18))}
-
Given · {donationTotalCount}
-
- )} -
- {isOwnProfile && hasDonationsGiven && ( -
- {donationsGiven.map((d) => ( -
- - Story #{d.storyline_id} - - - {formatPrice(formatUnits(BigInt(d.amount), 18))} {RESERVE_LABEL} - - - {d.block_timestamp && ( - - )} - {d.tx_hash && ( - - )} - -
- ))} - {donHasNext && ( - - )} -
- )} -
- )} - - {/* Trading History */} - + {/* Donations and Trading History moved to Activity tab */} ); } @@ -1862,11 +1804,40 @@ function ActivityTab({ address }: { address: string }) { ); } + // Activity Stats + const tradeEntries = feed.filter((e) => e.type === "bought" || e.type === "sold"); + const donationEntries = feed.filter((e) => e.type === "donated"); + const totalTradeAmount = tradeEntries.reduce((sum, e) => sum + (e.reserveAmount ?? 0), 0); + const totalDonationAmount = donationEntries.reduce((sum, e) => sum + (e.reserveAmount ?? 0), 0); + const visible = feed.slice(0, visibleCount); const hasMore = visibleCount < feed.length; return ( -
+
+ {/* Activity Stats dashboard */} +

Activity Stats

+
+
+
+
{tradeEntries.length}
+
Trades
+
+
+
{totalTradeAmount > 0 ? formatPrice(totalTradeAmount) : "—"}
+
Trade Vol ({RESERVE_LABEL})
+
+
+
{donationEntries.length}
+
Donations
+
+
+
{totalDonationAmount > 0 ? formatPrice(totalDonationAmount) : "—"}
+
Donated ({RESERVE_LABEL})
+
+
+
+
{visible.map((entry, i) => (