Skip to content

Conversation

@aissatsana
Copy link
Collaborator

  • A User Profile link or button is present in the website's header only for logged-in users.
  • Clicking on the User Profile link or button redirects the user to their Profile page.
  • Users who are not logged in do not see the User Profile link or button.
  • Navigating to and from the User Profile page changes the URL in the browser.
  • The User Profile page has a unique URL that can be directly accessed.
  • Directly accessing the unique URL for the User Profile page leads to the User Profile page, if the user is logged in. If the user is not logged in, they are redirected to the Login page.
  • The browser's Back and Forward buttons work correctly when navigating to and from the User Profile page.
  • Only logged-in users can access the User Profile page.
  • Users can manage their addresses within the User Profile page using commercetools API, including adding new addresses, deleting existing ones, and updating address details.
  • Users can set their default billing and shipping addresses.
  • The system validates input address details according to the necessary criteria.
  • The application properly integrates with the commercetools API for address management purposes.
  • [x]Users can change their password separately from their other personal information on the User Profile page.
  • The system appropriately validates the new password based on the necessary criteria.
  • The user can save the changes, and is given a clear indication of the success or failure of this operation.
  • In the edit mode on the User Profile page, users can update their first name, last name, date of birth, and email address.
  • The system appropriately validates all changes, including the validity of the email address.
  • The User Profile page displays the user's first name, last name, and date of birth.
  • The User Profile page lists all saved addresses for the user, with all relevant information for each address.
  • The default billing and shipping addresses are clearly indicated on the User Profile page.
  • The User Profile page displays the user's first name, last name, and date of birth.
  • The User Profile page lists all saved addresses for the user, with all relevant information for each address.
  • The default billing and shipping addresses are clearly indicated on the User Profile page.

Left some comments for refactoring and improving code, please leave it after merge

@aissatsana aissatsana changed the base branch from main to sprint-3 June 2, 2025 00:51
Comment on lines +1 to +29
import type { TextFieldConfig } from './types';

export const TEXT_FIELDS: TextFieldConfig[] = [
{ key: 'firstName', label: 'First Name' },
{ key: 'lastName', label: 'Last Name' },
{ key: 'email', label: 'Email' },
{ key: 'password', label: 'Password', type: 'password' },
];

export const ERROR_MESSAGES = {
REQUIRED: 'This field is required',
FIRST_NAME_REQUIRED: 'First name is required',
LAST_NAME_REQUIRED: 'Last name is required',
EMAIL_REQUIRED: 'Email is required',
PASSWORD_REQUIRED: 'Password is required',
BIRTH_DATE_REQUIRED: 'Date of birth is required',
SHIPPING_ADDRESS_REQUIRED: 'Please select a default shipping address',
BILLING_ADDRESS_REQUIRED: 'Please select a default billing address',

LETTERS_ONLY: 'Only letters allowed',
INVALID_EMAIL: 'Enter correct email',
INVALID_PASSWORD:
'Minimum 8 characters, at least 1 uppercase letter, 1 lowercase letter, and 1 number',
AGE_RESTRICTION: 'You must be older than 13 years old',
INVALID_SHIPPING_ADDRESS: 'Invalid default shipping address',
INVALID_BILLING_ADDRESS: 'Invalid default billing address',
};

export const MIN_AGE = 13;
Copy link
Owner

Choose a reason for hiding this comment

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

Это круто, что ты выносишь в переменные тексты 👍

const loginWithCommercetools = async (credentials: ILoginFormProps) => {
try {
await switchToPasswordFlow(credentials.email, credentials.password);
//NEED REFACTOR
Copy link
Owner

Choose a reason for hiding this comment

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

есть плагины для VSCode Todo Tree или Better Comments. Для подобных комментариев 🔥

}) => {
//PUT TO SHARED
const formatDate = (dateString: string) => {
return new Date(dateString).toLocaleDateString('en-US', {
Copy link
Owner

Choose a reason for hiding this comment

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

язык лучше было вынести в константу

window.addEventListener('authStatusChanged', () => {
const isAuth = localStorageService.getAuthStatus();
if (!isAuth) navigate('/');
if (!isAuth) navigate('/login');
Copy link
Owner

Choose a reason for hiding this comment

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

отлично

@cherkasovaa cherkasovaa merged commit f1d49f3 into sprint-3 Jun 2, 2025
2 checks passed
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.

3 participants