added disclaimer, and added share campaign feature#16
added disclaimer, and added share campaign feature#16OmRudraprasanna wants to merge 1 commit intoStabilityNexus:mainfrom
Conversation
WalkthroughTwo new React components are introduced: a Disclaimer modal that auto-opens on app load with a closeable overlay, and a ShareBtn that copies the current campaign URL to the clipboard with user feedback. These components are integrated into the App and Details pages respectively. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (6)
src/Disclaimer.tsx (2)
3-11: Avoid the “mount → open” state flip; consider persisting acknowledgement.
TheuseEffectthat immediately setsisOpen(true)adds an extra render and can create a brief flash; you can initialize open state directly. Also consider storing an “accepted” flag (e.g.,localStorage) so users don’t see this on every reload.
12-34: Modal needs basic a11y + keyboard handling (dialog role, labels, ESC, focus).
Right now it’s visually a modal but missingrole="dialog",aria-modal, label/description wiring, and an ESC close path / initial focus management.src/App.tsx (1)
19-19: Top-level Disclaimer integration looks fine; watch z-index conflicts.
Rendering it above the router is reasonable for a global gate, butz-[9999]may mask other overlays (e.g., RainbowKit modals) if both ever show at once.Also applies to: 50-55
src/ShareBtn.tsx (1)
22-43: Add minimal a11y for the “copied” feedback.
Consideraria-live="polite"(or an offscreen status element) so “Link Copied!” is announced, and optionallytype="button"to avoid unintended form submits if used inside a<form>.src/Details.tsx (2)
14-15: Drop the “Already imported correctly” comment.
It’ll age poorly and doesn’t add intent.
255-263: Remove the redundant nested condition aroundVaultActions/ShareBtn.
This block is already inside the same{balanceOfVault.data && symbol && vaultDetails && (...)}check earlier, so the extra guard is duplicative and makes future edits riskier.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
src/App.tsx(5 hunks)src/Details.tsx(5 hunks)src/Disclaimer.tsx(1 hunks)src/ShareBtn.tsx(1 hunks)
🔇 Additional comments (1)
src/App.tsx (1)
26-31: No SSR violations detected in current codebase.The
windowandnavigatorusage in ShareBtn.tsx is confined to thehandleShareevent handler, which only executes on click (client-side). Thedocumentreference in main.tsx is the standard React entry point hydration. No render-time or module-initialization browser API usage was found that would break SSR.Likely an incorrect or invalid review comment.
| const handleShare = () => { | ||
| // 1. Get the current URL | ||
| const currentUrl = window.location.href; | ||
|
|
||
| // 2. Copy to clipboard | ||
| navigator.clipboard.writeText(currentUrl).then(() => { | ||
| // 3. Change button state to show feedback | ||
| setCopied(true); | ||
|
|
||
| // 4. Reset after 2 seconds | ||
| setTimeout(() => { | ||
| setCopied(false); | ||
| }, 2000); | ||
| }); | ||
| }; |
There was a problem hiding this comment.
Handle clipboard failures + clear/reset timers to avoid stale updates.
writeText can reject (permissions/unsupported), and repeated clicks can stack timeouts; consider try/catch + fallback and clearing the previous timer (and on unmount).
Added a Disclaimer popup on the home page.
Added a Disclaimer popup on the home page.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.