Skip to content

Comments

Feature: Improved Sign Up Validation & UX#46

Open
ziennaa wants to merge 2 commits intoChiragAgg5k:masterfrom
ziennaa:master
Open

Feature: Improved Sign Up Validation & UX#46
ziennaa wants to merge 2 commits intoChiragAgg5k:masterfrom
ziennaa:master

Conversation

@ziennaa
Copy link

@ziennaa ziennaa commented Oct 11, 2025

Feature: Improved Sign Up Validation & UX

Description

Enhanced the Sign Up page by adding a Confirm Password field, improving form validation, and providing better feedback for users during registration.

This PR fixes that by adding instant validation, a password match check, and timeout feedback for smoother user experience.


Changes Made

  • Added Confirm Password input field.
  • Added password match validation with toast notification.
  • Implemented timeout feedback for delayed API responses.
  • Disabled “Continue” button until all fields are filled.
  • Improved button loading state and UX consistency.

Impact

Improves user experience, prevents invalid signups, and adds professional grade UX validation.


Summary by CodeRabbit

  • New Features
    • Enhanced sign-up form with name and confirm password fields, two-way inputs, and client-side password match validation; redirects to dashboard on success.
    • Added loading states and toasts: delayed-progress notice, explicit error messages, and a 20s timeout safeguard.
  • Bug Fixes
    • More reliable Google sign-up: shows a clear message if the option isn’t available.
  • Style
    • Tweaked labels, input placement, and icon sizing for improved clarity.

@vercel
Copy link

vercel bot commented Oct 11, 2025

@ziennaa is attempting to deploy a commit to the Chirag Aggarwal's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Oct 11, 2025

Walkthrough

Implements client-side state and validation for the sign-up form, adds a timeout-driven submission flow with toasts and navigation on success, and guards Google sign-up. Also updates icon prop typings from React.HTMLAttributes to React.SVGProps across UI icons.

Changes

Cohort / File(s) Summary
Auth sign-up form logic and UI
src/app/(auth)/sign-up/page.tsx
Replaces FormData extraction with local state; adds confirm-password validation; implements Promise.race with 20s timeout; shows delayed-progress toast at 8s; navigates to /dashboard on success; error toasts on failure; disables submit until fields complete; loading spinner; guards Google sign-up if unavailable.
UI icon prop typing refactor
src/components/ui/icons.tsx
Changes IconProps from React.HTMLAttributes<SVGElement> to React.SVGProps<SVGSVGElement>; no rendering changes, broadens SVG-specific prop support.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant S as SignUpPage
  participant Auth as Auth API/Service
  participant T as Timeout (20s)
  participant Toast as Toast UI
  participant R as Router

  U->>S: Submit name/email/password/confirm
  S->>S: Validate password === confirm
  alt mismatch
    S->>Toast: Show error "Passwords do not match"
    S-->>U: Abort submission
  else valid
    par delayed notice
      S->>Toast: (after 8s) Show "Still working..." info
    and race
      S->>Auth: register(data)
      S->>T: start 20s timer
      alt Auth resolves first
        Auth-->>S: success
        S->>Toast: Dismiss notices
        S->>R: navigate /dashboard
      else Timeout fires first
        T-->>S: timeout error
        S->>Toast: Show timeout error
      end
    end
    S->>S: Clear timers, unset loading
  end
Loading
sequenceDiagram
  autonumber
  actor U as User
  participant S as SignUpPage
  participant G as loginWithGoogle
  participant Toast as Toast UI

  U->>S: Click "Continue with Google"
  alt Google handler available
    S->>G: Invoke Google sign-in
    G-->>S: resolve/reject
    alt success
      S-->>U: Continue (navigation handled elsewhere)
    else error
      S->>Toast: Show error message
    end
  else missing handler
    S->>Toast: Show "Unavailable" warning
    S-->>U: No action
  end
  S->>S: Maintain/clear loading appropriately
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I thump my paw—new forms take flight,
Two fields to match, make passwords right.
A timer ticks, a toast goes “ping!”
If Google naps, we mind the thing.
Icons flex with SVG grace—
I hop to prod, then race to base. 🥕✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “Feature: Improved Sign Up Validation & UX” clearly identifies the primary enhancement to the sign-up workflow by focusing on validation improvements and user experience updates without unnecessary detail or noise.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@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: 1

🧹 Nitpick comments (2)
src/app/(auth)/sign-up/page.tsx (2)

140-160: Consider extracting the disabled condition to reduce duplication.

The submit button correctly disables when fields are empty or during loading. However, the disabled condition is duplicated in both the disabled prop (lines 143-147) and the className logic (lines 149-151).

Apply this refactor to improve maintainability:

