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

Membership page added with its content #316

Merged
merged 6 commits into from
Oct 18, 2024

Conversation

Jay-1409
Copy link
Contributor

@Jay-1409 Jay-1409 commented Oct 16, 2024

#296
@RamakrushnaBiswal

Screencast_20241016_161728.mp4

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new "Membership" component displaying various membership plans with customizable options.
    • Added a "MEMBERSHIP" item to the navigation menu for easy access.
    • New route for the Membership component at /membership.
  • Bug Fixes

    • Improved logout functionality to ensure a smoother user experience.
  • Documentation

    • Updated the contributors' section in the README to reflect new additions and removals.

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 bot commented Oct 16, 2024

Walkthrough

This pull request introduces several updates to the PlayCafe website repository. The README.md file is modified to reflect changes in the contributors' section, adding two new contributors and removing one. Additionally, a new React component, Membership, is created to display various membership plans, along with a new route for this component in the router configuration. The Navbar component is also updated to include a new "MEMBERSHIP" menu item and to refine the logout process.

Changes

File Change Summary
README.md Updated contributors: added "Jay Shah" and "MANI", removed "Tanishi Rai".
frontend/src/components/Membership.jsx Added new Membership component displaying membership plans with animations and modal functionality.
frontend/src/components/Shared/Navbar.jsx Added "MEMBERSHIP" menu item, updated logout handling, and adjusted rendering logic for menus.
frontend/src/router/index.jsx Added new route for Membership component at path /membership.

Possibly related PRs

  • fixed the contributors readme issue. #77: This PR focuses on automating the update of the contributors list in the README file, which is directly related to the changes made in the main PR that also updates the contributors section.
  • Signup/login/page #173: This PR adds a new contributor, Jay Shah, to the README, which aligns with the main PR's addition of the same contributor.
  • added a logout modal  #175: Similar to the main PR, this PR also adds Jay Shah as a contributor while removing another contributor, maintaining consistency in the contributors' section.
  • Rearrange the structure of the README #294: This PR enhances the structure of the README, which includes the contributors section, thereby relating to the changes made in the main PR regarding contributor updates.

Suggested labels

enhancement, level2, gssoc-ext, hacktoberfest accepted

Suggested reviewers

  • RamakrushnaBiswal

Poem

🐇 In the garden of code, we hop and play,
New friends join in, brightening the day.
With memberships blooming, our paths intertwine,
Together we build, our efforts align.
So here's to the changes, both big and small,
In the world of PlayCafe, we welcome them all! 🌼


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

🧹 Outside diff range and nitpick comments (5)
frontend/src/router/index.jsx (1)

42-42: Consider removing the extra empty line.

There's an unnecessary empty line after the new route. Consider removing it to maintain consistent spacing with other routes.

 <Route path="/membership" element={<Membership />} />
-
 </Route>
frontend/src/components/Membership.jsx (2)

1-1: Consider addressing the ESLint prettier issue instead of disabling it.

The ESLint disable comment suggests there might be formatting issues in the file. It's generally better to fix the underlying formatting problems rather than disabling the linter.

Consider running Prettier on this file and adjusting your code to comply with the project's style guide.


73-73: Address the TODO comment in handleNext function.

There's a TODO comment suggesting that you might need to handle the selectedFeatures before navigation. Make sure to implement this logic if necessary, or remove the comment if it's no longer relevant.

Consider implementing the logic to handle selectedFeatures or remove the comment if it's not needed.

frontend/src/components/Shared/Navbar.jsx (1)

Line range hint 44-50: LGTM! Consider adding error handling.

The updated handleLogout function provides a comprehensive logout process, which is great. It correctly removes the auth token, updates the UI state, and redirects the user.

Consider adding error handling to make the logout process more robust:

 const handleLogout = () => {
-  Cookies.remove('authToken');
-  setToken(null);
-  setIsModalOpen(false);
-  setIsMenuOpen(false);
-  navigate('/login');
+  try {
+    Cookies.remove('authToken');
+    setToken(null);
+    setIsModalOpen(false);
+    setIsMenuOpen(false);
+    navigate('/login');
+  } catch (error) {
+    console.error('Error during logout:', error);
+    // Optionally, show an error message to the user
+  }
 };

This change will help catch and log any unexpected errors during the logout process.

README.md (1)

289-290: Fix linting issues: Replace hard tabs with spaces.

There are linting issues related to the use of hard tabs in the markdown file. To improve consistency and adhere to markdown best practices, replace the hard tabs with spaces.

Apply this change to lines 289, 290, 333, and 334:

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

Also applies to: 333-334

🧰 Tools
🪛 Markdownlint

289-289: Column: 1
Hard tabs

(MD010, no-hard-tabs)


