diff --git a/USupport-components-library b/USupport-components-library index dfc1fc8..96d851c 160000 --- a/USupport-components-library +++ b/USupport-components-library @@ -1 +1 @@ -Subproject commit dfc1fc8f685a213727973c752886b1bdcacbdaa5 +Subproject commit 96d851ca08ae05ff863be507b2f7aa25169898b4 diff --git a/src/backdrops/ConfirmConsultation/locales/kk.json b/src/backdrops/ConfirmConsultation/locales/kk.json index 8f48572..3f5ea44 100644 --- a/src/backdrops/ConfirmConsultation/locales/kk.json +++ b/src/backdrops/ConfirmConsultation/locales/kk.json @@ -1,7 +1,7 @@ { "heading": "Кездесуіңіз брондалды", "ctaLabel": "Kontynuuj", - "text": "na {{startDate}} {{month}} {{year}} dla terminu od {{startTime}} do {{endTime}}. Można go zmienić w dowolnym momencie za pośrednictwem aplikacji.", + "text": "{{startDate}}-шы/ші {{month}} {{year}} күніне {{startTime}} бастап {{endTime}} дейінгі слот үшін. Оны кез келген уақытта қосымша арқылы өзгерте аласыз.", "january": "қаңтар", "february": "ақпан", "march": "наурыз", diff --git a/src/blocks/RegisterAboutYou/RegisterAboutYou.jsx b/src/blocks/RegisterAboutYou/RegisterAboutYou.jsx index 84878c6..ef23a42 100644 --- a/src/blocks/RegisterAboutYou/RegisterAboutYou.jsx +++ b/src/blocks/RegisterAboutYou/RegisterAboutYou.jsx @@ -36,7 +36,7 @@ export const RegisterAboutYou = ({ isAnonymous }) => { name: Joi.string().allow(null, "", " ").label(t("name_error")), surname: Joi.string().allow(null, "", " ").label(t("surname_error")), sex: Joi.string().invalid(null).label(t("sex_error")), - yearOfBirth: Joi.number().invalid(null).label(t("year_of_birth_error")), + yearOfBirth: Joi.string().invalid(null).label(t("year_of_birth_error")), urbanRural: Joi.string().invalid(null).label(t("place_of_living_error")), }); @@ -89,8 +89,12 @@ export const RegisterAboutYou = ({ isAnonymous }) => { year <= currentYear - minAge; year++ ) { - years.push({ label: year.toString(), value: year }); + years.push({ label: year.toString(), value: year.toString() }); } + years.push({ + label: t("parent"), + value: "parent", + }); return years.reverse(); }, [countriesData]); const onMutateSuccess = () => { @@ -194,7 +198,9 @@ export const RegisterAboutYou = ({ isAnonymous }) => { options={getYearsOptions()} selected={data.yearOfBirth} errorMessage={errors.yearOfBirth} - setSelected={(option) => handleSelect("yearOfBirth", option)} + setSelected={(option) => + handleSelect("yearOfBirth", option.toString()) + } label={t("dropdown_year_label")} classes="register-about-you__grid__content-item__inputs-container__year-dropdown" placeholder={t("year_of_birth_placeholder")} diff --git a/src/blocks/RegisterAboutYou/locales/en.json b/src/blocks/RegisterAboutYou/locales/en.json index 06d01a5..9896566 100644 --- a/src/blocks/RegisterAboutYou/locales/en.json +++ b/src/blocks/RegisterAboutYou/locales/en.json @@ -18,5 +18,6 @@ "place_of_living_error": "Please enter your place of living", "sex_placeholder": "Enter your sex", "year_of_birth_placeholder": "Enter your year of birth", - "living_place_placeholder": "Enter your living place" + "living_place_placeholder": "Enter your living place", + "parent": "Parent" } diff --git a/src/blocks/RegisterAboutYou/locales/kk.json b/src/blocks/RegisterAboutYou/locales/kk.json index f30db60..72e73a6 100644 --- a/src/blocks/RegisterAboutYou/locales/kk.json +++ b/src/blocks/RegisterAboutYou/locales/kk.json @@ -18,5 +18,6 @@ "place_of_living_error": "Өтінеміз, тұрғылықты жеріңізді көрсетіңіз", "sex_placeholder": "Жынысыңызды енгізіңіз", "year_of_birth_placeholder": "Туған жылыңызды енгізіңіз", - "living_place_placeholder": "Тұрғылықты жеріңізді енгізіңіз" + "living_place_placeholder": "Тұрғылықты жеріңізді енгізіңіз", + "parent": "Ата-ана" } diff --git a/src/blocks/RegisterAboutYou/locales/pl.json b/src/blocks/RegisterAboutYou/locales/pl.json index 9dfc16f..56e7435 100644 --- a/src/blocks/RegisterAboutYou/locales/pl.json +++ b/src/blocks/RegisterAboutYou/locales/pl.json @@ -18,5 +18,6 @@ "place_of_living_error": "Podaj swoje miejsce zamieszkania", "sex_placeholder": "Wprowadź swoją płeć", "year_of_birth_placeholder": "Wprowadź swój rok urodzenia", - "living_place_placeholder": "Wprowadź swoje miejsce zamieszkania" + "living_place_placeholder": "Wprowadź swoje miejsce zamieszkania", + "parent": "Rodzic" } diff --git a/src/blocks/RegisterAboutYou/locales/ru.json b/src/blocks/RegisterAboutYou/locales/ru.json index faa4a4f..ba4ca1e 100644 --- a/src/blocks/RegisterAboutYou/locales/ru.json +++ b/src/blocks/RegisterAboutYou/locales/ru.json @@ -18,5 +18,6 @@ "place_of_living_error": "Пожалуйста, укажите свое место жительства", "sex_placeholder": "Введите свой пол", "year_of_birth_placeholder": "Введите свой год рождения", - "living_place_placeholder": "Введите место вашего жительства" + "living_place_placeholder": "Введите место вашего жительства", + "parent": "Родитель" } diff --git a/src/blocks/RegisterAboutYou/locales/uk.json b/src/blocks/RegisterAboutYou/locales/uk.json index c819681..09137c6 100644 --- a/src/blocks/RegisterAboutYou/locales/uk.json +++ b/src/blocks/RegisterAboutYou/locales/uk.json @@ -18,5 +18,6 @@ "place_of_living_error": "Будь ласка, вкажіть місце проживання", "sex_placeholder": "Введіть стать", "year_of_birth_placeholder": "Введіть рік народження", - "living_place_placeholder": "Введіть місце проживання" + "living_place_placeholder": "Введіть місце проживання", + "parent": "Батько" } diff --git a/src/blocks/RegisterAnonymous/RegisterAnonymous.jsx b/src/blocks/RegisterAnonymous/RegisterAnonymous.jsx index 3c1c8b8..8e86283 100644 --- a/src/blocks/RegisterAnonymous/RegisterAnonymous.jsx +++ b/src/blocks/RegisterAnonymous/RegisterAnonymous.jsx @@ -1,6 +1,6 @@ import React, { useState } from "react"; import { useNavigate, Link } from "react-router-dom"; -import { useMutation, useQuery } from "@tanstack/react-query"; +import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { useTranslation } from "react-i18next"; import { toast } from "react-toastify"; import Joi from "joi"; @@ -36,6 +36,9 @@ import "./register-anonymous.scss"; export const RegisterAnonymous = () => { const navigate = useNavigate(); const { t } = useTranslation("register-anonymous"); + const queryClient = useQueryClient(); + + const countriesData = queryClient.getQueryData(["countries"]); const schema = Joi.object({ password: Joi.string() @@ -46,20 +49,24 @@ export const RegisterAnonymous = () => { .label(t("password_match_error")), nickname: Joi.string().label(t("nickname_error")), isPrivacyAndTermsSelected: Joi.boolean().invalid(false), - isAgeTermsSelected: Joi.boolean().invalid(false), + // isAgeTermsSelected: Joi.boolean().invalid(false), }); const [data, setData] = useState({ password: "", nickname: "", isPrivacyAndTermsSelected: false, - isAgeTermsSelected: false, + // isAgeTermsSelected: false, confirmPassword: "", }); const [errors, setErrors] = useState({}); const [isConfirmationModalOpen, setIsConfirmationModalOpen] = useState(false); const [hasCopied, setHasCopied] = useState(false); + const country = localStorage.getItem("country"); + const selectedCountry = countriesData?.find((c) => c.value === country); + const minAge = selectedCountry?.minAge; + // On page load send a request to the server // to generate a user acces token const fetchUserAccessToken = async () => { @@ -163,7 +170,7 @@ export const RegisterAnonymous = () => { data.password && data.confirmPassword && data.isPrivacyAndTermsSelected && - data.isAgeTermsSelected && + // data.isAgeTermsSelected && data.nickname; const handleRegisterButtonClick = () => { @@ -259,7 +266,7 @@ export const RegisterAnonymous = () => { handleChange("isAgeTermsSelected", val)} - textOne={t("age_terms_agreement_text_1")} + textOne={t("age_terms_agreement_text_1", { age: minAge })} />