From 78705c03b9397026ca36a21a92d8877e7dd0e0d2 Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Mon, 16 Mar 2026 15:23:04 +0000 Subject: [PATCH] [#175] Show Claim Royalties always with disabled state and tooltip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove early return null — section always visible in writer dashboard - Claim button disabled when plotCount < 2 or unclaimed === 0 - Info icon (ⓘ) with hover/tap tooltip explaining royalties, unlock conditions, and current status with dynamic values - Shows unlock hint: "Chain N more plots to unlock royalties" - Unclaimed amount always displayed even when 0 Fixes #175 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/ClaimRoyalties.tsx | 80 +++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 26 deletions(-) diff --git a/src/components/ClaimRoyalties.tsx b/src/components/ClaimRoyalties.tsx index c6aca146..e0403d5c 100644 --- a/src/components/ClaimRoyalties.tsx +++ b/src/components/ClaimRoyalties.tsx @@ -21,6 +21,7 @@ export function ClaimRoyalties({ tokenAddress, plotCount, beneficiary }: ClaimRo const [error, setError] = useState(null); const [claimedAmount, setClaimedAmount] = useState(BigInt(0)); const [txHash, setTxHash] = useState(null); + const [showTooltip, setShowTooltip] = useState(false); const { writeContractAsync } = useWriteContract(); @@ -43,6 +44,7 @@ export function ClaimRoyalties({ tokenAddress, plotCount, beneficiary }: ClaimRo const unclaimed = royaltyInfo?.unclaimed ?? BigInt(0); const eligible = plotCount >= 2; + const canClaim = eligible && unclaimed > BigInt(0); const executeClaim = useCallback(async () => { try { @@ -74,41 +76,67 @@ export function ClaimRoyalties({ tokenAddress, plotCount, beneficiary }: ClaimRo setError(null); }, []); - // Don't show if no royalties to claim - if (unclaimed === BigInt(0) && txState === "idle") return null; - return (
-
+
- Unclaimed Royalties + Royalties - + {/* Info icon with tooltip */} +
+ + {showTooltip && ( +
+

Royalties

+

+ You earn a share of every trade on your storyline's token. +

+

To claim:

+
    +
  • + Chain at least 2 plots ({plotCount}/2) +
  • +
  • + Unclaimed > 0 ({formatUnits(unclaimed, 18)} {reserveLabel}) +
  • +
+
+ )} +
+ {formatUnits(unclaimed, 18)} {reserveLabel}
- {eligible ? ( - - ) : ( - - Chain plot #1 to unlock - - )} +
+ {!eligible && txState === "idle" && ( +

+ Chain {2 - plotCount} more {2 - plotCount === 1 ? "plot" : "plots"} to unlock royalties +

+ )} {txHash && txState === "done" && (

Tx:{" "}