-
-
Notifications
You must be signed in to change notification settings - Fork 503
QF-2017 QDC unified registration cleanup #2408
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
base: testing
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…s and update imports
…onents for better clarity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR unifies and cleans up the registration flow, replaces ad-hoc back buttons and forms, and fixes font preloading and console warnings.
- Rebuilt the complete signup component into a single unified flow with custom form fields and verification handling
- Introduced a reusable BackButton and PrivacyPolicyText, and refactored LoginContainer and ForgotPasswordForm accordingly
- Extended FormBuilder to support custom error styling and skip native validation, and corrected Figtree font preload type
Reviewed Changes
Copilot reviewed 63 out of 63 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/components/Login/LoginContainer.tsx | Simplified layout, added BackButton & PrivacyPolicyText, removed nested containers |
src/components/Login/ForgotPassword/ForgotPasswordForm.tsx | Replaced inline Button with BackButton, added custom Input render, removed redirect on success |
src/components/Login/CompleteSignupForm.tsx | New unified complete signup flow with inline verification and custom form fields |
src/components/Login/CompleteSignupFormFields/index.ts | Helper for translating and overriding signup form fields, including simplified email regex |
src/components/Login/BackButton.tsx | New reusable BackButton component |
src/components/FormBuilder/FormBuilder.tsx | Added errorClassName support, shouldSkipValidation prop, and centralized error rendering |
src/components/Fonts/FontPreLoader.tsx | Corrected font type for Figtree preload |
Comments suppressed due to low confidence (3)
src/components/Login/CompleteSignupForm.tsx:1
- [nitpick] This component exceeds recommended size and complexity. Consider splitting it into smaller subcomponents (e.g., form sections, verification sections) to improve readability and testability.
/* eslint-disable max-lines */
src/components/Login/ForgotPassword/ForgotPasswordForm.tsx:50
- The removal of
router.push(getLoginNavigationUrl())
prevents navigation back to the login screen after success; consider re-adding a redirect or alternative flow to complete the user journey.
setIsSubmitting(false);
src/components/Login/LoginContainer.tsx:133
- The conditional full vs inner container logic was removed, which may break intended page styling for verification vs regular views. Verify and restore dynamic container classes if needed.
return <div className={authStyles.outerContainer}>{renderContent()}</div>;
bugbot run |
…-next into QF-2017-QDC-unified-registration-cleanup
…ub.com/quran/quran.com-frontend-next into QF-2017-QDC-unified-registration-cleanup
} | ||
|
||
export enum InputType { | ||
Error = 'error', | ||
Warning = 'warning', | ||
Success = 'success', | ||
AuthForm = 'authForm', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔄 Cleaner Approach: Composition Over Configuration
The variant approach adds complexity to the base Input
component. Here's a cleaner solution using composition by creating AuthInput
:
// Simple dedicated component
<AuthInput {...props} htmlType="email" />
AuthInput implementation:
import React from 'react';
import classNames from 'classnames';
import Input, { InputSize } from '../Input';
import styles from './AuthInput.module.scss';
interface AuthInputProps {
id: string;
value: string;
onChange: (value: string) => void;
placeholder?: string;
disabled?: boolean;
htmlType?: 'text' | 'email' | 'password';
name?: string;
autoComplete?: string;
className?: string;
}
/**
* Specialized input component for authentication forms.
* Provides consistent styling and behavior across all auth forms.
* @param {AuthInputProps} props - The component props
* @returns {React.FC<AuthInputProps>} - The AuthInput component
*/
const AuthInput: React.FC<AuthInputProps> = ({
id,
value,
onChange,
placeholder,
disabled = false,
htmlType = 'text',
name,
autoComplete,
className,
}) => {
return (
<Input
id={id}
value={value}
onChange={onChange}
placeholder={placeholder}
disabled={disabled}
htmlType={htmlType}
name={name}
size={InputSize.Large}
fixedWidth={false}
shouldFlipOnRTL
containerClassName={classNames(styles.authContainer, className, {
[styles.disabled]: disabled,
})}
inputClassName={classNames(styles.authInput, {
[styles.hasValue]: value,
})}
{...(autoComplete && { autoComplete })}
/>
);
};
export default AuthInput;
AuthInput.module.scss
:
/* Auth-specific container overrides */
.authContainer {
height: var(--spacing-xxlarge-px);
border-radius: var(--border-radius-medium-px);
border: 1px solid var(--color-border-gray-lighter);
padding-inline: 0;
width: 100%;
background-color: var(--color-background-default);
transition: border-color 0.2s ease;
&:hover,
&:focus-within {
border-color: var(--color-success-medium);
}
&.disabled {
cursor: not-allowed;
background-color: var(--color-border-gray-faded);
border-color: var(--color-border-gray-lighter);
&:hover,
&:focus-within {
border-color: var(--color-border-gray-lighter);
}
}
}
/* Auth-specific input overrides */
.authInput {
height: var(--spacing-xxlarge-px);
padding-inline: calc(var(--spacing-xsmall-px) * 2);
border: none;
margin: 0;
&::placeholder {
color: var(--color-border-gray-light);
}
&:hover,
&:focus,
&.hasValue {
border: none; /* Let container handle the border */
}
&:disabled {
cursor: not-allowed;
color: var(--color-border-gray-dark);
background-color: var(--color-border-gray-faded);
}
}
Input.tsx
:
interface Props {
// ... existing props
inputClassName?: string; // ← New prop added
// ... rest of props
}
...
<input
className={classNames(styles.input, inputClassName, { // ← Added inputClassName here
[styles.error]: type === InputType.Error,
[styles.success]: type === InputType.Success,
[styles.warning]: type === InputType.Warning,
[styles.rtlInput]: shouldFlipOnRTL,
[styles.disabled]: disabled,
})}
// ... rest of input props
/>
Now AuthInput
can be used inside the auth-specific forms.
🎯 Benefits
- Single Responsibility: Input stays generic, AuthInput handles auth styling
- DRY: Reuses Input infrastructure without duplication
- Maintainable: Auth changes only touch AuthInput
- Cleaner: No complex conditionals or variant logic
Same functionality, much cleaner architecture! 🚀
Summary
Closes: QF-2017 QF-2466 QF-2469 QF-2446 QF-2444 QF-2442 QF-2440 QF-2027 QF-2026 QF-2004
Type of change
Test plan
This PR has been tested for responsiveness, different locales
en
andar
, different themeslight, dark, and sepia
and different browserschrome, and safari
.Checklist
Screenshots example for the main page