Skip to content

Comments

fix: mobile drawer close-on-outside-click, navbar layout offset, testimonials error handling & leaderboard UI#1670

Merged
priyankarpal merged 2 commits intoreactplay:mainfrom
aniketmishra-0:fix/testimonials-carousel-swipe-navigation
Feb 11, 2026
Merged

fix: mobile drawer close-on-outside-click, navbar layout offset, testimonials error handling & leaderboard UI#1670
priyankarpal merged 2 commits intoreactplay:mainfrom
aniketmishra-0:fix/testimonials-carousel-swipe-navigation

Conversation

@aniketmishra-0
Copy link
Contributor

@aniketmishra-0 aniketmishra-0 commented Feb 8, 2026

Summary

This PR fixes multiple UI/UX issues across the mobile navigation drawer, fixed navbar layout, testimonials section, and leaderboard page.


Changes

1. Mobile Drawer — Close on Outside Click

Files: src/common/header/HeaderNav.jsx

  • Added useRef on the menu panel (<ul>) and a useEffect that listens for mousedown/touchstart events on document
  • When the drawer is open and user clicks/taps outside the menu panel, the drawer auto-closes
  • Cleaned up unused useCallback import

2. CSS transform Containing Block Fix

File: src/common/header/header.css

  • Changed .nav--visible from transform: translateY(0) to transform: none
  • Why: translateY(0) creates a new CSS containing block, which constrains position: fixed descendants (the drawer overlay) to the 64px header height instead of the full viewport

3. Fixed Navbar — Global Content Offset

File: src/common/header/header.css

  • Added .nav-wrapper ~ *:not(footer) { padding-top: 64px; } to push all page content below the fixed navbar
  • The :not(footer) ensures the footer doesn't get unwanted top padding

4. Home Hero — Extra Padding for Activity Banner

File: src/common/home/home.css

  • Added padding-top: 32px to .app-home-body for the activity banner offset (on top of the global 64px)

5. Testimonials — Error Handling

Files: src/common/Testimonial/TestimonialSection.jsx, src/common/Testimonial/Testimonials.jsx

  • Wrapped submit() calls in try/catch blocks
  • On failure: logs a warning and falls back to an empty array instead of crashing
  • Prevents unhandled promise rejections when the API returns 404

6. ESLint react/jsx-sort-props Fix

File: src/common/Testimonial/TestimonialSection.jsx

  • Moved shorthand boolean props (grabCursor, rewind) before all other props on the <Swiper> component per ESLint rule

7. Leaderboard — Centered Loading Spinner

Files: src/common/playleaderboard/LeaderBoard.jsx, src/common/playleaderboard/leaderBoard.css

  • Added import './leaderBoard.css' (was missing)
  • Added .leaderboard-loader styles: centered flex container with min-height: calc(100vh - 160px)
  • Removed app-body-overflow-hidden class from <main> to fix excessive bottom whitespace

Files Changed (8)

File Change
src/common/header/HeaderNav.jsx Click-outside drawer handler, useRef, cleanup
src/common/header/header.css Transform fix, global content offset rule
src/common/home/home.css Hero extra padding-top
src/common/Testimonial/TestimonialSection.jsx Error handling, prop sorting
src/common/Testimonial/Testimonials.jsx Error handling
src/common/playleaderboard/LeaderBoard.jsx CSS import, remove overflow-hidden
src/common/playleaderboard/leaderBoard.css Loader centering styles
package.json TypeScript version bump (dev dep)

Copilot AI review requested due to automatic review settings February 8, 2026 16:57
@netlify
Copy link

netlify bot commented Feb 8, 2026

Deploy Preview for reactplayio ready!

Name Link
🔨 Latest commit 845da22
🔍 Latest deploy log https://app.netlify.com/projects/reactplayio/deploys/698c4dc1dd805000089c234d
😎 Deploy Preview https://deploy-preview-1670--reactplayio.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! contributor, thank you for opening a Pull Request 🎉.

@reactplay/maintainers will review your submission soon and give you helpful feedback. If you're interested in continuing your contributions to open source and want to be a part of a welcoming and fantastic community, we invite you to join our ReactPlay Discord Community.
Show your support by starring ⭐ this repository. Thank you and we appreciate your contribution to open source!
Stale Marking : After 30 days of inactivity this issue/PR will be marked as stale issue/PR and it will be closed and locked in 7 days if no further activity occurs.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes mobile swipe interactions for the homepage Testimonials carousel by adjusting Swiper touch handling and nested scroll behavior. The PR also introduces a new “BMR & TDEE Calculator” play, which is unrelated to the stated carousel bugfix scope.

Changes:

  • Update Testimonials carousel configuration to better capture touch gestures on mobile.
  • Update testimonial quote container to allow vertical scrolling without blocking horizontal swipes.
  • Add a new “BMR & TDEE Calculator” play (component + styles + assets + README) and export it via src/plays/index.js.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/common/Testimonial/TestimonialSection.jsx Adds Swiper props (grabCursor, touchEventsTarget="container") to improve mobile swipe handling.
src/common/Testimonial/TestimonialCard.jsx Adds touchAction: 'pan-y' on the scrollable quote area to prevent it from capturing horizontal swipes.
src/plays/index.js Adds export for the new BMR/TDEE play (also broadens PR scope beyond the described bugfix).
src/plays/bmr-tdee-calculator/BmrTdeeCalculator.jsx New BMR/TDEE calculator play implementation.
src/plays/bmr-tdee-calculator/styles.css Styles for the new calculator play.
src/plays/bmr-tdee-calculator/cover.svg Cover asset for the new calculator play.
src/plays/bmr-tdee-calculator/Readme.md Documentation for the new calculator play (contains a formula inconsistency noted in comments).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aniketmishra-0
Copy link
Contributor Author

Scroll.Manually.webm

✅ Auto-play carousel
✅ Manual swipe (mobile touch)
✅ Navigation arrows (desktop)
✅ Keyboard navigation
✅ Vertical scroll inside testimonial card

@priyankarpal
Copy link
Member

@aniketmishra-0 there are some reviews by copilot can you please check?

@aniketmishra-0
Copy link
Contributor Author

Ofcourse

@aniketmishra-0 there are some reviews by copilot can you please check?

…y#1667)

- Add touchEventsTarget='container' to Swiper so touch listeners attach to container instead of wrapper
- Add grabCursor for visual drag feedback on desktop
- Fix className bug: home && 'h-32' → home ? 'h-32' : '' to prevent 'false' string in DOM
- Add touchAction: 'pan-y' on blockquote to allow horizontal swipes to pass through to Swiper

Closes reactplay#1667
@aniketmishra-0 aniketmishra-0 force-pushed the fix/testimonials-carousel-swipe-navigation branch from 0dd66f7 to f031618 Compare February 10, 2026 15:06
@aniketmishra-0
Copy link
Contributor Author

@priyankarpal check

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…rboard UI

- Fix mobile drawer not closing on outside click (useRef + click-outside listener)
- Fix CSS transform creating containing block issue (translateY(0) → none)
- Add global padding-top for fixed navbar offset (64px, excluding footer)
- Add extra home hero padding for activity banner
- Add try/catch error handling in testimonial fetches
- Fix ESLint jsx-sort-props (shorthand booleans first)
- Center leaderboard loading spinner
- Remove overflow-hidden from leaderboard page
- Import leaderBoard.css in LeaderBoard component
@aniketmishra-0 aniketmishra-0 changed the title fix: Testimonials Carousel Swipe Navigation Stuck on Mobile #1667 fix: mobile drawer close-on-outside-click, navbar layout offset, testimonials error handling & leaderboard UI Feb 11, 2026
@aniketmishra-0
Copy link
Contributor Author

@priyankarpal

Could you please review the changed code?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/common/playleaderboard/LeaderBoard.jsx:78

  • topContributorOfTheMonth is initialized as [], which is truthy. As soon as publishedPlays loads (before the monthly contributor fetch resolves), the render path will mount TopPlayCreatorOfTheMonth with an array, and that component immediately dereferences topPlayCreatorOfTheMonth.avatarUrl/displayName, causing a runtime crash. Initialize topContributorOfTheMonth to null/undefined (or {}) and tighten the render condition to only render when the expected fields are present (e.g., check topContributorOfTheMonth?.avatarUrl).
      {publishedPlays.length && (topContributorOfTheMonth || top10Contributors) ? (
        <div className=" overflow-auto lg:flex flex-row justify-center">
          {topContributorOfTheMonth && (
            <TopPlayCreatorOfTheMonth topPlayCreatorOfTheMonth={topContributorOfTheMonth} />
          )}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aniketmishra-0
Copy link
Contributor Author

@copilot open a new pull request to apply changes based on the comments in this thread

@priyankarpal priyankarpal merged commit 06ffd2a into reactplay:main Feb 11, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants