Skip to content

Commit

Permalink
fix: filter survey list and modify error message in forgotPasswordForm (
Browse files Browse the repository at this point in the history
  • Loading branch information
RenauxLeaInsee authored Nov 26, 2024
1 parent 9fff873 commit 9d4bc05
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
6 changes: 0 additions & 6 deletions src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ export function Footer({ className }: Readonly<{ className?: string }>) {
to: "/securite",
},
},
{
text: t("cookies"),
linkProps: {
to: "/",
},
},
headerFooterDisplayItem,
]}
partnersLogos={{
Expand Down
12 changes: 9 additions & 3 deletions src/components/SurveyList/SurveyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ import { Card } from "@codegouvfr/react-dsfr/Card";
export const SurveysList = () => {
const { t } = useTranslation("SurveyHomepage");

const surveys = content.specifique.map(survey => {
return { titleShort: survey.titleShort, id: survey.id };
});
const surveys = content.specifique
.map(survey => {
return {
titleShort: survey.titleShort,
id: survey.id,
disabledOnWelcomePage: survey.disabledOnWelcomePage,
};
})
.filter(survey => survey.disabledOnWelcomePage !== true);

return (
<div>
Expand Down
4 changes: 1 addition & 3 deletions src/components/forgotPassword/ForgotPasswordForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ export const ForgotPasswordForm = ({ surveyId, onSubmit, register, errors }: Pro
...(errors.idec && { "aria-invalid": true, "aria-errormessage": "idec-desc-error" }),
}}
state={errors.idec ? "error" : "default"}
stateRelatedMessage={
errors.idec?.message && supportFormTranslation(errors.idec?.message as keyof typeof t)
}
stateRelatedMessage={errors.idec?.message && t(errors.idec?.message as keyof typeof t)}
/>
{!errors.idec && <p className="fr-hidden" id={"idec-desc-error"} />}
<Button style={{ width: "100%" }} className="fr-grid-row fr-grid-row--center" type="submit">
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/resources/en.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ export const translations: Translations<"en"> = {
"sectionTitle": "Password Recovery",
"information":
"To obtain a new password, please enter your identifier that you received by email and/or mail.",
"idecHintText": "Expected format: uppercase letters and numbers",
"idecHintText":
"Expected format: an identifier comprising 7 to 9 characters, upper-case letters and numbers.",
"submitButton": "Submit",
"forgotPasswordHelpTitle": "Password Recovery Help",
"contactSupport": "contact support.",
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/resources/fr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ export const translations: Translations<"fr"> = {
"sectionTitle": "Récupération du mot de passe",
"information":
"Pour obtenir un nouveau mot de passe, veuillez renseigner votre identifiant que vous avez reçu par mail et/ou par courrier.",
"idecHintText": "Format attendu : lettres et chiffres en majuscules",
"idecHintText":
"Format attendu : un identifiant comprenant 7 à 9 caractères, lettres et chiffres en majuscules",
"submitButton": "Envoyer",
"forgotPasswordHelpTitle": "Aide à la récupération du mot de passe",
"contactSupport": "contacter l'assistance.",
Expand Down
2 changes: 1 addition & 1 deletion src/types/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,5 @@ export const knownEmailForm = z.object({
});

export const forgotPasswordForm = z.object({
idec: z.string().min(7, { message: "messageSizeIdec" }).max(9, { message: "messageSizeIdec" }),
idec: z.string().min(7, { message: "idecHintText" }).max(9, { message: "idecHintText" }),
});

0 comments on commit 9d4bc05

Please sign in to comment.