Skip to content

Commit

Permalink
alert scroll and toast
Browse files Browse the repository at this point in the history
  • Loading branch information
ddecrulle committed Jun 14, 2024
1 parent 554a277 commit 61cafa9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@inseefr/lunatic": "^3.0.9",
"@inseefr/lunatic-dsfr": "^2.0.10",
"@inseefr/lunatic-dsfr": "^2.0.12",
"@mui/material": "^5.15.20",
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-router": "^1.36.1",
Expand Down
9 changes: 6 additions & 3 deletions src/pages/Collect/CollectPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@ export function CollectPage() {
params.data &&
showToast({
severity: 'success',
title: 'Les données ont bien été sauvegardées',
description:
'Vos modifications ont été enregistrées et sauvegardées.',
title: 'Données sauvegardées avec succès !',
})
},

onError: () => {
showToast({
severity: 'error',
title:
"Il y a eu une erreur, les données n'ont pas été sauvegardées",
title: 'Erreur de sauvegarde',
description:
"Une erreur est survenue lors de l'enregistrement de vos modifications. ",
})
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export function scrollAndFocusToFirstError() {
const errorElement = document.querySelector<HTMLElement>(
'[aria-invalid="true"]'
'[aria-invalid="true"],[role="alert"]'
)

if (errorElement) {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -815,10 +815,10 @@
minimatch "^6.2.0"
validator "^13.11.0"

"@inseefr/lunatic-dsfr@^2.0.10":
version "2.0.10"
resolved "https://registry.yarnpkg.com/@inseefr/lunatic-dsfr/-/lunatic-dsfr-2.0.10.tgz#c787b0c8a8067bb09a16cbf5790fe2975b110672"
integrity sha512-lEUjBPOO3l+mjBwdmXm7leb/GSC4SNp6QXKGD0IENxhJVhEHHnJg/dSVOPVIersO+zc3JBunkjPCEbZCMFi3uA==
"@inseefr/lunatic-dsfr@^2.0.12":
version "2.0.12"
resolved "https://registry.yarnpkg.com/@inseefr/lunatic-dsfr/-/lunatic-dsfr-2.0.12.tgz#695018d32d201caf6e718d8ba08057aed50d79e5"
integrity sha512-WZcWSi6UYKAW0K0iXhpfNnglpD36LcCR1i0YVL13j/I5jWOgoHzuR4tdSdNGQ/M5/uT9m8eaPUqJjfuUlM1oqA==
dependencies:
react-number-format "^5.4.0"

Expand Down

0 comments on commit 61cafa9

Please sign in to comment.