Skip to content

Commit

Permalink
Merge branch 'staging' of github.com:UNICEFECAR/USupport-client-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilen-7DIGIT committed Nov 28, 2024
2 parents 22cd620 + 4e61475 commit ce7f404
Show file tree
Hide file tree
Showing 31 changed files with 78 additions and 43 deletions.
2 changes: 1 addition & 1 deletion USupport-components-library
2 changes: 1 addition & 1 deletion src/backdrops/ConfirmConsultation/locales/kk.json
Original file line number Diff line number Diff line change
@@ -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": "наурыз",
Expand Down
12 changes: 9 additions & 3 deletions src/blocks/RegisterAboutYou/RegisterAboutYou.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
});

Expand Down Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -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")}
Expand Down
3 changes: 2 additions & 1 deletion src/blocks/RegisterAboutYou/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
3 changes: 2 additions & 1 deletion src/blocks/RegisterAboutYou/locales/kk.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"place_of_living_error": "Өтінеміз, тұрғылықты жеріңізді көрсетіңіз",
"sex_placeholder": "Жынысыңызды енгізіңіз",
"year_of_birth_placeholder": "Туған жылыңызды енгізіңіз",
"living_place_placeholder": "Тұрғылықты жеріңізді енгізіңіз"
"living_place_placeholder": "Тұрғылықты жеріңізді енгізіңіз",
"parent": "Ата-ана"
}
3 changes: 2 additions & 1 deletion src/blocks/RegisterAboutYou/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
3 changes: 2 additions & 1 deletion src/blocks/RegisterAboutYou/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"place_of_living_error": "Пожалуйста, укажите свое место жительства",
"sex_placeholder": "Введите свой пол",
"year_of_birth_placeholder": "Введите свой год рождения",
"living_place_placeholder": "Введите место вашего жительства"
"living_place_placeholder": "Введите место вашего жительства",
"parent": "Родитель"
}
3 changes: 2 additions & 1 deletion src/blocks/RegisterAboutYou/locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"place_of_living_error": "Будь ласка, вкажіть місце проживання",
"sex_placeholder": "Введіть стать",
"year_of_birth_placeholder": "Введіть рік народження",
"living_place_placeholder": "Введіть місце проживання"
"living_place_placeholder": "Введіть місце проживання",
"parent": "Батько"
}
17 changes: 12 additions & 5 deletions src/blocks/RegisterAnonymous/RegisterAnonymous.jsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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()
Expand All @@ -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 () => {
Expand Down Expand Up @@ -163,7 +170,7 @@ export const RegisterAnonymous = () => {
data.password &&
data.confirmPassword &&
data.isPrivacyAndTermsSelected &&
data.isAgeTermsSelected &&
// data.isAgeTermsSelected &&
data.nickname;

const handleRegisterButtonClick = () => {
Expand Down Expand Up @@ -259,7 +266,7 @@ export const RegisterAnonymous = () => {
<TermsAgreement
isChecked={data.isAgeTermsSelected}
setIsChecked={(val) => handleChange("isAgeTermsSelected", val)}
textOne={t("age_terms_agreement_text_1")}
textOne={t("age_terms_agreement_text_1", { age: minAge })}
/>
<Button
label={t("register_button_label")}
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/RegisterAnonymous/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"copy_success": "Code copied successfully",
"confirm_password_label": "Confirm password",
"password_match_error": "The Password and Confirm Password fields do not match",
"age_terms_agreement_text_1": "I am over 13 years old"
"age_terms_agreement_text_1": "I am over {{age}} years old"
}
2 changes: 1 addition & 1 deletion src/blocks/RegisterAnonymous/locales/kk.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"copy_success": "Сәтті көшірілген код",
"confirm_password_label": "Құпия сөзді растаңыз",
"password_match_error": "Құпия сөз және Құпия сөзді растау өрістері сәйкес келмейді",
"age_terms_agreement_text_1": "Менің жасым 13-тен үлкен"
"age_terms_agreement_text_1": "Менің жасым 10-нан үлкен"
}
2 changes: 1 addition & 1 deletion src/blocks/RegisterAnonymous/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"copy_success": "Kod został pomyślnie skopiowany",
"confirm_password_label": "Potwierdź hasło",
"password_match_error": "Pola Hasło i Potwierdź hasło nie są zgodne",
"age_terms_agreement_text_1": "Mam ponad 13 lat"
"age_terms_agreement_text_1": "Mam ponad {{age}} lat"
}
2 changes: 1 addition & 1 deletion src/blocks/RegisterAnonymous/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"copy_success": "Успешно скопированный код",
"confirm_password_label": "Подтвердите пароль",
"password_match_error": "Поля Пароль и Подтвердите пароль не совпадают",
"age_terms_agreement_text_1": "Мне больше 13 лет"
"age_terms_agreement_text_1": "Мне больше {{age}} лет"
}
2 changes: 1 addition & 1 deletion src/blocks/RegisterAnonymous/locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"copy_success": "Код скопійовано",
"confirm_password_label": "Підтвердити пароль",
"password_match_error": "Поля «Пароль» і «Підтвердити пароль» не збігаються",
"age_terms_agreement_text_1": "Мені більше 13 років"
"age_terms_agreement_text_1": "Мені більше {{age}} років"
}
13 changes: 10 additions & 3 deletions src/blocks/RegisterEmail/RegisterEmail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { useNavigate, Link } from "react-router-dom";
import ReCAPTCHA from "react-google-recaptcha";
import { useQueryClient } from "@tanstack/react-query";

import Joi from "joi";

Expand Down Expand Up @@ -40,6 +41,8 @@ export const RegisterEmail = ({
}) => {
const { t } = useTranslation("register-email");
const navigate = useNavigate();
const queryClient = useQueryClient();
const countriesData = queryClient.getQueryData(["countries"]);

const schema = Joi.object({
password: Joi.string()
Expand All @@ -53,11 +56,15 @@ export const RegisterEmail = ({
.label(t("email_error")),
nickname: Joi.string().label(t("nickname_error")),
isPrivacyAndTermsSelected: Joi.boolean(),
isAgeTermsSelected: Joi.boolean(),
// isAgeTermsSelected: Joi.boolean(),
});

const [errors, setErrors] = useState({});

const country = localStorage.getItem("country");
const selectedCountry = countriesData?.find((c) => c.value === country);
const minAge = selectedCountry?.minAge;

const handleChange = (field, value) => {
if (
field === "confirmPassword" &&
Expand Down Expand Up @@ -109,7 +116,7 @@ export const RegisterEmail = ({
data.password &&
data.confirmPassword &&
data.isPrivacyAndTermsSelected &&
data.isAgeTermsSelected &&
// data.isAgeTermsSelected &&
data.email &&
data.nickname &&
isCaptchaValid;
Expand Down Expand Up @@ -166,7 +173,7 @@ export const RegisterEmail = ({
<TermsAgreement
isChecked={data.isAgeTermsSelected}
setIsChecked={(val) => handleChange("isAgeTermsSelected", val)}
textOne={t("age_terms_agreement_text_1")}
textOne={t("age_terms_agreement_text_1", { age: minAge })}
/>
{showCaptcha && (
<ReCAPTCHA
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/RegisterEmail/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"login_button_label": "I already have an account",
"confirm_password_label": "Confirm password",
"password_match_error": "The Password and Confirm Password fields do not match",
"age_terms_agreement_text_1": "I am over 13 years old"
"age_terms_agreement_text_1": "I am over {{age}} years old"
}
2 changes: 1 addition & 1 deletion src/blocks/RegisterEmail/locales/kk.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"login_button_label": "Менің аккаунтым бар",
"confirm_password_label": "Құпия сөзді растаңыз",
"password_match_error": "Құпия сөз және Құпия сөзді растау өрістері сәйкес келмейді",
"age_terms_agreement_text_1": "Менің жасым 13-тен үлкен"
"age_terms_agreement_text_1": "Менің жасым 10-нан үлкен"
}
2 changes: 1 addition & 1 deletion src/blocks/RegisterEmail/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"login_button_label": "Już posiadam konto",
"confirm_password_label": "Potwierdź hasło",
"password_match_error": "Pola Hasło i Potwierdź hasło nie są zgodne",
"age_terms_agreement_text_1": "Mam ponad 13 lat"
"age_terms_agreement_text_1": "Mam ponad {{age}} lat"
}
2 changes: 1 addition & 1 deletion src/blocks/RegisterEmail/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"login_button_label": "У меня уже есть аккаунт",
"confirm_password_label": "Подтвердите пароль",
"password_match_error": "Поля Пароль и Подтвердите пароль не совпадают",
"age_terms_agreement_text_1": "Мне больше 13 лет"
"age_terms_agreement_text_1": "Мне больше {{age}} лет"
}
2 changes: 1 addition & 1 deletion src/blocks/RegisterEmail/locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"login_button_label": "Вже маю обліковий запис",
"confirm_password_label": "Підтвердити пароль",
"password_match_error": "Поля «Пароль» і «Підтвердити пароль» не збігаються",
"age_terms_agreement_text_1": "Мені більше 13 років"
"age_terms_agreement_text_1": "Мені більше {{age}} років"
}
6 changes: 5 additions & 1 deletion src/blocks/UserDetails/UserDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,12 @@ export const UserDetails = ({
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]);

Expand Down
3 changes: 2 additions & 1 deletion src/blocks/UserDetails/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
"success_message": "Profile updated successfully",
"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"
}
3 changes: 2 additions & 1 deletion src/blocks/UserDetails/locales/kk.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
"success_message": "Парақша сәтті жаңартылды",
"sex_placeholder": "Жынысыңызды енгізіңіз",
"year_of_birth_placeholder": "Туған жылыңызды енгізіңіз",
"living_place_placeholder": "Тұрғылықты жеріңізді енгізіңіз"
"living_place_placeholder": "Тұрғылықты жеріңізді енгізіңіз",
"parent": "Ата-ана"
}
3 changes: 2 additions & 1 deletion src/blocks/UserDetails/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
"success_message": "Profil został pomyślnie zaktualizowany",
"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"
}
3 changes: 2 additions & 1 deletion src/blocks/UserDetails/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
"success_message": "Профиль успешно обновлен",
"sex_placeholder": "Введите свой пол",
"year_of_birth_placeholder": "Введите свой год рождения",
"living_place_placeholder": "Введите место вашего жительства"
"living_place_placeholder": "Введите место вашего жительства",
"parent": "Родитель"
}
3 changes: 2 additions & 1 deletion src/blocks/UserDetails/locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
"success_message": "Профіль оновлено",
"sex_placeholder": "Введіть стать",
"year_of_birth_placeholder": "Введіть рік народження",
"living_place_placeholder": "Введіть місце проживання"
"living_place_placeholder": "Введіть місце проживання",
"parent": "Батько"
}
4 changes: 2 additions & 2 deletions src/blocks/VideoRoom/video-room.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
// width: calc(100vw - 50rem);
width: 100%;
border-radius: 2.5rem;
// max-height: 80vh;
max-height: calc(100vh - 15rem);
max-height: 95vh;
// max-height: calc(100vh - 15rem);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/pages/ArticleInformation/ArticleInformation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export const ArticleInformation = () => {
articleIdToFetch,
i18n.language
);

