feat: add scroll-to-top button on explore page#44
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughExplorePage now tracks vertical scroll position using a ChangesScroll-to-Top Button Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
🚀 PR Received SuccessfullyHello @Harkiratcodess, Thank you for taking the initiative to contribute to this project. Please ensure that your PR follows all project guidelines properly before requesting review.
|
|
@Harkiratcodess |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@frontend/src/pages/ExplorePage.jsx`:
- Around line 19-30: The effect that registers the scroll listener doesn't
initialize the scroll state on mount, so if the page starts with window.scrollY
> 500 the show-scroll button remains hidden until the next scroll; inside the
useEffect after adding the listener call the handleScroll function once to
initialize state (referencing the handleScroll function, useEffect hook, and
setShowScrollTop state updater) so the visibility is correct on mount/restored
navigations.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 37d06525-6526-4532-97b4-e03c0febc406
📒 Files selected for processing (1)
frontend/src/pages/ExplorePage.jsx
Closes #3
added a scroll-to-top button pretty straightforward but needed some care to get right.
It stays hidden until you've scrolled past 500px, so it doesn't clutter the hero section on load. Once it shows up, clicking it smoothly brings you back to the top using window.scrollTo.
Styled it to match the existing brutalist design fixed to the bottom-right, black/white, thick borders, snappy hover. Fits right in without looking bolted on.
Under the hood it's just useState and useEffect with a scroll listener. Made sure to clean up the listener properly so there are no memory leaks hanging around.
Screen.Recording.2026-05-15.011244.mp4
Summary by CodeRabbit