Skip to content

added back to home feature#402

Open
ArshiBansal wants to merge 1 commit into
GitMetricsLab:mainfrom
ArshiBansal:back_home_button
Open

added back to home feature#402
ArshiBansal wants to merge 1 commit into
GitMetricsLab:mainfrom
ArshiBansal:back_home_button

Conversation

@ArshiBansal
Copy link
Copy Markdown

@ArshiBansal ArshiBansal commented May 22, 2026

Related Issue


Description

This PR adds a consistent "Back to Home" navigation button across the Login, SignUp, and Contact pages.

The button improves user experience by allowing users to quickly return to the home page without using the browser back button.

Key changes:

  • Added Back to Home button in Login page
  • Added Back to Home button in SignUp page
  • Added Back to Home button in Contact page
  • Uses useNavigate("/") for routing
  • Maintains dark/light mode support
  • Styled with modern glassmorphism UI for consistency with existing design

No existing functionality or business logic was modified.


How Has This Been Tested?

  • Manually tested navigation on all affected pages:
    • Login → Back to Home works correctly
    • SignUp → Back to Home works correctly
    • Contact → Back to Home works correctly
  • Verified UI consistency in dark and light modes
  • Verified no impact on authentication or form submission flows

Screenshots (if applicable)

(Add screenshots here showing the Back to Home button on each page)


Type of Change

  • Bug fix
  • New feature
  • Code style update
  • Breaking change
  • Documentation update

Summary by CodeRabbit

  • New Features

    • Added "Back to Home" navigation buttons to Contact, Login, and Signup pages.
    • Implemented form validation with inline error messaging on the Signup page.
  • Refactor

    • Updated page layouts and visual styling across Contact, Login, and Signup pages.
    • Enhanced form state management and submission handling.

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 22, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 1237f45
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a1030907478dd0008722734
😎 Deploy Preview https://deploy-preview-402--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

Three authentication and contact pages were updated with consistent "Back to Home" navigation buttons and improved form handling. Contact and Login pages received UI layout refactoring with formatting adjustments. Signup page gained substantial validation enhancements with new error state management, per-field validation during input changes, pre-submission error checking, and simplified inline error display.

Changes

Authentication and contact page navigation enhancements

Layer / File(s) Summary
Contact page navigation and layout updates
src/pages/Contact/Contact.tsx
Contact page imports ArrowLeft icon and useNavigate hook to render a back-to-home button navigating to /. Page header "GitHub Tracker", introductory copy, contact card icon/text styling, and form field labels (Full Name, Email Address, Subject, Message) were reformatted with JSX line-break and spacing adjustments. Subject select had placeholder-related classes removed. Success popup message was re-indented.
Login page layout refactoring and navigation
src/pages/Login/Login.tsx
Login page imports ArrowLeft icon to render back-to-home button. Form state initialization reformatted into multi-line object. Axios submit call spread across multiple lines. Main JSX layout restructured: animated background blobs expanded into individually-positioned gradient elements, branding and form-card header area refactored with updated JSX nesting, message alert block reformatted with multi-line conditional className rendering, and bottom gradient overlay expanded to multi-line conditional render. Success check remains gated on response message "Login successful".
Signup form validation state and submission handling
src/pages/Signup/Signup.tsx
Signup page imports ArrowLeft icon and renders back-to-home button. State expanded with message and errors objects alongside existing formData, isLoading, and showPassword. handleChange computes and stores per-field validation errors. handleSubmit computes field-specific errors upfront, blocks submission on validation failure, POSTs to ${backendUrl}/api/auth/signup, sets message from response, navigates to /login on success string, and resets isLoading in finally block. Form UI rebuilt with simpler inputs rendering inline validation errors and plain centered message container without conditional success/error styling. Form heading and login link text updated.

Sequence Diagram(s)

(No sequence diagram generated: changes are isolated UI updates and form validation refactoring within individual page components without cross-component orchestration or external API flows that would benefit from sequence visualization.)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • GitMetricsLab/github_tracker#269: Both modify Signup.tsx core form wiring—message/errors state, validation in handleChange, and handleSubmit axios flow with navigation to /login on success string.
  • GitMetricsLab/github_tracker#265: Overlaps with Signup validation enhancements—adding errors/message state, real-time handleChange validation, blocking invalid submissions, and updating handleSubmit to post to /api/auth/signup and navigate on success.
  • GitMetricsLab/github_tracker#138: Both modify Login.tsx UI wiring with back-to-home button and login page layout/animated background refactoring.

