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

Login/signup responsive #366

Merged

Conversation

Shahharshii
Copy link

@Shahharshii Shahharshii commented Oct 20, 2024

solved for the issue no #330

Changes Made:
-Adjusted CSS styles to ensure components fit properly on smaller screens.
-Refactored form structure to align inputs and buttons responsively.

  • Preserved the original layout for web/desktop view to avoid unintended changes.

image
login page responsive..

image
signup page responsive

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced the Login component with loading and error handling states for improved user experience.
    • Added a new "MEMBERSHIP" entry to the Navbar for better navigation options.
  • Improvements

    • Refined the Signup component's layout and styling for better responsiveness.
    • Adjusted the font size of the main heading in the Landing component for improved visual appeal.
  • Bug Fixes

    • Improved logout functionality in the Navbar, ensuring a smoother user experience.

Copy link

vercel bot commented Oct 20, 2024

Someone 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 20, 2024

Walkthrough

The pull request introduces several modifications across multiple components in the frontend. Key changes include the addition of client-side rendering directives, enhancements to user experience through loading states and error handling in the login component, and various styling adjustments across components like Signup and Navbar. The Navbar component also sees changes in state management and the addition of new menu items. Overall, the changes are primarily focused on improving user interaction, styling consistency, and maintaining existing functionalities.

Changes

File Path Change Summary
frontend/src/components/Pages/About.jsx Added 'use client'; directive for client-side rendering; reformatted background image import to single quotes.
frontend/src/components/Pages/Login.jsx Introduced isLoading and error state variables; updated handleSubmit for loading state and error handling; refined layout and styling of the login form.
frontend/src/components/Pages/Signup.jsx Consolidated import statements; reformatted state declarations; streamlined fetch headers; made styling adjustments to form layout and button consistency.
frontend/src/components/Shared/Navbar.jsx Updated useEffect for token management; modified handleLogout function; added "MEMBERSHIP" menu item; enhanced logout confirmation modal and button styling.
frontend/src/components/ui/Landing.jsx Adjusted font size of the main heading from text-6xl to text-5xl; no other functional changes made.

Possibly related PRs

Suggested labels

enhancement, level2, gssoc-ext, good first issue

Suggested reviewers

  • RamakrushnaBiswal

🐰 In the land of code, we hop and play,
With changes made to brighten the day.
From login forms to navbars anew,
Each tweak and turn brings joy to you!
So let’s celebrate with a cheerful cheer,
For a smoother journey, let’s give a big cheer! 🎉


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

🧹 Outside diff range and nitpick comments (8)
frontend/src/components/Pages/Login.jsx (4)

Line range hint 41-48: Enhanced error handling and loading state management

The updates to handleSubmit function significantly improve error handling and user feedback. The use of try-catch-finally block ensures that the loading state is properly managed regardless of the outcome.

Consider adding a more specific error message for network-related issues:

} catch (err) {
  setError(err.message || (err.name === 'TypeError' ? 'Network error. Please check your connection.' : 'An error occurred. Please try again.'));
}

66-67: Enhanced form styling and input usability

The updates to form and input styling improve visual consistency and usability. The increased input height and consistent styling across elements enhance the overall user experience, aligning well with the PR objectives.

Consider adding aria-label attributes to the input fields for improved accessibility:

 <input
   className="w-full h-12 rounded-md border-2 border-black bg-beige shadow-[4px_4px_0px_0px_black] text-[15px] font-semibold text-[#323232] p-2.5 focus:outline-none focus:border-[#2d8cf0] placeholder-[#666]"
   name="email"
   placeholder="Email"
   type="email"
   onChange={handleChange}
+  aria-label="Email"
 />

Also applies to: 77-81, 86-90


Line range hint 93-101: Improved password visibility toggle styling

The updated styling for the password visibility toggle button enhances visual consistency with the rest of the form while maintaining the existing functionality.

Consider adding an aria-label to the button for improved accessibility:

 <button
   className="absolute top-1/2 transform -translate-y-1/2 right-4"
   onClick={(e) => {
     e.preventDefault();
     setHidden(!hidden);
   }}
+  aria-label={hidden ? "Show password" : "Hide password"}
 >
   {hidden ? <FaEyeSlash /> : <FaEye />}
 </button>