+                const isFormIncomplete = !name || !email || !password || !confirmPassword;
+
                 <Button
                   type="submit"
                   disabled={
-                    loading ||
-                    !name ||
-                    !email ||
-                    !password ||
-                    !confirmPassword
+                    loading || isFormIncomplete
                   }
                   className={`w-full mt-4 ${
-                    !name || !email || !password || !confirmPassword
+                    isFormIncomplete
                       ? "opacity-50 cursor-not-allowed"
                       : ""
                   }`}

52-58: Abort registration on timeout or enforce idempotent retries

The Promise.race timeout doesn’t cancel user.register, so a slow response may succeed after the timeout and create an account while showing an error. Use an AbortController to cancel the request on timeout or make the registration endpoint idempotent (e.g., reuse a fixed user ID) and handle duplicate‐email errors gracefully.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ffa4a74 and 7fa01a3.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • src/app/(auth)/sign-up/page.tsx (2 hunks)
  • src/components/ui/icons.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/app/(auth)/sign-up/page.tsx (5)
src/components/ui/card.tsx (5)
  • Card (80-80)
  • CardHeader (81-81)
  • CardTitle (83-83)
  • CardDescription (84-84)
  • CardContent (85-85)
src/components/ui/label.tsx (1)
  • Label (26-26)
src/components/ui/input.tsx (1)
  • Input (25-25)
src/components/ui/button.tsx (1)
  • Button (56-56)
src/components/ui/icons.tsx (1)
  • Icons (3-148)
🔇 Additional comments (5)
src/components/ui/icons.tsx (1)

1-1: LGTM! Better type safety for SVG components.

The change from React.HTMLAttributes<SVGElement> to React.SVGProps<SVGSVGElement> is an improvement. It provides more accurate typing for SVG-specific attributes and events while remaining compatible with existing usage.

src/app/(auth)/sign-up/page.tsx (4)

27-30: LGTM! Appropriate state management for controlled form inputs.

The state declarations follow React best practices for controlled components.


37-43: LGTM! Clear password validation with appropriate user feedback.

The password match validation is implemented correctly with an early return to prevent submission and a descriptive toast notification.


45-49: LGTM! Good UX pattern for long-running requests.

The timeout feedback mechanism provides helpful user feedback when the API response is delayed. The timeout is properly cleared in the finally block.


100-138: LGTM! Well-structured and accessible form inputs.

The form inputs follow accessibility best practices with proper labels, IDs, and the controlled component pattern. Input types are appropriate for each field.

Comment on lines 170 to 185
onClick={() => {
setLoading(true);
user.loginWithGoogle();
try {
setLoading(true);
if (user?.loginWithGoogle) {
user.loginWithGoogle();
} else {
toast("Google Sign-Up coming soon!", {
description:
"The integration isn’t available yet.",
});
setLoading(false);
}
} catch {
setLoading(false);
}
}}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Empty catch block may silently swallow errors.

The Google Sign-Up handler has an empty catch block that only resets the loading state. If loginWithGoogle() throws an error, it will be silently ignored without any user feedback or logging.

Consider adding error handling:

                   } catch {
+                    toast("Sign-Up failed", {
+                      description: "An error occurred during Google Sign-Up. Please try again.",
+                    });
                     setLoading(false);
                   }

Alternatively, if errors from loginWithGoogle are handled internally, you can add a comment explaining this:

-                  } catch {
+                  } catch {
+                    // loginWithGoogle handles its own errors
                     setLoading(false);
                   }
📝 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
onClick={() => {
setLoading(true);
user.loginWithGoogle();
try {
setLoading(true);
if (user?.loginWithGoogle) {
user.loginWithGoogle();
} else {
toast("Google Sign-Up coming soon!", {
description:
"The integration isn’t available yet.",
});
setLoading(false);
}
} catch {
setLoading(false);
}
}}
onClick={() => {
try {
setLoading(true);
if (user?.loginWithGoogle) {
user.loginWithGoogle();
} else {
toast("Google Sign-Up coming soon!", {
description:
"The integration isn’t available yet.",
});
setLoading(false);
}
} catch {
toast("Sign-Up failed", {
description:
"An error occurred during Google Sign-Up. Please try again.",
});
setLoading(false);
}
}}
🤖 Prompt for AI Agents
In src/app/(auth)/sign-up/page.tsx around lines 170 to 185, the catch block for
the Google Sign-Up onClick handler is empty and will silently swallow errors;
change it to catch the error (e.g., catch (err)) and handle it by resetting
loading state, logging the error (console.error or app logger), and showing user
feedback (toast with an error message), or alternatively add a clear comment
stating that loginWithGoogle handles all errors internally if that is true;
ensure loading is always reset (use finally or setLoading(false) in both catch
and the non-error branch).

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.

1 participant