From 12fd0194ffc02662c672eca4e84de469a072c9a4 Mon Sep 17 00:00:00 2001 From: Rebeka Dekany <50901361+rebekadekany@users.noreply.github.com> Date: Wed, 19 Mar 2025 17:51:38 +0100 Subject: [PATCH] Cleanup Bootstrap 3 code in the Account settings page (#24058) * Remove the Bootstrap 5 version utilities * Remove Account settings LESS stylesheet and unused styles * Prefer using the OLFormText wrapper component instead of FormText * Remove the Bootstrap 3 version stories * Replace Font Awesome icons to Material icons * Fix the heading hierarchy * Cleanup unused translation * Restore ellipsis to the text of two loading spinners * Add loading button tests back and add some button loading labels --------- Co-authored-by: Tim Down <158919+timdown@users.noreply.github.com> GitOrigin-RevId: 283a9167c8c78bf0fe5062840ded6917dcd6263b --- .../affiliation/reconfirm-affiliation.tsx | 1 + .../components/account-info-section.tsx | 8 +- .../settings/components/emails-section.tsx | 10 +- .../components/emails/actions/remove.tsx | 4 +- .../settings/components/emails/add-email.tsx | 6 +- .../emails/add-email/country-input.tsx | 76 ++--- .../components/emails/add-email/layout.tsx | 5 - .../components/emails/confirm-email-form.tsx | 22 +- .../components/emails/downshift-input.tsx | 85 ++--- .../settings/components/emails/email.tsx | 4 +- .../settings/components/emails/header.tsx | 31 +- .../emails/institution-and-role.tsx | 5 - .../components/emails/reconfirmation-info.tsx | 182 +++-------- .../settings/components/emails/sso-alert.tsx | 23 -- .../settings/components/leave/modal.tsx | 8 +- .../settings/components/password-section.tsx | 3 - .../stories/settings/account-info.stories.jsx | 4 - .../settings/add-email-input.stories.tsx | 2 - .../stories/settings/beta-program.stories.jsx | 4 - .../stories/settings/emails.stories.jsx | 4 - .../stories/settings/leave.stories.jsx | 2 - .../settings/leavers-survey-alert.stories.tsx | 4 - .../stories/settings/linking.stories.jsx | 4 - .../stories/settings/newsletter.stories.jsx | 4 - .../stories/settings/page.stories.jsx | 4 - .../stories/settings/password.stories.jsx | 4 - .../stories/settings/sessions.stories.jsx | 4 - .../stories/settings/sso-alert.stories.tsx | 4 - .../stylesheets/app/account-settings.less | 305 ------------------ .../bootstrap-5/pages/account-settings.scss | 4 - .../web/frontend/stylesheets/main-style.less | 1 - .../components/notifications.test.tsx | 2 +- .../components/account-info-section.test.tsx | 2 +- .../emails-section-add-new-email.test.tsx | 18 +- ...ails-section-institution-and-role.test.tsx | 4 +- .../emails/reconfirmation-info.test.tsx | 2 +- 36 files changed, 116 insertions(+), 739 deletions(-) delete mode 100644 services/web/frontend/stylesheets/app/account-settings.less diff --git a/services/web/frontend/js/features/project-list/components/notifications/groups/affiliation/reconfirm-affiliation.tsx b/services/web/frontend/js/features/project-list/components/notifications/groups/affiliation/reconfirm-affiliation.tsx index 3416aefb04..56a27843be 100644 --- a/services/web/frontend/js/features/project-list/components/notifications/groups/affiliation/reconfirm-affiliation.tsx +++ b/services/web/frontend/js/features/project-list/components/notifications/groups/affiliation/reconfirm-affiliation.tsx @@ -87,6 +87,7 @@ function ReconfirmAffiliation({ className="btn-inline-link" disabled={isLoading} isLoading={isLoading} + loadingLabel={t('sending') + '…'} > {t('resend_confirmation_email')} diff --git a/services/web/frontend/js/features/settings/components/account-info-section.tsx b/services/web/frontend/js/features/settings/components/account-info-section.tsx index 3c42ce555d..4fd410d89f 100644 --- a/services/web/frontend/js/features/settings/components/account-info-section.tsx +++ b/services/web/frontend/js/features/settings/components/account-info-section.tsx @@ -12,7 +12,7 @@ import OLNotification from '@/features/ui/components/ol/ol-notification' import OLFormGroup from '@/features/ui/components/ol/ol-form-group' import OLFormLabel from '@/features/ui/components/ol/ol-form-label' import OLFormControl from '@/features/ui/components/ol/ol-form-control' -import FormText from '@/features/ui/components/bootstrap-5/form/form-text' +import OLFormText from '@/features/ui/components/ol/ol-form-text' function AccountInfoSection() { const { t } = useTranslation() @@ -127,9 +127,7 @@ function AccountInfoSection() { form="account-info-form" disabled={!isFormValid} isLoading={isLoading} - bs3Props={{ - loading: isLoading ? `${t('saving')}…` : t('update'), - }} + loadingLabel={t('saving') + '…'} > {t('update')} @@ -196,7 +194,7 @@ function ReadOrWriteFormGroup({ onInvalid={handleInvalid} /> {validationMessage && ( - {validationMessage} + {validationMessage} )} ) diff --git a/services/web/frontend/js/features/settings/components/emails-section.tsx b/services/web/frontend/js/features/settings/components/emails-section.tsx index 8c7e3ec6e9..a8bc54b017 100644 --- a/services/web/frontend/js/features/settings/components/emails-section.tsx +++ b/services/web/frontend/js/features/settings/components/emails-section.tsx @@ -8,8 +8,8 @@ import { import EmailsHeader from './emails/header' import EmailsRow from './emails/row' import AddEmail from './emails/add-email' -import Icon from '../../../shared/components/icon' import OLNotification from '@/features/ui/components/ol/ol-notification' +import OLSpinner from '@/features/ui/components/ol/ol-spinner' import { LeaversSurveyAlert } from './leavers-survey-alert' function EmailsSectionContent() { @@ -28,7 +28,7 @@ function EmailsSectionContent() { return ( <> -

{t('emails_and_affiliations_title')}

+

{t('emails_and_affiliations_title')}

{t('emails_and_affiliations_explanation')}

- {t('loading')}... + {t('loading')}...
) : ( @@ -68,10 +68,6 @@ function EmailsSectionContent() { , - className: 'text-center', - }} /> )} diff --git a/services/web/frontend/js/features/settings/components/emails/actions/remove.tsx b/services/web/frontend/js/features/settings/components/emails/actions/remove.tsx index 9ae7b4c993..136efc04e4 100644 --- a/services/web/frontend/js/features/settings/components/emails/actions/remove.tsx +++ b/services/web/frontend/js/features/settings/components/emails/actions/remove.tsx @@ -7,7 +7,6 @@ import OLTooltip from '@/features/ui/components/ol/ol-tooltip' import OLIconButton, { OLIconButtonProps, } from '@/features/ui/components/ol/ol-icon-button' -import { bsVersion } from '@/features/utils/bootstrap-5' import getMeta from '@/utils/meta' type DeleteButtonProps = Pick< @@ -26,8 +25,7 @@ function DeleteButton({ disabled, isLoading, onClick }: DeleteButtonProps) { size="sm" onClick={onClick} accessibilityLabel={t('remove') || ''} - icon={bsVersion({ bs5: 'delete', bs3: 'trash' })} - bs3Props={{ fw: true }} + icon="delete" /> ) } diff --git a/services/web/frontend/js/features/settings/components/emails/add-email.tsx b/services/web/frontend/js/features/settings/components/emails/add-email.tsx index a547255f45..876bbcffe8 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email.tsx @@ -18,7 +18,6 @@ import getMeta from '../../../../utils/meta' import { ReCaptcha2 } from '../../../../shared/components/recaptcha-2' import { useRecaptcha } from '../../../../shared/hooks/use-recaptcha' import OLCol from '@/features/ui/components/ol/ol-col' -import { bsVersion } from '@/features/utils/bootstrap-5' import { ConfirmEmailForm } from '@/features/settings/components/emails/confirm-email-form' function AddEmail() { @@ -153,10 +152,7 @@ function AddEmail() { const InputComponent = ( <> -