const finalData = destructureArticleData(data);
return finalData;
};
Expand All @@ -60,6 +59,7 @@ export const ArticleInformation = () => {
excludeId: articleData.id,
populate: true,
ids: articleIdsQuerry.data,
ageGroupId: articleData.ageGroupId,
});

if (data.length === 0) {
Expand All @@ -71,6 +71,7 @@ export const ArticleInformation = () => {
excludeId: articleData.id,
populate: true,
ids: articleIdsQuerry.data,
ageGroupId: articleData.ageGroupId,
});
return newest.data;
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Consultation/Consultation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ export const Consultation = () => {
/>
) : (
<Page
showNavbar={width < 768 ? false : true}
showFooter={width < 768 ? false : true}
showNavbar={false}
showFooter={false}
showEmergencyButton={false}
classes="page__consultation"
showGoBackArrow={false}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Consultation/consultation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
max-height: 100vh;

@media screen and (min-width: $screen-md) {
padding-top: 9.6rem;
padding-top: 1.4rem;
}

&__container {
Expand Down Expand Up @@ -40,7 +40,7 @@

@media screen and (min-width: 1024px) {
padding-bottom: 0;
height: 70vh;
height: 82vh;
overflow-y: auto;
}

Expand All @@ -50,7 +50,7 @@

&--show-options {
@media screen and (min-width: 1024px) {
height: calc(70vh - 15rem) !important;
height: calc(82vh - 15rem) !important;
margin-top: 20rem;
}
}
Expand Down
Loading

0 comments on commit ce7f404

Please sign in to comment.