Unverified Commit e501d507 authored by yannickjacqueline's avatar yannickjacqueline Committed by GitHub
Browse files

feat(epds): modification textes modale Être contacté (#699)

parent bce73e0f
......@@ -111,11 +111,14 @@ export default {
button: "Être contacté(e)",
invalidEmail: "L'email n'est pas valide",
invalidPhoneNumber: "Le tél. n'est pas valide",
mailsCanBeReceivedInSpams:
"Les retours peuvent se glisser dans vos spams ou mails indésirables, merci de les vérifier.",
numberOfChildren: "Nombre d'enfants",
title: "Être contacté(e)",
yourEmail: "Votre email",
yourFirstname: "Votre prénom",
yourPhoneNumber: "Votre n° de tél.",
yourPhoneNumber: "Votre n° de tél. \nportable",
yourPhoneNumberPlaceholder: "Votre n° de tél. portable",
},
description:
"Vous venez d'avoir un bébé et nous aimerions savoir comment vous vous sentez.",
......
......@@ -20,6 +20,7 @@ import {
Datepicker,
Icomoon,
IcomoonIcons,
SecondaryText,
TitleH1,
} from "../../components";
import {
......@@ -96,9 +97,13 @@ const BeContacted: React.FC<Props> = ({ visible, hideModal }) => {
PersonalInformationType.phoneNumber,
Labels.epdsSurvey.beContacted.yourPhoneNumber
);
const isEmail = informationType === PersonalInformationType.email;
return {
isEmptyVariable: getIsEmptyValue(informationType),
label: labelMap.get(informationType),
subLabel: isEmail
? Labels.epdsSurvey.beContacted.mailsCanBeReceivedInSpams
: undefined,
};
};
......@@ -143,43 +148,50 @@ const BeContacted: React.FC<Props> = ({ visible, hideModal }) => {
informationType: PersonalInformationType,
isMandatory: boolean
) => {
const { label, isEmptyVariable } =
const isPhoneNumber =
informationType === PersonalInformationType.phoneNumber;
const { label, isEmptyVariable, subLabel } =
getLabelAndIsEmptyVariable(informationType);
return (
<View style={styles.rowView}>
<CommonText style={styles.textStyle}>
{isMandatory ? `${label} *` : label}
</CommonText>
<View>
<View style={styles.rowView}>
<CommonText style={styles.textStyle}>
{isMandatory ? `${label} *` : label}
</CommonText>
<View>
<TextInput
keyboardType={
informationType === PersonalInformationType.phoneNumber
? "phone-pad"
: "default"
}
style={styles.textInput}
onChangeText={(text: string) => {
onChangeText(informationType, text);
}}
placeholder={label}
/>
{isMandatory && isEmptyVariable && (
<HelperText type="error">{Labels.mandatoryField}</HelperText>
)}
{informationType === PersonalInformationType.email &&
!emailIsValid && (
<HelperText type="error">
{Labels.epdsSurvey.beContacted.invalidEmail}
</HelperText>
)}
{informationType === PersonalInformationType.phoneNumber &&
!phoneNumberIsValid && (
<HelperText type="error">
{Labels.epdsSurvey.beContacted.invalidPhoneNumber}
</HelperText>
<View>
<TextInput
keyboardType={isPhoneNumber ? "phone-pad" : "default"}
style={styles.textInput}
onChangeText={(text: string) => {
onChangeText(informationType, text);
}}
placeholder={
isPhoneNumber
? Labels.epdsSurvey.beContacted.yourPhoneNumberPlaceholder
: label
}
/>
{isMandatory && isEmptyVariable && (
<HelperText type="error">{Labels.mandatoryField}</HelperText>
)}
{informationType === PersonalInformationType.email &&
!emailIsValid && (
<HelperText type="error">
{Labels.epdsSurvey.beContacted.invalidEmail}
</HelperText>
)}
{informationType === PersonalInformationType.phoneNumber &&
!phoneNumberIsValid && (
<HelperText type="error">
{Labels.epdsSurvey.beContacted.invalidPhoneNumber}
</HelperText>
)}
</View>
</View>
<SecondaryText style={styles.secondaryTextStyle}>
{subLabel}
</SecondaryText>
</View>
);
};
......@@ -390,6 +402,10 @@ const styles = StyleSheet.create({
justifyContent: "space-between",
marginVertical: Margins.default,
},
secondaryTextStyle: {
color: Colors.primaryBlue,
marginRight: Margins.default,
},
textInput: {
borderBottomColor: Colors.primaryBlue,
borderBottomWidth: 1,
......
......@@ -33,7 +33,7 @@ const EpdsSurveyContent: React.FC<Props> = ({ epdsSurvey }) => {
const swiperRef = useRef<SwiperFlatList>(null);
const [questionsAndAnswers, setQuestionsAndAnswers] =
useState<EpdsQuestionAndAnswers[]>(epdsSurvey);
const [showResult, setShowResult] = useState(false);
const [showResult, setShowResult] = useState(true);
const [score, setScore] = useState(0);
const [surveyCanBeStarted, setSurveyCanBeStarted] = useState(false);
const [lastQuestionHas3PointAnswer, setLastQuestionHas3PointAnswer] =
......@@ -151,10 +151,7 @@ const EpdsSurveyContent: React.FC<Props> = ({ epdsSurvey }) => {
<EpdsLightResult
result={score}
epdsSurvey={questionsAndAnswers}
showBeContactedButton={
score >= EpdsConstants.RESULT_BECONTACTED_VALUE ||
lastQuestionHas3PointAnswer
}
showBeContactedButton={true}
startSurveyOver={async () => {
await restartSurvey();
}}
......
......@@ -69,6 +69,7 @@ export interface EpdsUpdatedSurvey {
export interface BeContactedData {
label: string | undefined;
subLabel: string | undefined;
isEmptyVariable: boolean | undefined;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment