feat: add Instagram platform support#160
Conversation
WalkthroughInstagram is added as a supported share platform with its own icon, color, share URL, and fallback share flow that copies the current link before opening Instagram in a new tab. ChangesInstagram share support
Sequence Diagram(s)Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/social-share-button.js (2)
429-439: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winDon't report Instagram share success before the fallback succeeds.
For Instagram, the actual share flow is
copyLink()pluswindow.open(), but both can fail independently. The method still emitssocial_share_successand callsonShareunconditionally, so hosts can record false-positive share events for blocked popups or failed clipboard writes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/social-share-button.js` around lines 429 - 439, The share flow in the social share handler currently emits success unconditionally for the discord/instagram path, which can create false positives when copyLink() or window.open() fails. Update the sharing logic around the platform branch in social-share-button.js so social_share_success and onShare are only triggered after the actual fallback/share action completes successfully, especially for Instagram where copyLink() and the popup can fail independently. Use the existing platform checks and the share method’s emit/onShare flow to gate success reporting on a real successful result.
425-429: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate the edge-case comment for Instagram too.
The branch now covers Instagram, but the inline note still explains only Discord. This fallback is non-obvious logic, so the comment should also state why Instagram uses the copy-and-open path. As per path instructions,
src/**/*.{js,jsx}requires brief inline comments for non-obvious logic and edge cases.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/social-share-button.js` around lines 425 - 429, The inline comment above the platform-specific branch in social-share-button should be updated because it only explains Discord even though the condition also includes Instagram. Revise the note near the share trigger logic to mention both Discord and Instagram, and briefly explain why each uses the copy-to-clipboard plus navigation fallback so the edge-case rationale matches the actual branch behavior.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/social-share-button.js`:
- Around line 181-185: The Instagram platform definition is present, but it is
not reachable by default because the public default platform lists still omit
it. Update the core default platforms array and the React wrapper’s default so
they both include "instagram", and verify the defaults flow through the existing
platform selection logic in the social share button components. Keep the change
aligned with the platform registry entry named instagram so the feature is
enabled for out-of-the-box integrations.
---
Outside diff comments:
In `@src/social-share-button.js`:
- Around line 429-439: The share flow in the social share handler currently
emits success unconditionally for the discord/instagram path, which can create
false positives when copyLink() or window.open() fails. Update the sharing logic
around the platform branch in social-share-button.js so social_share_success and
onShare are only triggered after the actual fallback/share action completes
successfully, especially for Instagram where copyLink() and the popup can fail
independently. Use the existing platform checks and the share method’s
emit/onShare flow to gate success reporting on a real successful result.
- Around line 425-429: The inline comment above the platform-specific branch in
social-share-button should be updated because it only explains Discord even
though the condition also includes Instagram. Revise the note near the share
trigger logic to mention both Discord and Instagram, and briefly explain why
each uses the copy-to-clipboard plus navigation fallback so the edge-case
rationale matches the actual branch behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 39d5e6a9-3194-4949-9764-16b21f524448
📒 Files selected for processing (1)
src/social-share-button.js
| instagram:{ | ||
| name:"Instagram", | ||
| color:"#c03197", | ||
| icon: '<path d="M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077"/>' | ||
| }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Wire Instagram into the public defaults.
This entry is still unreachable for default integrations because the core default platforms list and the React wrapper default both omit "instagram". As shipped, users only get the new platform if they already know to opt in manually, which breaks the expected public API behavior for this feature.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/social-share-button.js` around lines 181 - 185, The Instagram platform
definition is present, but it is not reachable by default because the public
default platform lists still omit it. Update the core default platforms array
and the React wrapper’s default so they both include "instagram", and verify the
defaults flow through the existing platform selection logic in the social share
button components. Keep the change aligned with the platform registry entry
named instagram so the feature is enabled for out-of-the-box integrations.
Addressed Issues:
Fixes #159
Screenshots/Recordings:
Additional Notes:
Changes Made
Checklist
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.
Summary by CodeRabbit