290-290: 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 f09ae62.

📒 Files selected for processing (4)
  • README.md (2 hunks)
  • frontend/src/components/Membership.jsx (1 hunks)
  • frontend/src/components/Shared/Navbar.jsx (1 hunks)
  • frontend/src/router/index.jsx (2 hunks)
🧰 Additional context used
🪛 Markdownlint
README.md

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 (8)
frontend/src/router/index.jsx (2)

23-23: LGTM: Import statement for Membership component.

The import statement for the Membership component is correctly added and follows the existing code style.


41-41: LGTM: New route for Membership component added.

The new route for the Membership component is correctly implemented and placed within the existing route structure.

frontend/src/components/Membership.jsx (3)

41-58: Animation variants look good.

The containerVariants and cardVariants are well-defined and should provide smooth animations for the component.


164-164: Default export looks good.

The component is correctly exported as default, which is a common practice for React components.


1-164: Overall, good implementation with room for improvements.

The Membership component successfully implements the functionality described in the PR objectives. It displays various membership plans and allows for customization of add-ons. The use of Framer Motion for animations adds a nice touch to the user experience.

Here's a summary of the main points from the review:

  1. Consider addressing ESLint/Prettier issues instead of disabling them.
  2. Extract membershipData to a separate file for better maintainability.
  3. Implement the TODO in the handleNext function or remove it if not needed.
  4. Improve modal accessibility and user experience.
  5. Extract repeated button styles into a reusable component.

These improvements will enhance the code quality, maintainability, and user experience of the membership page.

README.md (3)

282-288: New contributor added successfully.

The addition of Jay Shah (GitHub: Jay-1409) to the contributors' list is correct and follows the existing format.


334-340: New contributor added successfully.

The addition of MANI (GitHub: devxMani) to the contributors' list is correct and follows the existing format.

🧰 Tools
🪛 Markdownlint

334-334: Column: 1
Hard tabs

(MD010, no-hard-tabs)


Line range hint 290-332: Contributor removed as intended.

The removal of Tanishi Rai (GitHub: tanishirai) from the contributors' list has been executed correctly.

🧰 Tools
🪛 Markdownlint

289-289: Column: 1
Hard tabs

(MD010, no-hard-tabs)


290-290: Column: 1
Hard tabs

(MD010, no-hard-tabs)

frontend/src/components/Membership.jsx Show resolved Hide resolved
Comment on lines 128 to 159
{isModalOpen && (
<div className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50">
<div className="bg-white p-8 rounded-lg shadow-lg max-w-md w-full">
<h2 className="text-2xl font-bold mb-4">Select Your Add-ons</h2>
<div className="flex flex-col mb-6">
{membershipData[2].features.map((feature, idx) => (
<label key={idx} className="flex items-center mb-2">
<input
type="checkbox"
checked={selectedFeatures[feature] || false}
onChange={() => handleFeatureChange(feature)}
className="mr-2"
/>
{feature}
</label>
))}
</div>
<button
className="bg-gradient-to-r from-orange-500 to-pink-500 text-white py-2 px-4 rounded-full hover:from-pink-500 hover:to-orange-500 transition-all"
onClick={handleNext}
>
Next
</button>
<button
className="ml-2 bg-gray-300 text-gray-700 py-2 px-4 rounded-full hover:bg-gray-400 transition-all"
onClick={() => setIsModalOpen(false)} // Close modal
>
Cancel
</button>
</div>
</div>
)}
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

Improve modal accessibility and user experience.

The modal implementation could be enhanced for better accessibility and user experience:

  1. Add a focus trap to keep focus within the modal when it's open.
  2. Implement closing the modal when clicking outside or pressing the Esc key.
  3. Add aria attributes for screen readers.

Consider using a library like react-modal or implementing these features manually. Here's a basic example of improvements:

import { useEffect, useRef } from 'react';

// ... (in the component)
const modalRef = useRef(null);

useEffect(() => {
  const handleEsc = (event) => {
    if (event.keyCode === 27) setIsModalOpen(false);
  };
  window.addEventListener('keydown', handleEsc);
  return () => window.removeEventListener('keydown', handleEsc);
}, []);

// ... (in the JSX)
{isModalOpen && (
  <div 
    className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50"
    onClick={() => setIsModalOpen(false)}
  >
    <div 
      ref={modalRef}
      className="bg-white p-8 rounded-lg shadow-lg max-w-md w-full"
      onClick={(e) => e.stopPropagation()}
      role="dialog"
      aria-modal="true"
      aria-labelledby="modal-title"
    >
      <h2 id="modal-title" className="text-2xl font-bold mb-4">Select Your Add-ons</h2>
      {/* ... (rest of the modal content) */}
    </div>
  </div>
)}

Comment on lines 109 to 121
<button
className="fixed bottom-4 bg-gradient-to-r from-orange-500 to-pink-500 text-white py-2 px-8 rounded-full hover:from-pink-500 hover:to-orange-500 transition-all"
onClick={() => setIsModalOpen(true)} // Open modal on click
>
Customize Add-ons
</button>
) : (
<button
className="fixed bottom-4 bg-gradient-to-r from-orange-500 to-pink-500 text-white py-2 px-8 rounded-full hover:from-pink-500 hover:to-orange-500 transition-all"
onClick={() => navigate('/signup')}
>
Sign Up
</button>
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

Consider extracting button styles to a reusable component.

The button styling is repeated for both the "Customize Add-ons" and "Sign Up" buttons. To improve maintainability and reduce redundancy, consider extracting this into a reusable component.

Example refactor:

const GradientButton = ({ onClick, children }) => (
  <button
    className="fixed bottom-4 bg-gradient-to-r from-orange-500 to-pink-500 text-white py-2 px-8 rounded-full hover:from-pink-500 hover:to-orange-500 transition-all"
    onClick={onClick}
  >
    {children}
  </button>
);

// Usage
<GradientButton onClick={() => setIsModalOpen(true)}>
  Customize Add-ons
</GradientButton>

<GradientButton onClick={() => navigate('/signup')}>
  Sign Up
</GradientButton>

frontend/src/components/Shared/Navbar.jsx Show resolved Hide resolved
frontend/src/components/Shared/Navbar.jsx Show resolved Hide resolved
@RamakrushnaBiswal
Copy link
Owner

@Jay-1409 just change the color and choose some colors which should match with the UI

@Jay-1409
Copy link
Contributor Author

@Jay-1409 just change the color and choose some colors which should match with the UI

Okayy

@Jay-1409
Copy link
Contributor Author

image
i have done the required changes @RamakrushnaBiswal

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)

289-290: Minor: Fix hard tabs in the contributors table.

There are some linting issues related to hard tabs in the contributors table. Consider replacing these with spaces for consistency with the rest of the document.

You can fix this by running a markdown linter or manually replacing the tabs with spaces. Here's an example of how to fix it:

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

Apply this change to all instances of hard tabs in the contributors table.

Also applies to: 333-334, 377-378, 421-422

🧰 Tools
🪛 Markdownlint

289-289: Column: 1
Hard tabs

(MD010, no-hard-tabs)


290-290: 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 f09ae62 and 6a85c7e.

📒 Files selected for processing (2)
  • README.md (7 hunks)
  • frontend/src/components/Membership.jsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/Membership.jsx
🧰 Additional context used
🪛 Markdownlint
README.md

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)


377-377: Column: 1
Hard tabs

(MD010, no-hard-tabs)


378-378: Column: 1
Hard tabs

(MD010, no-hard-tabs)


421-421: Column: 1
Hard tabs

(MD010, no-hard-tabs)


422-422: Column: 1
Hard tabs

(MD010, no-hard-tabs)

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

248-253: LGTM! Contributors list updated.

The changes to the contributors list look good. Two new contributors, Jay Shah and MANI, have been added, which aligns with the project's growth.

Could you please confirm if the removal of Tanishi Rai from the contributors list was intentional? If so, ensure that their contributions have been properly acknowledged elsewhere if needed.

Also applies to: 269-273, 333-362, 377-378, 421-422


Line range hint 1-442: Overall: README updates look good with minor suggestions.

The changes to the README are focused on updating the contributors list, which is a positive reflection of the project's growth. The rest of the document remains unchanged, maintaining its comprehensive structure and informative content.

To further improve the document:

  1. Address the hard tab issues in the contributors table.
  2. Verify the intentional removal of Tanishi Rai from the contributors list.

These minor adjustments will enhance the overall quality and consistency of the README.

🧰 Tools
🪛 Markdownlint

245-245: Column: 1
Hard tabs

(MD010, no-hard-tabs)


246-246: Column: 1
Hard tabs

(MD010, no-hard-tabs)

Copy link

vercel bot commented Oct 18, 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 18, 2024 2:43am

@RamakrushnaBiswal RamakrushnaBiswal merged commit 7dcc595 into RamakrushnaBiswal:main Oct 18, 2024
3 checks passed
@RamakrushnaBiswal RamakrushnaBiswal added enhancement New feature or request level3 for 45 points gssoc-ext gssoc-extd program hacktoberfest accepted hacktoberfest-accepted repo labels Oct 18, 2024
@coderabbitai coderabbitai bot mentioned this pull request Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gssoc-ext gssoc-extd program hacktoberfest accepted hacktoberfest-accepted repo level3 for 45 points
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants