-
-
Notifications
You must be signed in to change notification settings - Fork 130
Fix home page sponsors section size #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add `className="w-full max-w-7xl"` to FadeIntoView wrapper for proper width constraints - Replace fixed `height` and `width` attributes with responsive Tailwind classes - Implement breakpoint-based height scaling: 1200px (mobile), 1000px (sm), 900px (md), 750px (lg), 667px (xl) - Set iframe to full width for better mobile experience - Improves layout consistency across different screen sizes and devices
…tMessage - Add useEffect hook to listen for postMessage events from OpenCollective - Implement dynamic height state that updates based on iframe content changes - Parse OpenCollective's "oc-" prefixed message format to extract height data - Add 10px buffer to calculated height to prevent scrollbars - Replace responsive Tailwind height classes with dynamic inline styles - Wrap iframe in container div with overflow-hidden for better containment - Add comprehensive JSDoc comment explaining iframe behavior and fallback mechanism - Validate message origin to only accept events from https://opencollective.com - Add error handling for JSON parsing failures with silent fallback - Improve accessibility and user experience by eliminating layout shifts
WalkthroughThe SponsorsSection component now dynamically adjusts the OpenCollective iframe height based on postMessage events from the embedded frame. A useState hook manages height with a 1200px default, and a useEffect listens for validated messages with an origin check, parsing payloads prefixed with "oc-", and applying the new height with a buffer offset. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Areas requiring extra attention:
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/components/pages/home/section/sponsors-section.tsx (2)
13-13: Consider removing the unused ref.The
iframeRefis created and assigned to the iframe but never accessed (e.g.,iframeRef.currentis not used anywhere). Unless you're planning to use it in the future, it can be removed.🔎 Proposed change to remove unused ref
- const iframeRef = useRef<HTMLIFrameElement>(null);And update line 57:
- ref={iframeRef}
34-36: Optional: Extract the buffer value to a named constant.The 10px buffer is a magic number. While the inline comment explains its purpose, extracting it to a named constant would improve readability.
🔎 Suggested refactor
At the top of the component:
const SponsorsSection = () => { + const HEIGHT_BUFFER = 10; // Buffer to prevent scrollbars const iframeRef = useRef<HTMLIFrameElement>(null);Then update line 36:
- setIframeHeight(Math.ceil(height) + 10); + setIframeHeight(Math.ceil(height) + HEIGHT_BUFFER);
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/pages/home/section/sponsors-section.tsx(1 hunks)
🔇 Additional comments (4)
src/components/pages/home/section/sponsors-section.tsx (4)
1-1: LGTM! Hook imports are appropriate.The imports of
useEffect,useRef, anduseStateare necessary for the dynamic height functionality and fully compatible with React 17.0.2.
5-11: LGTM! Clear and helpful documentation.The JSDoc comment effectively explains the dynamic resize mechanism and fallback behavior, which will help future maintainers understand the postMessage integration.
54-65: LGTM! Clean and accessible iframe implementation.The responsive width classes, overflow handling, dynamic height styling, and accessibility attributes (title and scrolling="no") are all correctly implemented. The wrapping structure properly manages the layout.
17-49: LGTM! Well-implemented message handler with proper security.The origin validation, cleanup logic, and empty dependency array are all correct. The message parsing and height extraction logic appear sound.
Note: The specific postMessage format from OpenCollective (including the "oc-" prefix and height/frameHeight properties) should be confirmed against their actual implementation, as this is not publicly documented in their official API documentation.
|
Visit the preview URL for this PR (updated for commit 9bac9cd): https://game-ci-5559f--pr526-fix-home-page-sponso-en32fmku.web.app (expires Fri, 26 Dec 2025 16:07:25 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 1f0574f15f83e11bfc148eae8646486a6d0e078b |
|
We need to also upgrade React version because there was a CVE recently. |

Changes
Fix OpenCollective sponsors section display issues
Problem:
Solution:
Results:
✅ Full-width display on all screen sizes
✅ Dynamic height that adapts to sponsor count changes
✅ No scrollbars or overflow issues
✅ Future-proof - no manual updates needed when sponsors change
The iframe now automatically resizes based on actual content height (1136px desktop, 1995px mobile) instead of using hardcoded values.
Checklist
code of conduct
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.