Skip to content

Commit cbef10e

Browse files
ralyodioqwencoder
andcommitted
fix: make +X more clickable to expand all referral wallets
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent a0437a8 commit cbef10e

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

src/app/account/account-content.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default function AccountContent() {
3434
} | null>(null);
3535
const [referralWallets, setReferralWallets] = useState<ReferralWallet[]>([]);
3636
const [loadingWallets, setLoadingWallets] = useState(false);
37+
const [showAllWallets, setShowAllWallets] = useState(false);
3738

3839
const fetchReferralWallets = useCallback(async () => {
3940
const token = localStorage.getItem("tc_access_token");
@@ -310,15 +311,30 @@ export default function AccountContent() {
310311
<p className="text-tc-text-dim text-xs mt-1">Loading...</p>
311312
) : referralWallets.length > 0 ? (
312313
<div className="space-y-1 mt-1">
313-
{referralWallets.slice(0, 3).map((w) => (
314+
{(showAllWallets ? referralWallets : referralWallets.slice(0, 3)).map((w) => (
314315
<p key={w.cryptocurrency} className="text-white text-xs font-mono flex items-center gap-1">
315316
<span className="text-tc-green font-bold w-20 shrink-0">{w.cryptocurrency}</span>
316317
<span className="truncate">{w.wallet_address}</span>
317318
{w.is_primary && <span className="text-[10px] bg-tc-green/10 text-tc-green px-1 rounded"></span>}
318319
</p>
319320
))}
320-
{referralWallets.length > 3 && (
321-
<p className="text-tc-text-dim text-xs">+{referralWallets.length - 3} more</p>
321+
{!showAllWallets && referralWallets.length > 3 && (
322+
<button
323+
type="button"
324+
onClick={() => setShowAllWallets(true)}
325+
className="text-tc-green text-xs hover:underline cursor-pointer"
326+
>
327+
+{referralWallets.length - 3} more
328+
</button>
329+
)}
330+
{showAllWallets && referralWallets.length > 3 && (
331+
<button
332+
type="button"
333+
onClick={() => setShowAllWallets(false)}
334+
className="text-tc-text-dim text-xs hover:underline cursor-pointer"
335+
>
336+
▲ Collapse
337+
</button>
322338
)}
323339
</div>
324340
) : (

0 commit comments

Comments
 (0)