Suggested labels

level:intermediate, type:feature, type:accessibility, quality:clean

Poem

🐰 Three pages now hop homeward with grace,
A back-arrow button in every place!
Form validation catches errors with care,
While layouts dance prettier in the air.
Navigation flows smooth—hop along, if you dare! 🏡

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'added back to home feature' directly describes the primary change—adding navigation buttons across three pages—and clearly summarizes the main objective of the PR.
Description check ✅ Passed The PR description includes all required sections from the template: Related Issue, comprehensive Description, testing details, and Type of Change; it provides clear context about changes and implementation approach.
Linked Issues check ✅ Passed All coding requirements from issue #363 are met: Back to Home buttons added to Login, SignUp, and Contact pages with useNavigate routing, dark/light mode support maintained, and responsive design consistent with existing UI patterns.
Out of Scope Changes check ✅ Passed The changes focus on adding navigation buttons and related UI formatting to three pages with no modifications to core business logic, authentication, or form submission flows, staying within the scope of issue #363.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/Signup/Signup.tsx`:
- Around line 31-32: The password visibility toggle state is never toggled
because setShowPassword is not wired up; update the password and
confirm-password controls to include a toggle control (e.g., an icon/button)
that calls setShowPassword(prev => !prev) or a dedicated handler (e.g.,
handleToggleShowPassword) and ensure the input types use showPassword
(type={showPassword ? 'text' : 'password'}) for both Password and
ConfirmPassword fields (references: showPassword, setShowPassword, any Password
input/component in Signup.tsx).
- Around line 160-167: The Back button's icon animation is not triggering
because the ArrowLeft uses the group-hover utility but the parent element (the
button container in the JSX where className is set on the element wrapping
ArrowLeft and "Back to Home") doesn't include the "group" class; update the
parent element's className (the same element rendering ArrowLeft and the text in
Signup.tsx) to include "group" so the ArrowLeft's "group-hover:-translate-x-1"
can take effect, or alternatively remove the group-hover on ArrowLeft and use a
direct hover class on ArrowLeft if you prefer not to add "group" to the parent.
- Around line 74-104: In handleSubmit, clear any existing server-side
status/message state before running client-side validation so stale
success/error text is removed; specifically, call your status setter (e.g.,
setStatus('') or setServerMessage(null)) at the start of handleSubmit before
validating formData, and also clear it in the error-return branch where you call
setErrors and in the other submit-related branch around lines 120-123 so server
messages are reset whenever client-side validation fails or a new submit begins;
keep using the existing symbols handleSubmit, setErrors and your status setter
consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1b8d17bf-83d8-4f8d-bd39-89eb0c100bd7

📥 Commits

Reviewing files that changed from the base of the PR and between 9d34c19 and 1237f45.

📒 Files selected for processing (3)
  • src/pages/Contact/Contact.tsx
  • src/pages/Login/Login.tsx
  • src/pages/Signup/Signup.tsx

Comment on lines 31 to 32
const [showPassword, setShowPassword] = useState(false);
const [isLoading, setIsLoading] = useState(false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Password visibility toggle is currently non-functional.

showPassword is read, but nothing updates it, so the field always stays masked. This regresses expected UX.

Suggested fix
-            <div>
+            <div className="relative">
               <input
                 type={showPassword ? "text" : "password"}
                 name="password"
                 placeholder="Enter your password"
                 value={formData.password}
                 onChange={handleChange}
-                className="w-full px-4 py-4 rounded-2xl border"
+                className="w-full px-4 py-4 pr-12 rounded-2xl border"
               />
+              <button
+                type="button"
+                onClick={() => setShowPassword((prev) => !prev)}
+                className="absolute right-4 top-1/2 -translate-y-1/2 text-gray-500"
+                aria-label={showPassword ? "Hide password" : "Show password"}
+              >
+                {showPassword ? <EyeOff className="w-4 h-4" /> : <Eye className="w-4 h-4" />}
+              </button>
               {errors.password && (
                 <p className="text-red-500 text-sm mt-2">{errors.password}</p>
               )}
             </div>

Also applies to: 248-261

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/Signup/Signup.tsx` around lines 31 - 32, The password visibility
toggle state is never toggled because setShowPassword is not wired up; update
the password and confirm-password controls to include a toggle control (e.g., an
icon/button) that calls setShowPassword(prev => !prev) or a dedicated handler
(e.g., handleToggleShowPassword) and ensure the input types use showPassword
(type={showPassword ? 'text' : 'password'}) for both Password and
ConfirmPassword fields (references: showPassword, setShowPassword, any Password
input/component in Signup.tsx).

Comment on lines 74 to 104
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();

const usernameError = !formData.username.trim()
? "Username is required"
: !/^[A-Za-z\s]+$/.test(formData.username)
? "Only letters are allowed"
: "";
? "Only letters are allowed"
: "";

const emailError = !formData.email.trim()
? "Email is required"
: !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email.trim())
? "Enter a valid email"
: "";
? "Enter a valid email"
: "";

const passwordError = !formData.password.trim()
? "Password is required"
: !/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&]{8,}$/.test(formData.password)
? "Password must be 8+ characters with letters and numbers"
: "";
: !/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&]{8,}$/.test(
formData.password,
)
? "Password must be 8+ characters with letters and numbers"
: "";

if (usernameError || emailError || passwordError) {
setErrors({ username: usernameError, email: emailError, password: passwordError });
setErrors({
username: usernameError,
email: emailError,
password: passwordError,
});
return;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clear stale status message before client-side validation.

When validation fails, old server messages remain visible, which can show misleading success/error text.

Suggested fix
   const handleSubmit = async (e: React.FormEvent) => {
     e.preventDefault();
+    setMessage("");

Also applies to: 120-123

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/Signup/Signup.tsx` around lines 74 - 104, In handleSubmit, clear
any existing server-side status/message state before running client-side
validation so stale success/error text is removed; specifically, call your
status setter (e.g., setStatus('') or setServerMessage(null)) at the start of
handleSubmit before validating formData, and also clear it in the error-return
branch where you call setErrors and in the other submit-related branch around
lines 120-123 so server messages are reset whenever client-side validation fails
or a new submit begins; keep using the existing symbols handleSubmit, setErrors
and your status setter consistently.

Comment on lines +160 to +167
className={`mb-6 flex items-center gap-2 px-4 py-2 rounded-xl backdrop-blur-xl border transition-all duration-300 hover:scale-105 active:scale-95 ${
mode === "dark"
? "bg-white/10 text-white border-white/20 hover:bg-white/20"
: "bg-white/70 text-gray-800 border-gray-200 hover:bg-white"
}`}
>
<ArrowLeft className="w-4 h-4 transition-transform group-hover:-translate-x-1" />
Back to Home
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Back button hover animation class is wired incorrectly.

The icon uses group-hover:*, but the button is missing the group class, so the animation never triggers.

Suggested fix
-          className={`mb-6 flex items-center gap-2 px-4 py-2 rounded-xl backdrop-blur-xl border transition-all duration-300 hover:scale-105 active:scale-95 ${
+          className={`group mb-6 flex items-center gap-2 px-4 py-2 rounded-xl backdrop-blur-xl border transition-all duration-300 hover:scale-105 active:scale-95 ${
📝 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
className={`mb-6 flex items-center gap-2 px-4 py-2 rounded-xl backdrop-blur-xl border transition-all duration-300 hover:scale-105 active:scale-95 ${
mode === "dark"
? "bg-white/10 text-white border-white/20 hover:bg-white/20"
: "bg-white/70 text-gray-800 border-gray-200 hover:bg-white"
}`}
>
<ArrowLeft className="w-4 h-4 transition-transform group-hover:-translate-x-1" />
Back to Home
className={`group mb-6 flex items-center gap-2 px-4 py-2 rounded-xl backdrop-blur-xl border transition-all duration-300 hover:scale-105 active:scale-95 ${
mode === "dark"
? "bg-white/10 text-white border-white/20 hover:bg-white/20"
: "bg-white/70 text-gray-800 border-gray-200 hover:bg-white"
}`}
>
<ArrowLeft className="w-4 h-4 transition-transform group-hover:-translate-x-1" />
Back to Home
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/Signup/Signup.tsx` around lines 160 - 167, The Back button's icon
animation is not triggering because the ArrowLeft uses the group-hover utility
but the parent element (the button container in the JSX where className is set
on the element wrapping ArrowLeft and "Back to Home") doesn't include the
"group" class; update the parent element's className (the same element rendering
ArrowLeft and the text in Signup.tsx) to include "group" so the ArrowLeft's
"group-hover:-translate-x-1" can take effect, or alternatively remove the
group-hover on ArrowLeft and use a direct hover class on ArrowLeft if you prefer
not to add "group" to the parent.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 Feature: Add “Back to Home” Button on Contact, Sign In, and Sign Up Pages

1 participant