132-139: Enhanced error handling and submit button feedback

The addition of error message display and loading state for the submit button greatly improves user feedback during the login process. These changes align well with the PR's objective of enhancing user experience.

Consider adding an aria-live attribute to the error message for better accessibility:

- {error && <p className="text-red-500 mt-2">{error}</p>}
+ {error && <p className="text-red-500 mt-2" aria-live="polite">{error}</p>}

This ensures that screen readers announce the error message when it appears.

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

83-90: LGTM: Improved responsive layout.

The changes to the container and image layout significantly enhance the component's responsiveness, aligning well with the PR objectives. The use of Tailwind classes and absolute positioning for the image ensures a consistent look across different screen sizes.

One suggestion for improvement:

Consider adding an aria-hidden="true" attribute to the background image to improve accessibility, as it's decorative and not essential for screen readers.

 <img
   src={photo}
   alt="login"
   loading="lazy"
   className="w-3/4 absolute inset-0"
+  aria-hidden="true"
 />

Line range hint 91-155: LGTM: Enhanced form styling and responsiveness.

The styling changes to form inputs, buttons, and text elements significantly improve the component's responsiveness and visual consistency. The use of Tailwind's responsive classes ensures a smooth transition between mobile and desktop layouts, aligning perfectly with the PR objectives.

Suggestion for improvement:

Consider adding aria-label attributes to the input fields to enhance accessibility. For example:

 <input
   className="input w-full h-10 rounded-md border-2 border-black bg-beige p-2.5 shadow-[4px_4px_0px_0px_black] focus:outline-none"
   name="name"
   placeholder="Name"
   type="text"
   onChange={handleChange}
+  aria-label="Enter your name"
 />

Apply similar aria-label attributes to email and password inputs as well.

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

Line range hint 25-27: Add dependency array to useEffect hook.

The current implementation of the useEffect hook for setting the token state will run on every render, which may lead to unnecessary re-renders and potential performance issues.

Consider adding an empty dependency array to ensure the effect only runs once on component mount:

 useEffect(() => {
   setToken(Cookies.get('authToken'));
-});
+}, []);

If you intend to update the token when it changes in cookies, consider using the Cookies.get('authToken') as a dependency:

 useEffect(() => {
   setToken(Cookies.get('authToken'));
-});
+}, [Cookies.get('authToken')]);

Line range hint 46-52: Approve logout process improvements and suggest code cleanup.

The changes to the handleLogout function provide a more comprehensive logout process, including token removal, UI state updates, and navigation to the login page.

Consider removing the commented-out setisloggedIn(false) line for code cleanliness:

 const handleLogout = () => {
-  // setisloggedIn(false); // Set isLoggedIn to false on confirmation
   //managing log in , logout using jwt tokens
   Cookies.remove('authToken');
   setToken(null);
   setIsModalOpen(false); // Close the modal
   setIsMenuOpen(false); // after getting logged out close the menu if it is open
   navigate('/login'); //navigate to login after get logged out
 };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 76a5b4d and f441ef7.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • frontend/src/components/Pages/About.jsx (1 hunks)
  • frontend/src/components/Pages/Login.jsx (4 hunks)
  • frontend/src/components/Pages/Signup.jsx (4 hunks)
  • frontend/src/components/Shared/Navbar.jsx (2 hunks)
  • frontend/src/components/ui/Landing.jsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • frontend/src/components/Pages/About.jsx
🧰 Additional context used
🔇 Additional comments (15)
frontend/src/components/ui/Landing.jsx (1)

42-42: Approved: Responsive font size adjustment

The change from text-6xl to text-5xl for the main heading on smaller screens aligns well with the PR objective of improving responsiveness. This adjustment should enhance readability on mobile devices while maintaining the existing layout for larger screens (as the md:text-9xl class is unchanged). Good job on making this subtle yet effective improvement.

frontend/src/components/Pages/Login.jsx (4)

16-17: Improved user feedback with loading and error states

The addition of isLoading and error state variables enhances the user experience by providing feedback during the login process and handling errors more effectively. This aligns well with the PR's objective of improving responsiveness and user interaction.


56-63: Improved responsive layout and visual design

The adjustments to the form layout and the addition of a responsive background image enhance the overall visual appeal and responsiveness of the login page. The use of Tailwind classes for responsive design is effective and aligns well with the PR's objective of improving the page's responsiveness across different screen sizes.


103-108: Enhanced "Forgot Password?" link styling

The updated styling for the "Forgot Password?" link improves readability and visual consistency. The added hover effect enhances user interaction, contributing to a better overall user experience.


122-130: Improved Google sign-in button consistency

The updates to the Google sign-in button styling enhance visual consistency with other form elements. The adjusted height and styling create a more cohesive look, improving the overall user interface.

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

3-3: LGTM: Import statement consolidation.

The consolidation of imports from 'react-router-dom' improves code readability and follows best practices.


6-6: LGTM: Improved comment clarity.

The updated comment for the zxcvbn import provides a clearer description of its purpose.


13-14: LGTM: Concise state declarations.

The reformatted state declarations for passwordStrength and data are more concise and align with modern React practices.


21-21: LGTM: Improved readability in handleChange.

Moving setPasswordStrength to its own line enhances code readability without affecting functionality.


51-51: LGTM: Concise fetch headers.

Consolidating the headers in the fetch request improves code conciseness without compromising readability or functionality.


156-163: LGTM: Consistent button styling.

The styling changes to the Google sign-up and main submit buttons maintain consistency with the overall form design. The use of Tailwind classes ensures responsiveness and a cohesive look across different screen sizes, aligning well with the PR objectives.


Line range hint 1-174: Overall assessment: Excellent improvements to responsiveness and design consistency.

The changes in this file significantly enhance the signup component's responsiveness and visual consistency across different screen sizes. The modifications align perfectly with the PR objectives of improving the mobile experience while maintaining the desktop layout.

Key improvements:

  1. Responsive layout adjustments using Tailwind classes.
  2. Consistent styling of form elements and buttons.
  3. Improved code readability and organization.

Minor suggestions were made to enhance accessibility, but overall, this is a well-executed update to the signup component.

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

110-110: LGTM: Enhanced hover effect for desktop menu button.

The addition of the hover:bg-lime-200 class to the desktop menu button improves the visual feedback for user interactions, enhancing the overall user experience.


Line range hint 1-238: Overall changes align well with PR objectives.

The modifications to the Navbar component successfully address the PR objectives:

  1. The addition of the 'MEMBERSHIP' menu item enhances the navigation options.
  2. The refined logout process and consistent use of token-based authentication improve the user experience and security.
  3. The styling changes, including the hover effect on the desktop menu button, contribute to better responsiveness and visual feedback.

These changes maintain the existing layout for web and desktop views while potentially improving the mobile experience. Good job on addressing the responsiveness requirements!

To ensure the responsive design works as intended, please provide screenshots of the navbar on various screen sizes (mobile, tablet, and desktop) to visually confirm the layout adjustments.


23-23: LGTM: New 'MEMBERSHIP' menu item added.

The addition of the 'MEMBERSHIP' menu item aligns with the PR objectives. The path '/membership' is consistent with the naming convention of other menu items.

Please ensure that the '/membership' route is properly implemented and accessible. You can verify this by running the following script:

✅ Verification successful

Verified: '/membership' route is correctly implemented.

The '/membership' route is properly defined in frontend/src/components/Shared/Navbar.jsx at line 23.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the '/membership' route in the router configuration.

# Test: Search for the '/membership' route definition
rg -i "path.*['\"]\/membership['\"]" --type js

Length of output: 155


Script:

#!/bin/bash
# Description: Verify the existence of the '/membership' route in the router configuration.

# Test: Search for the '/membership' route definition
rg -i 'path\s*:\s*["'\''"]/membership["'\''"]' --type js

Length of output: 172

Copy link

vercel bot commented Oct 20, 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 20, 2024 3:58pm

@RamakrushnaBiswal RamakrushnaBiswal merged commit 853167b into RamakrushnaBiswal:main Oct 21, 2024
5 checks passed
@RamakrushnaBiswal RamakrushnaBiswal added enhancement New feature or request good first issue Good for newcomers level1 for 10 points gssoc-ext gssoc-extd program hacktoberfest accepted hacktoberfest-accepted repo labels Oct 21, 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 good first issue Good for newcomers gssoc-ext gssoc-extd program hacktoberfest accepted hacktoberfest-accepted repo let me know level1 for 10 points
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants