Skip to content

feat: Slowed down speed of slider and added pause on hover/click#315

Merged
Sachinchaurasiya360 merged 2 commits into
Sachinchaurasiya360:mainfrom
0411-bokilshruti:feat/placement-slider-speed-pause
May 21, 2026
Merged

feat: Slowed down speed of slider and added pause on hover/click#315
Sachinchaurasiya360 merged 2 commits into
Sachinchaurasiya360:mainfrom
0411-bokilshruti:feat/placement-slider-speed-pause

Conversation

@0411-bokilshruti
Copy link
Copy Markdown

@0411-bokilshruti 0411-bokilshruti commented May 17, 2026

Summary

The placement slider was moving too fast making it hard to read. This PR slows it down and adds the ability to pause it by hovering or clicking on it. This functionality is done by using Framer Motion's useAnimation hook.

Changes

  • Replaced direct animate and transition props with useAnimation controls in shape-landing-hero.tsx.
  • Added useRef to track paused state without causing re-renders.
  • Reduced slider speed (duration increased to 90) for comfortable reading.
  • Added mouseEntered handler — pauses animation on hover.
  • Added mouseLeft handler — resumes animation when mouse leaves.
  • Added onclicked handler — toggles pause/resume on click.
  • Wrapped motion.div inside a div with event handlers.
  • Added cursor-pointer class to indicate slider is interactive.

How to test

  1. Open the homepage.
  2. Scroll to the placement slider section.
  3. Observe the slider moving at a readable speed.
  4. Hover over the slider — it should pause.
  5. Move mouse away — it should resume.
  6. Click on the slider — it should toggle pause/resume.

Screenshots

Before

InternHack-vdo.mp4

After

InternHack.2.mp4

Summary by CodeRabbit

  • New Features
    • Marquee animations now support interactive controls: pause on mouse hover, resume when the cursor leaves, and toggle playback state with a click.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Warning

Rate limit exceeded

@0411-bokilshruti has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 34 minutes and 18 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 37a9edb1-b378-4b69-9056-e3836a52216a

📥 Commits

Reviewing files that changed from the base of the PR and between cfa3cc2 and 2c26e0a.

📒 Files selected for processing (1)
  • client/src/components/ui/shape-landing-hero.tsx
📝 Walkthrough

Walkthrough

The shape-landing-hero.tsx component's WinsMarquee is refactored to support interactive animation control. The component imports useAnimation and useRef to replace static animation props with a controller that responds to mouse hover and click events, allowing users to pause and resume the marquee animation dynamically.

Changes

Marquee Animation Interactivity

Layer / File(s) Summary
Animation controller setup
client/src/components/ui/shape-landing-hero.tsx
useRef and useAnimation hooks are imported. WinsMarquee animation logic is centralized in a useAnimation controller with an isPaused ref and helper functions (startAnimation, togglePause, mouse/click handlers) to manage continuous horizontal slide animation state.
Interactive pause/resume behavior
client/src/components/ui/shape-landing-hero.tsx
The marquee wrapper gains onMouseEnter, onMouseLeave, and onClick handlers that pause and resume the animation, with cursor-pointer styling added. The motion element's animate prop is switched from static inline animation to animate={controls}.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

type:design

Poem

🐰 A marquee dances, now under command,
Pause and resume at the flick of a hand,
With hooks in place, the animation flows,
Click to control where the content goes,
Interactive magic in one UI show! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: slowing down the slider speed and adding pause functionality on hover/click.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 (1)
client/src/components/ui/shape-landing-hero.tsx (1)

281-299: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove aria-hidden from the interactive marquee and add keyboard operability.

Line 283 marks the container as hidden from assistive tech, but Lines 294-299 make it clickable/interactive. This creates an unreachable control for keyboard/screen-reader users.

Suggested fix
-    <div
-      className="relative py-6 border-y border-stone-200 dark:border-white/10 bg-stone-100/60 dark:bg-white/2 overflow-hidden"
-      aria-hidden
-    >
+    <div className="relative py-6 border-y border-stone-200 dark:border-white/10 bg-stone-100/60 dark:bg-white/2 overflow-hidden">
@@
-      <div
+      <div
         onMouseEnter={mouseEnter}
         onMouseLeave={mouseLeave}
         onClick={onclicked}
+        onKeyDown={(e) => {
+          if (e.key === "Enter" || e.key === " ") {
+            e.preventDefault();
+            onclicked();
+          }
+        }}
+        role="button"
+        tabIndex={0}
+        aria-label="Pause or resume recent wins marquee"
         className="cursor-pointer"
       >
🤖 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 `@client/src/components/ui/shape-landing-hero.tsx` around lines 281 - 299, The
container currently has aria-hidden while also being interactive (uses
onclicked, mouseEnter, mouseLeave), making it inaccessible; remove aria-hidden
from the outer div and make the interactive marquee element keyboard-accessible
by adding role="button", tabIndex={0}, and an onKeyDown handler that triggers
onclicked for Enter/Space, plus use onFocus/onBlur (or call
mouseEnter/mouseLeave) to mirror hover behavior; update references to the
handlers (mouseEnter, mouseLeave, onclicked) accordingly and ensure the
cursor-pointer styling remains for visual affordance.
🤖 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 `@client/src/components/ui/shape-landing-hero.tsx`:
- Around line 259-277: The current handlers (mouseEnter, mouseLeave, onclicked)
use a single isPaused.current flag so mouseLeave always resumes via
startAnimation(), which can override a user’s click-to-pause. Introduce two
separate booleans (e.g., hoverPaused and clickPaused, or hoverPaused.current and
clickPaused.current alongside isPaused) and update mouseEnter to set
hoverPaused=true and stop controls, mouseLeave to set hoverPaused=false and only
call startAnimation() if clickPaused is false (i.e., combinedPaused =
hoverPaused || clickPaused is false), and update onclicked to toggle clickPaused
and start/stop based on the combined paused state; keep references to
controls.stop and startAnimation and replace uses of isPaused.current with the
combined state.

---

Outside diff comments:
In `@client/src/components/ui/shape-landing-hero.tsx`:
- Around line 281-299: The container currently has aria-hidden while also being
interactive (uses onclicked, mouseEnter, mouseLeave), making it inaccessible;
remove aria-hidden from the outer div and make the interactive marquee element
keyboard-accessible by adding role="button", tabIndex={0}, and an onKeyDown
handler that triggers onclicked for Enter/Space, plus use onFocus/onBlur (or
call mouseEnter/mouseLeave) to mirror hover behavior; update references to the
handlers (mouseEnter, mouseLeave, onclicked) accordingly and ensure the
cursor-pointer styling remains for visual affordance.
🪄 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: a6691d07-e7a1-49e4-a579-ddb529ab4bd1

📥 Commits

Reviewing files that changed from the base of the PR and between 3552efa and cfa3cc2.

📒 Files selected for processing (1)
  • client/src/components/ui/shape-landing-hero.tsx

Comment thread client/src/components/ui/shape-landing-hero.tsx
@Abfa41 Abfa41 added level:beginner Good for first-time contributors type:feature New feature implementation gssoc:approved Approved for GSSoC scoring labels May 18, 2026
@0411-bokilshruti
Copy link
Copy Markdown
Author

Hello @Sachinchaurasiya360 , just following up on this PR. Please let me know if any changes are needed or if you have any feedback. Happy to make any modifications required.

@Sachinchaurasiya360 Sachinchaurasiya360 merged commit 0194f16 into Sachinchaurasiya360:main May 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved for GSSoC scoring level:beginner Good for first-time contributors type:feature New feature implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants