From 27868222f3d0069ed8220325c7e7761dcaea899b Mon Sep 17 00:00:00 2001 From: project7 Date: Sun, 17 May 2026 08:57:14 +0900 Subject: [PATCH] Show USD as primary Creator Earnings display on profile page (#1208) When PLOT USD price is available, shows USD value as the primary display with PLOT amount as secondary text below. Falls back to PLOT-only when USD price is unavailable. Matches the story detail page pattern. Co-Authored-By: Claude Opus 4.6 --- src/app/profile/[address]/page.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/profile/[address]/page.tsx b/src/app/profile/[address]/page.tsx index 1c347be..c85d17c 100644 --- a/src/app/profile/[address]/page.tsx +++ b/src/app/profile/[address]/page.tsx @@ -656,9 +656,9 @@ function ProfileStatsRow({ const totalReaders = storylines?.reduce((sum, s) => sum + (s.view_count ?? 0), 0) ?? 0; const donationsTotal = donationsData?.reduce((sum, d) => sum + BigInt(d.amount), BigInt(0)) ?? BigInt(0); const combinedEarnings = (totalRoyalties ?? BigInt(0)) + donationsTotal; - const earningsStr = combinedEarnings > BigInt(0) - ? `${formatPrice(formatUnits(combinedEarnings, 18))} ${RESERVE_LABEL}` - : "—"; + const earningsPlot = Number(formatUnits(combinedEarnings, 18)); + const earningsUsd = plotUsdPrice ? earningsPlot * plotUsdPrice : null; + const earningsPlotStr = earningsPlot > 0 ? `${formatPrice(formatUnits(combinedEarnings, 18))} ${RESERVE_LABEL}` : null; const balanceStr = plotBalance != null ? formatCompact(Number(formatUnits(plotBalance, 18))) : "—"; @@ -674,7 +674,12 @@ function ProfileStatsRow({
Total Readers
-
{earningsStr}
+
+ {earningsPlot === 0 ? "$0" : earningsUsd !== null ? formatUsdValue(earningsUsd) : earningsPlotStr} +
+ {earningsPlot > 0 && earningsUsd !== null && ( +
{earningsPlotStr}
+ )}
Creator Earnings