Skip to content

Feature/login and reset password form #114

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

anetasliwinska
Copy link
Collaborator

@anetasliwinska anetasliwinska commented May 15, 2025

Small UI changes in SingIn Form
Adding reset password form.

@anetasliwinska anetasliwinska force-pushed the feature/login-and-reset-password-form branch 3 times, most recently from 55643ac to b7815c8 Compare May 16, 2025 15:20
@anetasliwinska anetasliwinska force-pushed the feature/login-and-reset-password-form branch from da193cc to a3d2d9e Compare May 20, 2025 22:16
@anetasliwinska anetasliwinska marked this pull request as ready for review May 20, 2025 22:16
</Typography>
<div className="flex flex-col gap-12 w-full">
<div className="flex flex-col gap-6">
{labels.resetPasswordMessage && (
Copy link
Collaborator

Choose a reason for hiding this comment

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

this needs another condition - labels should always be provided, but the message itself should be displayed based on an URL parameter, e.g. ?passwordReset=true

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok. I made a change.

<div className="flex flex-col gap-12 w-full">
<div className="flex flex-col gap-6">
{labels.resetPasswordMessage && (
<Banner
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed.

<Typography variant="small" className="mt-1">
{labels.invalidCredentials}
{labels.newPasswordMessage && (
<Banner
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed.

{validations && (
<InputValidations
targetInputName={field.name}
validations={validations as InputValidationRegExpLabel[]}
Copy link
Collaborator

Choose a reason for hiding this comment

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

could this casting be removed if you type it as validations: InputValidationRegExpLabel[]?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Of course - I changed it.

useEffect(() => {
onValid && onValid(active.every((el) => el));
}, [active, onValid]);
return (
Copy link
Collaborator

@marcinkrasowski marcinkrasowski May 22, 2025

Choose a reason for hiding this comment

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

code style - let's add an empty line between main parts of code (e.g. here before and after useEffect) for clarity

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok. Changed.

return (
<div className="grid grid-cols-2 gap-2">
{validations.map(({ label }, index) => (
<div className="flex items-center gap-2" key={`${label}-${index}`}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe it could be a list?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A good idea. I handled 2 situations - when map includes the only one element it is rendered in a <div> structure for more elements as a list

@@ -6,7 +6,7 @@ export const AuthLayout: React.FC<AuthLayoutProps> = ({ layout = 'main-side', to
const main = (
<div className="flex flex-col md:max-w-[50%] w-full p-4">
Copy link
Collaborator

Choose a reason for hiding this comment

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

perhaps the content should be centered vertically on mobile as well (it already is on desktop)? we could consult UX about this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Very good idea - I made a change.

import { FormValues, ResetPasswordFormProps } from './ResetPassword.types';

export const ResetPasswordForm: React.FC<Readonly<ResetPasswordFormProps>> = ({ labels, onResetPassword }) => {
const [isSubmitting, setIsSubmitting] = useState(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this could be replaced with the new feature in react 19 https://react.dev/reference/react/useTransition (there are some examples of this in the app)
here and in other forms (sign-in, create new password)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added also to SignInForm and CreateNewPasswordForm. I also added LoadingOverlay.

Comment on lines 25 to 36
forgotPassword?: {
label: string;
link: string;
};
resetPasswordMessage?: {
title?: string;
description?: string;
};
newPasswordMessage?: {
title?: string;
description?: string;
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's make these mandatory

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

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.

2 participants