Skip to content

Conversation

@ronitsantwani
Copy link

@ronitsantwani ronitsantwani commented Oct 2, 2025

i have changed "Welcome to VigyBag" into typing annimation in the main website

Summary by CodeRabbit

  • New Features
    • Added an animated typing effect to the homepage hero title for a more engaging first impression.
    • Includes a blinking cursor to simulate real-time typing.
    • Highlights key text in the title for emphasis (e.g., “VigyBag!” appears accented).
    • Smoothly completes the animation and retains the final text; no changes to navigation, search, or subscription features.

@vercel
Copy link

vercel bot commented Oct 2, 2025

@ronitsantwani is attempting to deploy a commit to the Vivek Prajapati's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 2, 2025

Walkthrough

Adds a new TypingAnimation React component with typing and cursor-blink effects, then integrates it into the Home page hero heading to render "Welcome to VigyBag!" with optional highlighting and on-complete callback support.

Changes

Cohort / File(s) Summary
TypingAnimation component (new)
src/User/components/TypingAnimation/TypingAnimation.jsx
Introduces a functional component that types text character-by-character at a configurable speed, toggles a blinking cursor, optionally highlights a given substring, and invokes an onComplete callback when typing finishes. Default props set for speed, cursor visibility/blink rate, classes, and highlighting.
Home page integration
src/User/pages/Home/Home.jsx
Imports and uses TypingAnimation in the hero heading to render "Welcome to VigyBag!" with cursor and highlight styling. No other page logic altered.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Home as Home.jsx
  participant TA as TypingAnimation
  participant TypingFX as Typing Effect (setInterval)
  participant CursorFX as Cursor Blink (setInterval)
  participant State as Component State

  User->>Home: Load page
  Home->>TA: Render with props (text, speed, showCursor, highlight...)
  TA->>State: Initialize displayedText="", index=0, cursorVisible=true
  TA->>TypingFX: Start interval (every speed ms)
  TA->>CursorFX: Start interval (every cursorBlinkSpeed ms) when showCursor

  loop While index < text.length
    TypingFX->>State: Append next char, increment index
    TA-->>User: Rerender with updated displayedText
  end

  TypingFX->>TA: Detect completion
  TA->>TypingFX: Clear interval
  alt onComplete provided
    TA->>Home: Invoke onComplete()
  else No callback
    TA-->>User: Idle with blinking cursor
  end

  loop While showCursor
    CursorFX->>State: Toggle cursorVisible
    TA-->>User: Rerender caret visibility
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

I tap-tap type with whisker’d grace,
A blinking caret keeps the pace—
“Welcome to VigyBag!” I cheer,
Letters hop, then all is clear.
Green highlights twinkle, bright and spry,
A bunny’s code says hi 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description does not follow the repository template because it lacks the “Fixes Issue” section linking to the issue, the “Changes proposed” section detailing modifications, and optional screenshots or notes. It only provides a brief informal sentence and omits required structured content. As a result it fails to provide reviewers with the standardized context and details expected. Please revise the description to use the template by adding a “Fixes Issue” line (e.g. “Closes #2491”), a detailed “Changes proposed” section that outlines the addition of TypingAnimation and updates to the Home component, and include screenshots or reviewer notes as applicable.
Title Check ❓ Inconclusive The current title references an issue number and vaguely mentions code changes without conveying the actual feature added. It fails to describe the introduction of the TypingAnimation component or the update to the homepage text. Therefore it is too generic to inform a reviewer of the main change. Please update the title to a concise summary of the main change, for example “Add TypingAnimation effect to Homepage header” or similar, so it clearly reflects the feature introduced.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
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

🧹 Nitpick comments (1)
src/User/components/TypingAnimation/TypingAnimation.jsx (1)

3-12: Consider adding prop validation.

The component lacks PropTypes or TypeScript types. The required text prop and numeric props like speed and cursorBlinkSpeed have no validation, which could cause runtime errors if invalid values are passed.

Consider adding PropTypes:

+import PropTypes from 'prop-types';
+
 const TypingAnimation = ({ 
   text, 
   speed = 100, 
   showCursor = true, 
   cursorBlinkSpeed = 530,
   className = "",
   onComplete = null,
   highlightText = null,
   highlightClass = "text-green-700"
 }) => {

Add validation at the end of the file:

TypingAnimation.propTypes = {
  text: PropTypes.string.isRequired,
  speed: PropTypes.number,
  showCursor: PropTypes.bool,
  cursorBlinkSpeed: PropTypes.number,
  className: PropTypes.string,
  onComplete: PropTypes.func,
  highlightText: PropTypes.string,
  highlightClass: PropTypes.string
};
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94e346a and 07505d7.

📒 Files selected for processing (2)
  • src/User/components/TypingAnimation/TypingAnimation.jsx (1 hunks)
  • src/User/pages/Home/Home.jsx (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/User/pages/Home/Home.jsx (1)
src/User/components/TypingAnimation/TypingAnimation.jsx (1)
  • TypingAnimation (3-90)
🔇 Additional comments (6)
src/User/pages/Home/Home.jsx (2)

10-10: LGTM!

The import statement is correctly structured and follows standard React patterns.


151-161: LGTM!

The TypingAnimation integration is well-configured with appropriate props for the hero heading. The highlight styling and timing parameters enhance the user experience.

src/User/components/TypingAnimation/TypingAnimation.jsx (4)

13-16: LGTM!

The state initialization is appropriate for the typing animation effect, with sensible default values.


36-44: LGTM!

The cursor blinking logic is correctly implemented with proper cleanup.


47-73: LGTM!

The highlight rendering logic correctly handles multiple occurrences of the highlight text and prevents rendering empty spans.


75-89: LGTM!

The rendering logic is well-structured with appropriate accessibility attributes and responsive cursor styling.

Comment on lines +19 to +33
useEffect(() => {
if (currentIndex < text.length) {
const timeout = setTimeout(() => {
setDisplayText(prev => prev + text[currentIndex]);
setCurrentIndex(prev => prev + 1);
}, speed);

return () => clearTimeout(timeout);
} else if (!isComplete) {
setIsComplete(true);
if (onComplete) {
onComplete();
}
}
}, [currentIndex, text, speed, onComplete, isComplete]);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add reset logic when text prop changes.

If the text prop changes mid-animation, the effect doesn't reset currentIndex or displayText, causing the new text to concatenate with the old text. This leads to incorrect display.

Apply this diff to reset state when text changes:

+  // Reset animation when text changes
+  useEffect(() => {
+    setDisplayText('');
+    setCurrentIndex(0);
+    setIsComplete(false);
+  }, [text]);
+
   // Typing effect
   useEffect(() => {
     if (currentIndex < text.length) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
if (currentIndex < text.length) {
const timeout = setTimeout(() => {
setDisplayText(prev => prev + text[currentIndex]);
setCurrentIndex(prev => prev + 1);
}, speed);
return () => clearTimeout(timeout);
} else if (!isComplete) {
setIsComplete(true);
if (onComplete) {
onComplete();
}
}
}, [currentIndex, text, speed, onComplete, isComplete]);
// Reset animation when text changes
useEffect(() => {
setDisplayText('');
setCurrentIndex(0);
setIsComplete(false);
}, [text]);
// Typing effect
useEffect(() => {
if (currentIndex < text.length) {
const timeout = setTimeout(() => {
setDisplayText(prev => prev + text[currentIndex]);
setCurrentIndex(prev => prev + 1);
}, speed);
return () => clearTimeout(timeout);
} else if (!isComplete) {
setIsComplete(true);
if (onComplete) {
onComplete();
}
}
}, [currentIndex, text, speed, onComplete, isComplete]);
🤖 Prompt for AI Agents
In src/User/components/TypingAnimation/TypingAnimation.jsx around lines 19 to
33, the effect doesn't reset state when the text prop changes, causing new text
to append to the old display; add logic to reset the typing state when text
changes — either add a separate useEffect that watches text and calls
setCurrentIndex(0), setDisplayText(''), and setIsComplete(false), or in the
existing effect detect a change in text via a ref/previousText variable and
perform the same resets before starting the new timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant