Skip to content

feat(login): add back-to-home navigation link#130

Open
rittika03 wants to merge 1 commit into
tarinagarwal:mainfrom
rittika03:feat/add-back-to-home-login
Open

feat(login): add back-to-home navigation link#130
rittika03 wants to merge 1 commit into
tarinagarwal:mainfrom
rittika03:feat/add-back-to-home-login

Conversation

@rittika03

Copy link
Copy Markdown

🚀 Feature: Add "Back to Home" Navigation to Login Page

Closes: #113

📝 Description

Currently, the "Access Vault" (Login) page lacks a clear exit path for unauthenticated users, which can lead to higher bounce rates. This PR introduces a "Back to Home" navigation link to improve the User Experience (UX) and provide a seamless way for users to return to the landing page.

🛠 Changes Made

  • Navigation Logic: Integrated the Link component from react-router-dom (or next/link) to handle client-side routing to /.
  • UI Enhancement: Added a "← Back to Home" link in the top-left section of the login card, ensuring it is distinct from the "Sign Up" action.

✅ Checklist

  • My code follows the project's style guidelines.
  • I have performed a self-review of my code.
  • The link correctly redirects to the root directory (/).
  • The UI is responsive and looks good on mobile devices.
  • No console errors or warnings are triggered by these changes.

@tarin-lgtm tarin-lgtm Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks Good To Meow 🐱

Hey @! Nice work on this one. This PR adds a 'Back to Home' navigation link to the login page, improving UX by providing a clear exit path for unauthenticated users. No critical or high-severity issues were found; only minor UX, consistency, and documentation improvements are suggested. Overall, the implementation is sound and ready to merge.

I left a few minor suggestions below — nothing blocking, just things to consider.

Note: This is an AI-generated approval. A maintainer will follow up with the final human review shortly.

Nice-to-haves

  1. Replace Unicode arrow with a consistent icon component for UI consistency.
  2. Add inline comment for the new navigation button and update README to mention the feature.
  3. Consider warning users about unsaved form data when navigating away from the login page.
Findings breakdown (10 total)

1 medium / 4 low / 5 info

Confidence: 95%


🔗 View Full Review Report — detailed findings, severity breakdown, and agent analysis

Reviewed by Looks Good To Meow — AI-powered code review


💬 You can interact with me directly in this PR:

  • @tarin-lgtm fix [any constraints]
  • @tarin-lgtm explain [your question]
  • @tarin-lgtm improve [focus area]
  • @tarin-lgtm test [what to focus on]

{/* ✅ Back to Home */}
<button
type="button"
onClick={() => navigate("/")}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Medium — The navigation to home (navigate("/")) is triggered directly in the onClick handler of a button without any confirmation or state check. If there is unsaved form data, the user may lose it without warning.

Consider prompting the user for confirmation if there is unsaved input before navigating away from the form, or ensure form state is reset/handled appropriately on navigation.

best-practices

{/* ✅ Back to Home */}
<button
type="button"
onClick={() => navigate("/")}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Suggestion — The navigation button uses navigate("/") to redirect users to the home page. If the navigate function or route handling is ever changed to accept user input or query parameters, this could introduce an open redirect vulnerability. Currently, the risk is low because the destination is hardcoded, but this pattern should be monitored if refactored.

Ensure that all navigation destinations are hardcoded or validated, and never accept user-controlled input for navigation paths without strict allowlisting.

security

{/* ✅ Back to Home */}
<button
type="button"
onClick={() => navigate("/")}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Suggestion — The new 'Back to Home' button uses navigate("/") without checking for unsaved form state or in-progress authentication. This could allow users to accidentally lose form input or interrupt an authentication process.

Consider prompting the user for confirmation if there is unsaved input or an authentication process is ongoing (e.g., loading/otpLoading).

bugs

<div className="max-w-md w-full">
<div className="smoke-card p-8 relative smoke-effect">
{/* ✅ Back to Home */}
<button

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Suggestion — The new 'Back to Home' button introduces a navigation action, but there is no inline comment explaining its purpose or why it is conditionally rendered here. While the button is simple, a brief comment would help future maintainers understand its intent, especially since the rest of the form is complex and stateful.

Add an inline comment above the button to clarify its purpose, e.g., '// Navigates user back to the home page from the login/signup form'.

documentation

{/* ✅ Back to Home */}
<button
type="button"
onClick={() => navigate("/")}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Suggestion — The onClick handler for the 'Back to Home' button is defined inline as an arrow function in JSX. This creates a new function instance on every render, which can cause unnecessary re-renders of child components if this button is ever memoized or passed as a prop.

Define the navigation handler as a useCallback hook or a named function outside the render to avoid unnecessary function recreation on each render.

performance

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.

[FEATURE] Add "Back to Home" Navigation Option on Login Page

1 participant