Add referral link copy fallback - #130
Conversation
Greptile SummaryThis PR guards
Confidence Score: 3/5The fallback copy logic itself is functionally sound, but the copy error message appears inside the Send Invites card rather than near the Copy button, and clicking Copy clears any unrelated send-invites error — both of which affect real user-facing behavior. The core src/app/dashboard/referrals/page.tsx — the error state and its render site need to be scoped to their respective operations Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User clicks Copy] --> B[setError null]
B --> C[copyText called]
C --> D{navigator.clipboard\n?.writeText exists?}
D -- Yes --> E[navigator.clipboard.writeText]
E -- Success --> F[return]
E -- Throws --> G[catch: fall through]
D -- No --> H[textarea fallback]
G --> H
H --> I[document.body.appendChild textarea]
I --> J[textarea.select]
J --> K[document.execCommand copy]
K -- returns true --> L[remove textarea\nreturn]
K -- returns false --> M[throw Error\nremove textarea]
F --> N[setCopied true\nsetTimeout reset]
L --> N
M --> O[catch in copyLink]
O --> P[setCopied false\nsetError shown in\nSend Invites card ⚠️]
|
Summary
navigator.clipboard.writeTextis unavailable or rejectsFixes #129
Validation
pnpm test:run src/app/dashboard/referrals/page.test.tsxpnpm type-checkpnpm exec eslint src/app/dashboard/referrals/page.tsx src/app/dashboard/referrals/page.test.tsxgit diff --checkBounty / payment
Submitted for the active uGig affiliate-program testing task. SOL receive address:
27sdMYXofqoM9qR13bZhccRNYeEgYn5EoHXTSJn4QWKP.Payment fallback: PayPal cultofrozen@gmail.com