From 5711a27ae540da59b9f44239d6f3fe67c0f8c963 Mon Sep 17 00:00:00 2001 From: Emma Mansell <73774046+7emansell@users.noreply.github.com> Date: Thu, 19 Dec 2024 08:41:57 -0800 Subject: [PATCH 1/2] Password form cleared as necessary --- src/components/MyAccount/Settings/PasswordForm.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/MyAccount/Settings/PasswordForm.tsx b/src/components/MyAccount/Settings/PasswordForm.tsx index eb5dc17d..dab180bd 100644 --- a/src/components/MyAccount/Settings/PasswordForm.tsx +++ b/src/components/MyAccount/Settings/PasswordForm.tsx @@ -81,12 +81,21 @@ const PasswordForm = ({ patronData, settingsState }: PasswordFormProps) => { const cancelEditing = () => { setIsEditing(false) + clearForm() setEditingField("") setTimeout(() => { editingRef.current?.focus() }, 0) } + const clearForm = () => { + setFormData({ + currentPassword: "", + newPassword: "", + confirmPassword: "", + passwordsMatch: true, + }) + } const validateForm = formData.currentPassword !== "" && formData.newPassword !== "" && @@ -146,6 +155,7 @@ const PasswordForm = ({ patronData, settingsState }: PasswordFormProps) => { console.error("Error submitting", error) } finally { setIsLoading(false) + clearForm() setEditingField("") } } From 10b2acd2a4ad4a8110f4988711130632634dfaa4 Mon Sep 17 00:00:00 2001 From: Emma Mansell <73774046+7emansell@users.noreply.github.com> Date: Thu, 19 Dec 2024 09:02:24 -0800 Subject: [PATCH 2/2] Extending banner --- .../MyAccount/Settings/SettingsSelectForm.tsx | 88 ++++++++++--------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/src/components/MyAccount/Settings/SettingsSelectForm.tsx b/src/components/MyAccount/Settings/SettingsSelectForm.tsx index e8283b52..cf90e6b6 100644 --- a/src/components/MyAccount/Settings/SettingsSelectForm.tsx +++ b/src/components/MyAccount/Settings/SettingsSelectForm.tsx @@ -190,50 +190,52 @@ const SettingsSelectForm = ({ ) : ( - - - - {selection} - - {isNotification && - patronHasNonePref && - !patronHasPhone && - !patronHasEmail && ( - - )} + + + + + {selection} + + + {editingField === "" && ( + { + setIsEditing(true) + setEditingField(type) + setTimeout(() => { + selectRef.current?.focus() + }, 0) + }} + /> + )} - {editingField === "" && ( - { - setIsEditing(true) - setEditingField(type) - setTimeout(() => { - selectRef.current?.focus() - }, 0) - }} - /> - )} + {isNotification && + patronHasNonePref && + !patronHasPhone && + !patronHasEmail && ( + + )} )} {isEditing && (