diff --git a/public/locales/en/common.json b/public/locales/en/common.json index b215bdcd..ebd7fe5c 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -102,6 +102,9 @@ "petAvailable": "Pet available", "petDeleted": "Pet deleted successfully", "petNotDeleted": "Pet not deleted", + "contactsForAdoption": "Contacts for adoption", "emailInvalid": "Email invalid", + "wantAdoption": "I want to adopt to", + "aboutUs": "About Us", "last": "Last" } \ No newline at end of file diff --git a/public/locales/en/login.json b/public/locales/en/login.json index 653900a9..932fd96c 100644 --- a/public/locales/en/login.json +++ b/public/locales/en/login.json @@ -6,7 +6,7 @@ "magicLink": "Email login link", "subject": "Login to your account ", "hello": "Hello", - "welcome": "Welcome to our app", + "welcome": "", "loginDescription": "Login to your account", "warning": "If you didn't request this, please ignore this email.", "thanks": "Thanks", diff --git a/public/locales/es/common.json b/public/locales/es/common.json index df834456..36d156d2 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -104,5 +104,8 @@ "petDeleted": "Mascota eliminada", "petNotDeleted": "Mascota no eliminada", "emailInvalid": "Correo invalido", + "contactsForAdoption": "Contactos para adopctar", + "wantAdoption": "Quiero adoptar a", + "aboutUs": "Sobre nosotros", "last": "Last" } \ No newline at end of file diff --git a/public/locales/es/login.json b/public/locales/es/login.json index 3c03777d..597f222f 100644 --- a/public/locales/es/login.json +++ b/public/locales/es/login.json @@ -6,7 +6,7 @@ "magicLink": "Iniciar de sesión", "subject": "Iniciar sesión en ", "hello": "Hola", - "welcome": "Bienvenido a", + "welcome": "", "loginDescription": "Hemos recibido una solicitud para iniciar sesión en su cuenta. Si no ha solicitado iniciar sesión, ignore este correo electrónico.", "warning": "Este enlace solo es válido por 15 minutos.", "thanks": "Gracias", diff --git a/src/components/Navigation/components/SideBar/index.tsx b/src/components/Navigation/components/SideBar/index.tsx index 18ec5155..dbe180d7 100644 --- a/src/components/Navigation/components/SideBar/index.tsx +++ b/src/components/Navigation/components/SideBar/index.tsx @@ -62,6 +62,18 @@ export const SideBar: FC = ({ window.location.reload() } + useEffect(() => { + const handleClickOutside = () => { + if (isOpenLngToggle) { + setIsOpenLngToggle(false) + } + } + window.addEventListener('click', handleClickOutside) + return () => { + window.removeEventListener('click', handleClickOutside) + } + }, [isOpenLngToggle]) + const handleOpenLngToggle = (e: MouseEvent) => { e.stopPropagation() setIsOpenLngToggle(!isOpenLngToggle) @@ -100,8 +112,8 @@ export const SideBar: FC = ({
{/* Fixed Sidebar */}
-
-
+
+
{menuIsCollapsed ? : }
diff --git a/src/components/PetCard/index.tsx b/src/components/PetCard/index.tsx index f34f7826..6b2bb12c 100644 --- a/src/components/PetCard/index.tsx +++ b/src/components/PetCard/index.tsx @@ -17,7 +17,7 @@ export const PetCard: FC = ({ return (
goToProfile(id)} - className="rounded-xl h-full md:w-[236px] flex bg-primary-100 shadow-md cursor-pointer" + className="rounded-xl pb-3 md:w-[236px] flex bg-primary-100 shadow-md cursor-pointer" >
@@ -26,7 +26,7 @@ export const PetCard: FC = ({ onError={(e) => { e.currentTarget.src = ImageNotFound }} - className="w-screen sm:w-[300px] h-[237px] object-cover rounded-xl" + className="md:w-[300px] h-[237px] object-cover rounded-xl" src={`${import.meta.env.VITE_BUCKET_NAME}pets/${images}`} />
diff --git a/src/components/common/Header/index.tsx b/src/components/common/Header/index.tsx index d646d6d0..b09aa70c 100644 --- a/src/components/common/Header/index.tsx +++ b/src/components/common/Header/index.tsx @@ -25,7 +25,7 @@ export const Header: FC = ({ buttonBack, title }) => { icon={} /> )} -

{title}

+

{title}

) } diff --git a/src/pages/CommunityPage/components/CommunityTable/index.tsx b/src/pages/CommunityPage/components/CommunityTable/index.tsx index dcd15eb8..9ec88390 100644 --- a/src/pages/CommunityPage/components/CommunityTable/index.tsx +++ b/src/pages/CommunityPage/components/CommunityTable/index.tsx @@ -40,37 +40,37 @@ export const CommunityTable: React.FC = ({
- +
- + {data?.users.map((user: User) => ( {
-

+

{t('community:findProfessionals')}

-

+

{t('community:findProfessionalDescription')}

diff --git a/src/pages/DashboardPage/components/DashboardHeader/index.tsx b/src/pages/DashboardPage/components/DashboardHeader/index.tsx index 6472b96d..29291c1c 100644 --- a/src/pages/DashboardPage/components/DashboardHeader/index.tsx +++ b/src/pages/DashboardPage/components/DashboardHeader/index.tsx @@ -31,9 +31,9 @@ export const DashboardHeader: React.FC = ({ const { t } = useTranslation(['dashboard', 'common']) return ( -
+
-
+
= ({ <>
-

+

{t('common:pets')}

-

+

{t('dashboard:listOfPets')}

@@ -116,62 +116,62 @@ export const DashboardTable: React.FC = ({
-
{t('common:name')} {t('common:location')} {t('common:role')} - {t('common:contact')} + scope="col" + className="px-8 py-3.5 text-right bg-primary-100 text-sm font-semibold text-primary-950 rounded-tr-xl" + > + {t('common:contact')}
+
- + - + {data?.pets && - data?.pets.map((pet: Pet) => ( + data?.pets.map((pet: Pet, index: number) => ( goToPet(pet.id)} - className="hover:bg-primary-100 cursor-pointer" + className='hover:bg-primary-100 cursor-pointer' > - -
{t('common:name')} {t('common:gender')} {t('common:category')} {t('common:age')} {t('common:size')} {t('common:status')} - {t('common:edit')} + {t('common:actions')}
+
= ({ />
-
+
{pet.name}
@@ -214,7 +214,7 @@ export const DashboardTable: React.FC = ({ text={pet.adopted ? t('common:adopted') : t('common:available')} />
+
{ const [successEmailLogin, setSuccessEmailLogin] = useState(false); const [loading, setLoading] = useState(true); const urlParams = new URLSearchParams(window.location.search); const token = urlParams.get('token'); const { t } = useTranslation(['common', 'login']); - const [email, setEmail] = useState({ - value: '', - error: false, - helperText: '', - }); useEffect(() => { setSuccessEmailLogin(false); @@ -29,33 +27,30 @@ export const LoginGoogle: FC = () => { setTimeout(() => setLoading(false), 500); }, [token]); + + + const formik = useFormik({ + validationSchema: loginSchema, + initialValues: { + email: '', + }, + onSubmit: async (values) => { + loginEmailCallback(values.email) + formik.resetForm() + }, + }) + const signInWithGoogle = async () => { const { data } = await axios.get('/api/auth/google/') location.href = data?.location } - const isValidEmail = (email: string) => { - return /\S+@\S+\.\S+/.test(email); - }; - - const handleChangeEmail = (e: ChangeEvent) => { - const emailValue = e.target.value; - setEmail({ - value: emailValue, - error: !isValidEmail(emailValue), - helperText: isValidEmail(emailValue) ? '' : t('common:emailInvalid'), - }); - }; - const loginEmailCallback = async () => { - if (!isValidEmail(email.value)) { - setEmail({ ...email, error: true, helperText: t('common:emailInvalid') }); - return; - } + const loginEmailCallback = async (email: string) => { try { setLoading(true); await axios.post('/api/auth/email/', { - email: email.value, + email: email, texts: { subject: t('login:subject'), hello: t('login:hello'), @@ -70,20 +65,10 @@ export const LoginGoogle: FC = () => { setLoading(false); } catch (error) { setLoading(false); - setEmail({ - ...email, - error: true, - helperText: t('login:emailError'), - }); } }; - const handleLoginEmail = () => { - setEmail({ ...email, error: !isValidEmail(email.value) }); - if (isValidEmail(email.value)) { - loginEmailCallback(); - } - }; + const { values, errors, handleSubmit, handleChange } = formik if (loading) { return ( @@ -104,45 +89,46 @@ export const LoginGoogle: FC = () => {
{successEmailLogin ? -

- {t('login:emailSent')} -

: - <> -

- Pet's Love -

-
-
-
- -
- - {t('login:or')} - -
-
- -
-
- + {t('login:emailSent')} + : + <> +
+

+ Pet's Love +

+
+
+
+ +
+ + {t('login:or')} + +
+
+ +
+
+ +
-
- + }
@@ -150,3 +136,7 @@ export const LoginGoogle: FC = () => {
) } + +const loginSchema = Yup.object().shape({ + email: Yup.string().email('Invalid email').required('Email is required'), +}) \ No newline at end of file diff --git a/src/pages/ProfilePetPage/components/GeneralPetInfo/index.tsx b/src/pages/ProfilePetPage/components/GeneralPetInfo/index.tsx index 772d059e..61f66874 100644 --- a/src/pages/ProfilePetPage/components/GeneralPetInfo/index.tsx +++ b/src/pages/ProfilePetPage/components/GeneralPetInfo/index.tsx @@ -6,6 +6,7 @@ import { DetailCard } from '../DetailCard' interface Props { data: { + id: string age: string size: string breed: string @@ -13,14 +14,13 @@ interface Props { gender: string qrCode: string category: string + name: string description: string // eslint-disable-next-line @typescript-eslint/no-explicit-any shelter?: any } } - - export const GeneralPetInfo: React.FC = ({ data }) => { const { t } = useTranslation(['common']) @@ -46,7 +46,7 @@ export const GeneralPetInfo: React.FC = ({ data }) => {

- {t('common:contact')}: + {t('common:contactsForAdoption')}:

{data?.shelter.socialMedia?.instagram && ( @@ -66,7 +66,8 @@ export const GeneralPetInfo: React.FC = ({ data }) => {
-
-
-

+
+
+

{t('common:location')}

-

+

{t('settings:locationDescription')}

diff --git a/src/pages/SettingsPage/components/SocialMediaForm/index.tsx b/src/pages/SettingsPage/components/SocialMediaForm/index.tsx index 641f0a21..0111c1ff 100644 --- a/src/pages/SettingsPage/components/SocialMediaForm/index.tsx +++ b/src/pages/SettingsPage/components/SocialMediaForm/index.tsx @@ -25,10 +25,10 @@ export const SocialMediaForm: FC = ({
-

+

{t('settings:socialMediaAndContacts')}

-

+

{t('settings:socialMediaAndContactsDescription')}

diff --git a/src/pages/SettingsPage/index.tsx b/src/pages/SettingsPage/index.tsx index ee6a0ba8..b69080c1 100644 --- a/src/pages/SettingsPage/index.tsx +++ b/src/pages/SettingsPage/index.tsx @@ -30,8 +30,6 @@ export const SettingsPage: FC = () => { const formik = useFormik({ initialValues: INITIAL_STATE, onSubmit: (values) => { - console.log(values); - mutate({ ...values, id: context?.user?.id || '', diff --git a/src/pages/UserProfilePage/components/UserProfile/index.tsx b/src/pages/UserProfilePage/components/UserProfile/index.tsx index c14030d4..d8d1d634 100644 --- a/src/pages/UserProfilePage/components/UserProfile/index.tsx +++ b/src/pages/UserProfilePage/components/UserProfile/index.tsx @@ -120,7 +120,7 @@ export const UserProfile: FC = ({ user }) => {
{user?.description && (
-

About Us

+

{t('aboutUs')}

{user.description}

)}