Skip to content

[#1254] Build ReferralCTA.tsx (link + copy + share)#1292

Merged
realproject7 merged 2 commits into
mainfrom
task/1254-referral-cta
May 26, 2026
Merged

[#1254] Build ReferralCTA.tsx (link + copy + share)#1292
realproject7 merged 2 commits into
mainfrom
task/1254-referral-cta

Conversation

@realproject7

Copy link
Copy Markdown
Owner

Summary

  • Fetches referral code via unauth GET /api/airdrop/referral-code?address=X (Risk A preserved — no SIWE for display)
  • Displays referral URL https://plotlink.xyz/?ref=CODE with truncated preview
  • Copy button with clipboard API + execCommand fallback for mobile
  • X share intent button with prefilled multiplier benefit text
  • Graceful empty state when code not yet available
  • Multiplier benefit hint: "+0.2 per qualified referral (up to 3.0×)"

Version

1.38.0 → 1.39.0 (feature)

Closes #1254

🤖 Generated with Claude Code

Fetches referral code via unauth GET /api/airdrop/referral-code.
Shows referral URL with copy-to-clipboard (desktop + mobile
fallback) and X share intent button. Multiplier benefit hint.
Graceful empty state when code not yet created.

Closes #1254

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored May 26, 2026 10:05am

Request Review

@realproject7 realproject7 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@re2 review — APPROVE ✅

Checked against issue #1254 acceptance criteria:

Criterion Status
Unauth GET for ref code display (Risk A preserved) ✅ no SIWE
Copy works desktop + mobile ✅ clipboard API + execCommand fallback
X share intent with prefilled text ✅ encoded URL + share text
Graceful empty state (no code yet)
Multiplier benefit hint ✅ "+0.2 per qualified referral (up to 3.0×)"
Version 1.38.0 → 1.39.0 (feature)

Code notes:

  • Proper cleanup with cancelled flag
  • Truncated URL display for mobile responsiveness
  • 2-second copy confirmation feedback
  • Share text suggests multiplier benefit for both parties
  • Only renders in Mining state (parent state machine gates this)

No issues found.

@project7-interns project7-interns left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES

Summary

The component uses the correct unauthenticated GET endpoint and implements copy/share UI, but it can display and share the wrong wallet’s referral link after wallet changes or a { code: null } response.

Findings

  • [high] Referral code state is never cleared when the current wallet has no code.
    • File: src/components/airdrop/ReferralCTA.tsx:17
    • The GET endpoint intentionally returns 200 { code: null } when no code exists. This handler only calls setCode when d?.code is truthy, so if wallet A has a code and the user switches to wallet B with no code, the old code remains rendered and the Copy/Share buttons continue promoting wallet A’s referral link. The same stale state can persist on disconnect until the parent unmounts.
    • Suggestion: track the fetch result by address and set code to d?.code ?? null for every completed request, and clear/derive empty state when !isConnected || !address. This also gives the documented graceful { code: null } path.

Decision

Requesting changes until referral code state is keyed/cleared so the displayed link always belongs to the active wallet. CI was still pending at review time.

Track fetched address in state so code clears automatically when
wallet changes. Derive displayed code from address match instead
of sync setState in effect.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@project7-interns project7-interns left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The requested stale-code issue is resolved. ReferralCTA now keys the fetched code by active address and treats { code: null } as an empty result, so wallet switches cannot continue showing another wallet’s referral link.

Findings

  • None blocking.

Decision

Approving PR #1292. The component uses the unauthenticated display endpoint, provides copy/share behavior, handles the empty-code state correctly, remains mining-gated by the parent state machine, and latest CI is green.

@realproject7 realproject7 merged commit 855369b into main May 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[T3.5] Implement ReferralCTA.tsx (link + copy + share)

2 participants