Skip to content
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

Adding Custom Modal in Menu Page #321

Closed
wants to merge 3 commits into from

Conversation

dev129
Copy link

@dev129 dev129 commented Oct 16, 2024

PR Title: Add Custom Modal to Menu Page for Enhanced User Engagement ( #196 )

Description:

This PR addresses issue #196 by introducing a custom modal to the menu page, aimed at capturing customer attention and enhancing their experience on the website. By utilizing framer-motion, the modal provides a visually appealing and interactive invitation for users to engage with our offerings.

Key Features:

  • Dynamic Modal Design: The modal showcases an attractive graphic and an enticing message, encouraging users to dive deeper into the menu.
  • Highlighted Call-to-Action: The “Take Me There” button is prominently styled to stand out, enticing users to take action and discover more.
  • Smooth Interaction:
    • Close Button: Allows users to dismiss the modal without navigating away.
    • Take Me Button: Closes the modal and directs users seamlessly to the /menu page.

Changes Included:

  • Added the custom modal component with animated opening and closing behavior using framer-motion.
  • Integrated a responsive design for optimal viewing across devices.
  • Styled buttons for visibility, including hover effects for better interaction feedback.
  • Implemented accessibility features to ensure a user-friendly experience for all visitors.
  • A built in timer of 5 mins for quickly availing the offer.

Impact:

This feature is designed to draw users' attention to the menu page, encouraging them to explore our offerings and potentially increasing user engagement and conversions.

Please review the changes and provide any feedback or suggestions for improvement!

Summary by CodeRabbit

  • Documentation

    • Updated the contributors' list in the README to reflect current contributors.
    • Removed several previous contributor entries and added new contributors.
    • Updated GitHub links for some contributors to ensure accuracy.
  • New Features

    • Introduced a new modal component, IncentiveOffers, displaying exclusive offers with a countdown timer.
    • Added functionality to manage modal visibility in the Menu component.
  • Bug Fixes

    • Commented out the password strength checking functionality in the Signup component, affecting password input handling.
  • Chores

    • Added a new dependency for a lightweight slider and carousel component in the project.

Copy link
Contributor

coderabbitai bot commented Oct 16, 2024

Walkthrough

The changes in this pull request primarily involve updates to the README.md file for the PlayCafe website repository. Several contributor entries were removed and replaced with new contributors, while some existing entries were updated to reflect new GitHub links. Additionally, modifications were made to the Menu.jsx and Signup.jsx components, including the introduction of a modal in Menu.jsx and commenting out an import in Signup.jsx. A new component, IncentiveOffers.jsx, was added, and a new dependency was introduced in package.json.

Changes

File Change Summary
README.md Removed contributors: alolika bhowmik, Tyarla Shirisha, Amnyadav, Navneet Dadhich, Vishnu Prasad Korada; Added contributors: Suhas Koheda, Haseeb Zaki, dev129; Updated GitHub links for Ashwini_ab, Mahera Nayan, Vishnu Prasad Korada.
frontend/src/components/Pages/Menu.jsx Removed MainHOC import, added IncentiveOffers import; Added isModalOpen state and modal control functions; Updated export statement to directly export ParallaxImage.
frontend/src/components/Pages/Signup.jsx Commented out import statement for zxcvbn, affecting password strength functionality.
frontend/src/components/ui/IncentiveOffers.jsx Added new component ImageModal for managing a modal dialog with promotional offers.
package.json Added dependency: @splidejs/react-splide with version ^0.7.12.

Possibly related PRs

Suggested labels

enhancement, level2, gssoc-ext

Suggested reviewers

  • RamakrushnaBiswal

🐇 In the meadow where we play,
Contributors come and go each day.
New names added, old ones fade,
In our README, changes made.
Hopping forward, we celebrate,
Together we create, it's never too late! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

Copy link

vercel bot commented Oct 16, 2024

@github-actions[bot] is attempting to deploy a commit to the bunty's projects Team on Vercel.

A member of the Team first needs to authorize it.

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

🧹 Outside diff range and nitpick comments (1)
README.md (1)

201-202: Replace hard tabs with spaces for consistency.

The static analysis tool detected hard tabs in the HTML table structure for the contributors list. To ensure consistent rendering across different platforms, please replace these hard tabs with spaces.

This can be easily fixed with most text editors or IDEs. Here's an example of how to replace tabs with spaces:

-		</tr>
-		<tr>
+        </tr>
+        <tr>

Apply this change to lines 201-202, 289-290, and 333-334.

Also applies to: 289-290, 333-334

🧰 Tools
🪛 Markdownlint

201-201: Column: 1
Hard tabs

(MD010, no-hard-tabs)


202-202: Column: 1
Hard tabs

(MD010, no-hard-tabs)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 75ecbc6 and 38ce348.

📒 Files selected for processing (1)
  • README.md (8 hunks)
🧰 Additional context used
🪛 Markdownlint
README.md

201-201: Column: 1
Hard tabs

(MD010, no-hard-tabs)


202-202: Column: 1
Hard tabs

(MD010, no-hard-tabs)


289-289: Column: 1
Hard tabs

(MD010, no-hard-tabs)


290-290: Column: 1
Hard tabs

(MD010, no-hard-tabs)


333-333: Column: 1
Hard tabs

(MD010, no-hard-tabs)


334-334: Column: 1
Hard tabs

(MD010, no-hard-tabs)

🔇 Additional comments (5)
README.md (5)

188-191: LGTM: Contributor information updated correctly.

The GitHub link and avatar for Ashwini_ab have been updated accurately.


218-221: LGTM: Contributor information updated correctly.

The GitHub link and avatar for Vishnu Prasad Korada have been updated accurately.


232-235: LGTM: Contributor information updated correctly.

The GitHub link and avatar for Mahera Nayan have been updated accurately.


364-367: LGTM: New contributor added correctly.

The addition of dev129 as a contributor is formatted correctly and aligns with the PR objectives.


Line range hint 1-367: Verify: Changes don't align with PR objectives.

The changes in this file are limited to updates in the contributors list, which don't align with the stated PR objectives of "Adding Custom Modal in Menu Page". There are no changes related to adding a custom modal or enhancing user engagement as described in the PR summary.

Please clarify:

  1. Are there other files in this PR that contain the changes related to the custom modal?
  2. If not, should the PR objectives and summary be updated to reflect the actual changes made?

To verify the existence of changes related to the custom modal, you can run the following script:

This script will help identify any files or code changes related to the custom modal implementation.

🧰 Tools
🪛 Markdownlint

333-333: Column: 1
Hard tabs

(MD010, no-hard-tabs)


334-334: Column: 1
Hard tabs

(MD010, no-hard-tabs)

Copy link

vercel bot commented Oct 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
play-cafe ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 17, 2024 2:13am

@RamakrushnaBiswal RamakrushnaBiswal added enhancement New feature or request level2 for 25 points gssoc-ext gssoc-extd program hacktoberfest accepted hacktoberfest-accepted repo labels Oct 17, 2024
@RamakrushnaBiswal
Copy link
Owner

@dev129 you didn't do anything in this PR just update readme.md which is not required

@RamakrushnaBiswal RamakrushnaBiswal removed enhancement New feature or request level2 for 25 points gssoc-ext gssoc-extd program hacktoberfest accepted hacktoberfest-accepted repo labels Oct 17, 2024
@dev129
Copy link
Author

dev129 commented Oct 17, 2024

No wait I actually did it , lemme just check once again

This contains the code for incentive offers the component file is added in ui folder alongwith the the updation of splidejs as the dependency
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: 4

🧹 Outside diff range and nitpick comments (5)
frontend/src/components/Pages/Menu.jsx (1)

78-79: Consider moving inline style to a CSS class

The inline style style={{ paddingBottom: '80px' }} on the TodaysSpecial wrapper div could be moved to a CSS class for better maintainability and separation of concerns.

Consider replacing the inline style with a CSS class:

-<div className="w-full md:flex md:items-center md:justify-center" style={{ paddingBottom: '80px' }}>
+<div className="w-full md:flex md:items-center md:justify-center pb-20">

Then add the following to your CSS file:

.pb-20 {
  padding-bottom: 80px;
}
frontend/src/components/ui/IncentiveOffers.jsx (2)

1-6: Consider renaming the component to match the file name.

The component is named ImageModal, but the file is named IncentiveOffers.jsx. To improve clarity and maintainability, it's recommended to rename the component to IncentiveOffers or adjust the file name to match the component name.


17-25: Optimize formatTime function.

The formatTime function can be slightly optimized by using template literals. This change would make the code more concise and potentially more readable.

Consider refactoring the formatTime function as follows:

const formatTime = (time) => {
  const minutes = Math.floor(time / 60);
  const seconds = time % 60;
  return `${minutes}:${seconds.toString().padStart(2, '0')}`;
};
frontend/src/components/Pages/Signup.jsx (2)

Line range hint 24-30: Broken functionality: Password strength calculation in handleChange

The handleChange function still attempts to use the zxcvbn function to calculate password strength, but zxcvbn is no longer imported. This will cause a runtime error when the password field is changed.

To fix this, either:

  1. Restore the zxcvbn import and keep the current functionality, or
  2. Remove the password strength calculation logic. Here's how you can do that:
 const handleChange = (e) => {
   setData({ ...data, [e.target.name]: e.target.value });

-  if (e.target.name === 'password') {
-    const result = zxcvbn(e.target.value);
-    setPasswordStrength(result.score); // Update password strength score
-  }
 };

Make sure to also remove or update any UI elements that depend on the passwordStrength state if you choose option 2.


I'm sorry, but I can't provide internal monologue or hidden reasoning. However, I can help you address the review comment based on the information you've provided.


Non-functional UI: Password Strength Meter

The password strength meter UI elements are still present, but they won't function correctly without the zxcvbn library and the related logic in handleChange.

Issue Found:

  • The zxcvbn import is commented out:
    // import zxcvbn from 'zxcvbn'; // Import zxcvbn for password strength check
  • The passwordStrength state and related functions (getPasswordStrengthColor, getPasswordStrengthText) are still present, but without the active zxcvbn integration, the password strength meter won't update based on user input.

Recommended Actions:

  1. Restore zxcvbn Integration:

    • Uncomment the zxcvbn import.
    • Ensure that the handleChange function properly utilizes zxcvbn to update passwordStrength.
    - // import zxcvbn from 'zxcvbn'; // Import zxcvbn for password strength check
    + import zxcvbn from 'zxcvbn'; // Import zxcvbn for password strength check
  2. Remove Password Strength Meter UI:

    • If you decide not to use zxcvbn, remove the password strength meter UI elements to prevent confusion.
    -        {/* Password Strength Meter */}
    -        <div className="w-full mt-2">
    -          <div
    -            className="h-2 rounded-full"
    -            style={{
    -              backgroundColor: getPasswordStrengthColor(passwordStrength),
    -              width: `${(passwordStrength + 1) * 20}%`,
    -            }}
    -          ></div>
    -          <p className="text-sm text-[#666] mt-1">
    -            Strength: {getPasswordStrengthText(passwordStrength)}
    -          </p>
    -        </div>
    • Additionally, remove the getPasswordStrengthColor and getPasswordStrengthText functions if you choose to remove the password strength meter.

Category:

🔗 Analysis chain

Line range hint 134-146: Non-functional UI: Password strength meter

The password strength meter UI elements are still present, but they won't function correctly without the zxcvbn library and the related logic in handleChange.

To address this, either:

  1. Restore the zxcvbn import and related logic to keep the password strength meter functional, or
  2. Remove the password strength meter UI elements. Here's how you can do that:
-        {/* Password Strength Meter */}
-        <div className="w-full mt-2">
-          <div
-            className="h-2 rounded-full"
-            style={{
-              backgroundColor: getPasswordStrengthColor(passwordStrength),
-              width: `${(passwordStrength + 1) * 20}%`,
-            }}
-          ></div>
-          <p className="text-sm text-[#666] mt-1">
-            Strength: {getPasswordStrengthText(passwordStrength)}
-          </p>
-        </div>

Also, remember to remove the getPasswordStrengthColor and getPasswordStrengthText functions if you choose to remove the password strength meter.

To confirm the presence of password strength-related functions, run:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for password strength-related functions
rg 'getPasswordStrength(Color|Text)' frontend/src/components/Pages/Signup.jsx

Length of output: 604

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 38ce348 and d573d2c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • frontend/src/components/Pages/Menu.jsx (4 hunks)
  • frontend/src/components/Pages/Signup.jsx (1 hunks)
  • frontend/src/components/ui/IncentiveOffers.jsx (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🔇 Additional comments (8)
frontend/src/components/Pages/Menu.jsx (6)

1-8: LGTM: Import statements updated correctly

The changes to the import statements are consistent with the modifications made to the component. The removal of MainHOC and addition of IncentiveOffers align well with the new functionality introduced in this update.


22-23: LGTM: Modal state management implemented correctly

The addition of the isModalOpen state variable and the corresponding openModal and closeModal functions is a clean implementation for managing the modal's visibility. This approach follows React best practices for state management.

Also applies to: 38-40


67-67: LGTM: Image click handler added for modal interaction

The addition of the onClick event handler to the motion.img element, calling the openModal function, provides a clear and intuitive way for users to interact with the new modal functionality.


82-84: LGTM: Modal implementation, but clarify image usage

The IncentiveOffers component is correctly implemented with the necessary props for controlling its visibility. However, I noticed that the same image (Cafe3dImg) is used both in the main view and inside the modal. Is this intentional, or should the modal display a different image?


89-89: LGTM: Export statement simplified

The change in the export statement, removing the MainHOC wrapper and directly exporting ParallaxImage, is consistent with the import changes and simplifies the component structure.


Line range hint 1-89: Overall: Good implementation of modal functionality, aligns with PR objectives

The changes in this file successfully introduce the custom modal functionality as described in the PR objectives. The implementation enhances user engagement by allowing users to interact with the parallax image to open the modal. The code is generally well-structured and follows React best practices.

Key points:

  1. The modal state management is implemented correctly.
  2. The IncentiveOffers component is integrated properly.
  3. The export statement has been simplified, improving maintainability.

Minor suggestions for improvement:

  1. Consider moving inline styles to CSS classes for better maintainability.
  2. Clarify the intentional use of the same image in both the main view and the modal.

These changes effectively address the PR's goal of introducing a custom modal to capture customer attention and improve the overall user experience on the menu page.

frontend/src/components/ui/IncentiveOffers.jsx (1)

1-95: Overall implementation aligns well with PR objectives.

The IncentiveOffers component successfully implements the custom modal as described in the PR objectives. Key features include:

  • Attractive design with a prominent image and promotional content
  • Animated opening and closing behavior using framer-motion
  • Responsive design using Tailwind CSS
  • Countdown timer to create urgency
  • Clear call-to-action buttons

The component enhances user engagement and aligns with the goal of improving the overall user experience. Consider addressing the minor suggestions in previous comments to further improve the code quality and accessibility.

frontend/src/components/Pages/Signup.jsx (1)

Line range hint 1-214: Summary: Inconsistent changes to password strength feature

The changes made to this component have introduced inconsistencies that will break its functionality. The main issue is the commented-out import of the zxcvbn library, while the rest of the component still relies on it for password strength estimation.

To resolve these issues, clarification is needed on the intended changes:

  1. If the goal was to remove the password strength feature:

    • Remove the zxcvbn import
    • Remove the password strength calculation in handleChange
    • Remove the password strength meter UI elements
    • Remove the getPasswordStrengthColor and getPasswordStrengthText functions
  2. If the password strength feature should be kept:

    • Restore the zxcvbn import

Please clarify the intended changes so that the component can be updated consistently.

To get an overview of all zxcvbn-related code in the component, run:

#!/bin/bash
# Search for all zxcvbn-related code
rg 'zxcvbn|passwordStrength|getPasswordStrength' frontend/src/components/Pages/Signup.jsx

Comment on lines +1 to +5
{
"dependencies": {
"@splidejs/react-splide": "^0.7.12"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

Incomplete package.json detected: Missing essential dependencies

The current package.json only includes @splidejs/react-splide as a dependency. A standard React project typically requires additional dependencies such as react and react-dom.

  • Missing Dependencies:
    • react
    • react-dom

Please ensure that all necessary dependencies are listed to maintain project functionality.

🔗 Analysis chain

Clarify the purpose of adding @splidejs/react-splide and review package.json completeness

The addition of the Splide library for React is noted, but it raises a few concerns:

  1. The PR objectives mention adding a custom modal, but don't reference any slider or carousel functionality. Could you clarify how Splide relates to the custom modal implementation or if there are additional features not mentioned in the PR description?

  2. This package.json file appears to be incomplete. A typical React project would have many more dependencies. Are there other dependencies that should be listed here? If this is a partial view of the file, please provide the complete package.json for a more thorough review.

  3. If this is indeed the complete package.json, there might be missing critical dependencies for a React project (such as react, react-dom, etc.). Please ensure all necessary dependencies are properly listed.

To help verify the completeness of the package.json file, please run the following command in the project root and provide the output:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for the existence and content of package.json file
if [ -f package.json ]; then
    echo "package.json exists. Content:"
    cat package.json
else
    echo "package.json does not exist in the current directory."
fi

Length of output: 181

Comment on lines +7 to +15
const [modal, setModal] = useState(true);
const [countdown, setCountdown] = useState(300); // 5 minutes in seconds

useEffect(() => {
const timer = setInterval(() => {
setCountdown(prevCount => prevCount > 0 ? prevCount - 1 : 0);
}, 1000);
return () => clearInterval(timer);
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add cleanup effect for modal state.

The modal is set to be open by default (useState(true)). Consider adding a cleanup effect to ensure the modal is closed when the component unmounts. This can prevent potential issues if the component is unmounted while the modal is open.

You can add this effect:

useEffect(() => {
  return () => setModal(false);
}, []);

Comment on lines +27 to +89
return (
<AnimatePresence>
{modal && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="modal fixed inset-0 flex items-center justify-center bg-black bg-opacity-70 z-50 p-4"
>
<motion.div
initial={{ scale: 0.8, y: 50 }}
animate={{ scale: 1, y: 0 }}
exit={{ scale: 0.8, y: 50 }}
className="modal-content bg-[#f5f5dc] rounded-lg shadow-2xl w-full max-w-[600px] overflow-hidden"
>
<div className="relative">
<img
src="https://images.unsplash.com/photo-1509042239860-f550ce710b93?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1374&q=80"
alt="Delicious Coffee"
className="w-full h-48 object-cover"
/>
<button
className="absolute top-2 right-2 text-white hover:text-[#f5f5dc] transition-colors duration-300 bg-[#4a3728] rounded-full p-1"
onClick={toggleModal}
>
<AiOutlineClose size={24} />
</button>
</div>
<div className="p-6 bg-[#d9c49a]">
<h2 className="text-2xl font-bold text-[#4a3728] mb-2">Exclusive Coffee Lover's Offer!</h2>
<p className="text-lg text-[#2c1f1a] mb-4">Indulge in premium brews & save big!</p>
<ul className="list-none space-y-2 text-[#4a3728] mb-4">
<li className="flex items-center"><FaCoffee className="mr-2" /> 50% off your first month's subscription</li>
<li className="flex items-center"><FaGift className="mr-2" /> Free artisan coffee mug with sign-up</li>
<li className="flex items-center"><FaCoffee className="mr-2" /> Access to exclusive limited edition blends</li>
</ul>
<div className="flex items-center justify-between mb-4">
<p className="text-lg font-semibold text-[#4a3728]">Hurry! Offer ends in:</p>
<div className="text-2xl font-bold text-[#8b4513]">{formatTime(countdown)}</div>
</div>
<div className="flex justify-between gap-4">
<button
className="flex-1 bg-[#f5f5dc] text-[#4a3728] px-4 py-2 rounded-full shadow-md hover:bg-[#e6e6c4] transition-colors duration-300 font-semibold"
onClick={toggleModal}
>
No Thanks
</button>
<motion.button
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
className="flex-1 bg-[#8b4513] text-white px-4 py-2 rounded-full shadow-md hover:bg-[#693610] transition-colors duration-300 font-semibold"
onClick={() => {
// Handle subscription logic here
console.log("User subscribed!");
toggleModal();
}}
>
Take Me There!
</motion.button>
</div>
</div>
</motion.div>
</motion.div>
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

Enhance accessibility of the close button.

The close button currently lacks an accessible name, which can make it difficult for screen reader users to understand its purpose.

To improve accessibility, add an aria-label to the close button:

 <button
   className="absolute top-2 right-2 text-white hover:text-[#f5f5dc] transition-colors duration-300 bg-[#4a3728] rounded-full p-1"
   onClick={toggleModal}
+  aria-label="Close modal"
 >
   <AiOutlineClose size={24} />
 </button>
📝 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
return (
<AnimatePresence>
{modal && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="modal fixed inset-0 flex items-center justify-center bg-black bg-opacity-70 z-50 p-4"
>
<motion.div
initial={{ scale: 0.8, y: 50 }}
animate={{ scale: 1, y: 0 }}
exit={{ scale: 0.8, y: 50 }}
className="modal-content bg-[#f5f5dc] rounded-lg shadow-2xl w-full max-w-[600px] overflow-hidden"
>
<div className="relative">
<img
src="https://images.unsplash.com/photo-1509042239860-f550ce710b93?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1374&q=80"
alt="Delicious Coffee"
className="w-full h-48 object-cover"
/>
<button
className="absolute top-2 right-2 text-white hover:text-[#f5f5dc] transition-colors duration-300 bg-[#4a3728] rounded-full p-1"
onClick={toggleModal}
>
<AiOutlineClose size={24} />
</button>
</div>
<div className="p-6 bg-[#d9c49a]">
<h2 className="text-2xl font-bold text-[#4a3728] mb-2">Exclusive Coffee Lover's Offer!</h2>
<p className="text-lg text-[#2c1f1a] mb-4">Indulge in premium brews & save big!</p>
<ul className="list-none space-y-2 text-[#4a3728] mb-4">
<li className="flex items-center"><FaCoffee className="mr-2" /> 50% off your first month's subscription</li>
<li className="flex items-center"><FaGift className="mr-2" /> Free artisan coffee mug with sign-up</li>
<li className="flex items-center"><FaCoffee className="mr-2" /> Access to exclusive limited edition blends</li>
</ul>
<div className="flex items-center justify-between mb-4">
<p className="text-lg font-semibold text-[#4a3728]">Hurry! Offer ends in:</p>
<div className="text-2xl font-bold text-[#8b4513]">{formatTime(countdown)}</div>
</div>
<div className="flex justify-between gap-4">
<button
className="flex-1 bg-[#f5f5dc] text-[#4a3728] px-4 py-2 rounded-full shadow-md hover:bg-[#e6e6c4] transition-colors duration-300 font-semibold"
onClick={toggleModal}
>
No Thanks
</button>
<motion.button
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
className="flex-1 bg-[#8b4513] text-white px-4 py-2 rounded-full shadow-md hover:bg-[#693610] transition-colors duration-300 font-semibold"
onClick={() => {
// Handle subscription logic here
console.log("User subscribed!");
toggleModal();
}}
>
Take Me There!
</motion.button>
</div>
</div>
</motion.div>
</motion.div>
return (
<AnimatePresence>
{modal && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="modal fixed inset-0 flex items-center justify-center bg-black bg-opacity-70 z-50 p-4"
>
<motion.div
initial={{ scale: 0.8, y: 50 }}
animate={{ scale: 1, y: 0 }}
exit={{ scale: 0.8, y: 50 }}
className="modal-content bg-[#f5f5dc] rounded-lg shadow-2xl w-full max-w-[600px] overflow-hidden"
>
<div className="relative">
<img
src="https://images.unsplash.com/photo-1509042239860-f550ce710b93?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1374&q=80"
alt="Delicious Coffee"
className="w-full h-48 object-cover"
/>
<button
className="absolute top-2 right-2 text-white hover:text-[#f5f5dc] transition-colors duration-300 bg-[#4a3728] rounded-full p-1"
onClick={toggleModal}
aria-label="Close modal"
>
<AiOutlineClose size={24} />
</button>
</div>
<div className="p-6 bg-[#d9c49a]">
<h2 className="text-2xl font-bold text-[#4a3728] mb-2">Exclusive Coffee Lover's Offer!</h2>
<p className="text-lg text-[#2c1f1a] mb-4">Indulge in premium brews & save big!</p>
<ul className="list-none space-y-2 text-[#4a3728] mb-4">
<li className="flex items-center"><FaCoffee className="mr-2" /> 50% off your first month's subscription</li>
<li className="flex items-center"><FaGift className="mr-2" /> Free artisan coffee mug with sign-up</li>
<li className="flex items-center"><FaCoffee className="mr-2" /> Access to exclusive limited edition blends</li>
</ul>
<div className="flex items-center justify-between mb-4">
<p className="text-lg font-semibold text-[#4a3728]">Hurry! Offer ends in:</p>
<div className="text-2xl font-bold text-[#8b4513]">{formatTime(countdown)}</div>
</div>
<div className="flex justify-between gap-4">
<button
className="flex-1 bg-[#f5f5dc] text-[#4a3728] px-4 py-2 rounded-full shadow-md hover:bg-[#e6e6c4] transition-colors duration-300 font-semibold"
onClick={toggleModal}
>
No Thanks
</button>
<motion.button
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
className="flex-1 bg-[#8b4513] text-white px-4 py-2 rounded-full shadow-md hover:bg-[#693610] transition-colors duration-300 font-semibold"
onClick={() => {
// Handle subscription logic here
console.log("User subscribed!");
toggleModal();
}}
>
Take Me There!
</motion.button>
</div>
</div>
</motion.div>
</motion.div>

@@ -4,7 +4,7 @@ import { useNavigate } from 'react-router-dom';
import { Link } from 'react-router-dom';
import { FaEye } from 'react-icons/fa';
import { FaEyeSlash } from 'react-icons/fa6';
import zxcvbn from 'zxcvbn'; // Import zxcvbn for password strength check
// import zxcvbn from 'zxcvbn'; // Import zxcvbn for password strength check
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

Issue: zxcvbn is used but not imported

The zxcvbn library is utilized in the component (const result = zxcvbn(e.target.value);), but its import statement is commented out. This will cause runtime errors when users interact with the password field.

To resolve this, you should either:

  1. Restore the import by uncommenting the line:
    import zxcvbn from 'zxcvbn';
  2. Remove all usages of zxcvbn and the related password strength functionality if the intention is to eliminate this feature.
🔗 Analysis chain

Inconsistency: zxcvbn import commented out but still used in component

The import of the zxcvbn library has been commented out, but the component still relies on this library for password strength estimation. This will cause runtime errors when users interact with the password field.

To resolve this, either:

  1. Restore the import by uncommenting the line:
    import zxcvbn from 'zxcvbn';
  2. Or, if the intention is to remove the password strength feature, update the component to remove all usage of zxcvbn and the related password strength UI elements.

To confirm the usage of zxcvbn in the component, run:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for zxcvbn usage in the component
rg 'zxcvbn' frontend/src/components/Pages/Signup.jsx

Length of output: 174

just a test
@RamakrushnaBiswal
Copy link
Owner

@dev129 you make 361 files for a single issue i can't aprove it

@dev129
Copy link
Author

dev129 commented Oct 18, 2024

Wait what ?

Copy link
Contributor

This PR has been automatically closed due to inactivity from the owner for 3 days.

@github-actions github-actions bot added the Stale label Oct 22, 2024
@github-actions github-actions bot closed this Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants