From 42b583df15c27d4b186fa94f46eeab30d929fd91 Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Mon, 16 Mar 2026 15:33:34 +0000 Subject: [PATCH] [#176] DonateWidget: show author address instead of story #ID Show truncated writer address in donation confirmation text instead of "story #2". Falls back to story ID if writer address unavailable. Story page passes writer_address from storyline data. Fixes #176 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/app/story/[storylineId]/page.tsx | 2 +- src/components/DonateWidget.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/story/[storylineId]/page.tsx b/src/app/story/[storylineId]/page.tsx index 2f2ac8f9..24773ea1 100644 --- a/src/app/story/[storylineId]/page.tsx +++ b/src/app/story/[storylineId]/page.tsx @@ -151,7 +151,7 @@ export default async function StoryPage({ params }: { params: Params }) { {sl.token_address && ( )} - + {sl.token_address && ( )} diff --git a/src/components/DonateWidget.tsx b/src/components/DonateWidget.tsx index 4cc1b28c..b0def4a0 100644 --- a/src/components/DonateWidget.tsx +++ b/src/components/DonateWidget.tsx @@ -8,14 +8,16 @@ import { publicClient } from "../../lib/rpc"; import { erc20Abi } from "../../lib/price"; import { storyFactoryAbi } from "../../lib/contracts/abi"; import { STORY_FACTORY, PLOT_TOKEN, IS_TESTNET, EXPLORER_URL } from "../../lib/contracts/constants"; +import { truncateAddress } from "../../lib/utils"; type TxState = "idle" | "approving" | "confirming" | "pending" | "indexing" | "done" | "error"; interface DonateWidgetProps { storylineId: number; + writerAddress?: string; } -export function DonateWidget({ storylineId }: DonateWidgetProps) { +export function DonateWidget({ storylineId, writerAddress }: DonateWidgetProps) { const { address, isConnected } = useAccount(); const [amount, setAmount] = useState(""); const [txState, setTxState] = useState("idle"); @@ -167,7 +169,7 @@ export function DonateWidget({ storylineId }: DonateWidgetProps) { {formatUnits(parsedAmount, 18)} {reserveLabel} {" "} - to story #{storylineId} + to {writerAddress ? truncateAddress(writerAddress) : `story #${storylineId}`}

)}