From ba23f5258d98dae1ab89465a1440cb98c96c6f9d Mon Sep 17 00:00:00 2001 From: Rakov Roman Date: Tue, 14 Mar 2023 17:23:39 +0300 Subject: [PATCH] fix(#188): tunisia pr fix --- src/features/AuthServiceApp/hooks/useAuthFields.tsx | 6 ++++-- src/features/ProfileHeader/index.tsx | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/features/AuthServiceApp/hooks/useAuthFields.tsx b/src/features/AuthServiceApp/hooks/useAuthFields.tsx index c9d66bbd..b2bce7bf 100644 --- a/src/features/AuthServiceApp/hooks/useAuthFields.tsx +++ b/src/features/AuthServiceApp/hooks/useAuthFields.tsx @@ -7,6 +7,8 @@ import { useState } from 'react' import { isValidEmail } from 'features/AuthServiceApp/helpers/isValidEmail' import { isValidPassword } from 'features/AuthServiceApp/helpers/isValidPassword' +import { PAGES } from 'features/AuthServiceApp/config/pages' + export const useAuthFields = (page: 'login'|'registration') => { const [email, setEmail] = useState('') const [password, setPassword] = useState('') @@ -20,7 +22,7 @@ export const useAuthFields = (page: 'login'|'registration') => { const onEmailChange = ({ target: { value } }: ChangeEvent) => { setError('') setEmail(value) - const isRegisterPage = page === 'registration' + const isRegisterPage = page === PAGES.registration if (password.length && !checkPassword(password) && isRegisterPage) { setError('check_password') } @@ -29,7 +31,7 @@ export const useAuthFields = (page: 'login'|'registration') => { const onPasswordChange = ({ target: { value } }: ChangeEvent) => { setError('') setPassword(value) - const isRegisterPage = page === 'registration' + const isRegisterPage = page === PAGES.registration if (!checkPassword(value) && isRegisterPage) { setError('check_password') } diff --git a/src/features/ProfileHeader/index.tsx b/src/features/ProfileHeader/index.tsx index a45fdaa0..5cdb1c05 100644 --- a/src/features/ProfileHeader/index.tsx +++ b/src/features/ProfileHeader/index.tsx @@ -33,6 +33,11 @@ type Props = { profileId?: number, } +const profileWithImage = { + 316: 'Spain', + 5704: 'Tunis', +} + export const ProfileHeader = ({ children, color: headerColor, @@ -46,7 +51,8 @@ export const ProfileHeader = ({ } = usePageParams() const color = useProfileColor(profileId) - const imageHeader = (profileId === 5704 || profileId === 316) + // @ts-ignore + const imageHeader = Boolean(profileWithImage[profileId]) && sportType === SportTypes.FOOTBALL && profileType === ProfileTypes.TOURNAMENTS ? `/images/${profileId}` : headerImage