diff --git a/.eslintrc.json b/.eslintrc.json index ec8860dce..48d51245d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,6 +5,7 @@ "max-len": "off", // This is throwing error on App.tsx even with no code changes on CRA 5. "@typescript-eslint/no-empty-function": "off", - "cypress/unsafe-to-chain-command": "off" + "cypress/unsafe-to-chain-command": "off", + "linebreak-style": "off" } } diff --git a/src/app/newSettings/Sections/Account/Account/components/AccountDetailsModal.tsx b/src/app/newSettings/Sections/Account/Account/components/AccountDetailsModal.tsx index e563dfc8a..b4ab2beba 100644 --- a/src/app/newSettings/Sections/Account/Account/components/AccountDetailsModal.tsx +++ b/src/app/newSettings/Sections/Account/Account/components/AccountDetailsModal.tsx @@ -47,7 +47,8 @@ const AccountDetailsModal = ({ return value.length > 0 && value.length < 20; }; - const onSave = async () => { + const onSave = async (e: React.FormEvent) => { + e.preventDefault(); if (!validate(nameValue)) { setStatus({ tag: 'error', type: 'NAME_INVALID' }); } else if (!validate(lastnameValue)) { @@ -66,55 +67,57 @@ const AccountDetailsModal = ({ return ( -
-

- {translate('views.account.tabs.account.accountDetails.editProfile.title')} -

-
- - -
+
+
+

+ {translate('views.account.tabs.account.accountDetails.editProfile.title')} +

+
+ + +
-
- -
- +
+ +
+ +
-
-
- - +
+ + +
-
+ ); }; diff --git a/src/app/newSettings/Sections/Account/Security/components/ChangePasswordModal.tsx b/src/app/newSettings/Sections/Account/Security/components/ChangePasswordModal.tsx index fa877bdc6..5158c534c 100644 --- a/src/app/newSettings/Sections/Account/Security/components/ChangePasswordModal.tsx +++ b/src/app/newSettings/Sections/Account/Security/components/ChangePasswordModal.tsx @@ -34,7 +34,8 @@ const ChangePasswordModal = ({ const isConfirmationWrong = passwordPayload.password.slice(0, passwordConfirmation.length) !== passwordConfirmation; - async function handleSubmit() { + async function handleSubmit(e: React.FormEvent) { + e.preventDefault(); setIsLoading(true); await changePassword(passwordPayload.password, currentPassword, email); notificationsService.show({ text: translate('success.passwordChanged'), type: ToastType.Success }); @@ -53,41 +54,43 @@ const ChangePasswordModal = ({ return ( -

{translate('modals.changePasswordModal.title')}

- - -
- - -
+
+

{translate('modals.changePasswordModal.title')}

+ + +
+ + +
+
); }; diff --git a/src/app/newSettings/Sections/Account/Security/components/TwoFactorAuthenticationDisableModal.tsx b/src/app/newSettings/Sections/Account/Security/components/TwoFactorAuthenticationDisableModal.tsx index 7e3a7ce52..7b2a621e0 100644 --- a/src/app/newSettings/Sections/Account/Security/components/TwoFactorAuthenticationDisableModal.tsx +++ b/src/app/newSettings/Sections/Account/Security/components/TwoFactorAuthenticationDisableModal.tsx @@ -29,7 +29,8 @@ const TwoFactorAuthenticationDisableModal = ({ const [status, setStatus] = useState<'ready' | 'error' | 'loading'>('ready'); const [authCode, setAuthCode] = useState(''); - async function handleDisable() { + async function handleDisable(e: React.FormEvent) { + e.preventDefault(); setStatus('loading'); try { const { encryptedSalt } = await userHas2FAStored(); @@ -48,28 +49,32 @@ const TwoFactorAuthenticationDisableModal = ({ return ( -

{translate('views.account.tabs.security.2FA.titleDisable')}

- -
- - -
+
+

+ {translate('views.account.tabs.security.2FA.titleDisable')} +

+ +
+ + +
+
); }; diff --git a/src/app/newSettings/Sections/Account/Security/components/TwoFactorAuthenticationEnableModal.tsx b/src/app/newSettings/Sections/Account/Security/components/TwoFactorAuthenticationEnableModal.tsx index da711a013..dee8cb240 100644 --- a/src/app/newSettings/Sections/Account/Security/components/TwoFactorAuthenticationEnableModal.tsx +++ b/src/app/newSettings/Sections/Account/Security/components/TwoFactorAuthenticationEnableModal.tsx @@ -99,7 +99,8 @@ const TwoFactorAuthenticationEnableModal = ({ const [activateState, setActivateState] = useState<'ready' | 'error' | 'loading'>('ready'); const [activateValue, setActivateValue] = useState(''); - async function handleActivate() { + async function handleActivate(e: React.FormEvent) { + e.preventDefault(); if (qr) { try { setActivateState('loading'); @@ -134,37 +135,41 @@ const TwoFactorAuthenticationEnableModal = ({ return ( -

{translate('views.account.tabs.security.2FA.modal.title')}

-

-

- {translate('views.account.tabs.security.2FA.modal.stepsLabel', { - current: step + 1, - total: steps.length, - })} -

-

{steps[step]}

-

- {parts[step]} -
- -
- {step !== steps.length - 1 ? ( - - ) : ( - - )} +
+

+ {translate('views.account.tabs.security.2FA.modal.title')} +

+

+

+ {translate('views.account.tabs.security.2FA.modal.stepsLabel', { + current: step + 1, + total: steps.length, + })} +

+

{steps[step]}

+

+ {parts[step]} +
+ +
+ {step !== steps.length - 1 ? ( + + ) : ( + + )} +
-
+ ); }; diff --git a/src/app/share/components/SharePasswordInputDialog/SharePasswordInputDialog.tsx b/src/app/share/components/SharePasswordInputDialog/SharePasswordInputDialog.tsx index 7d5c31de8..4afe23fa1 100644 --- a/src/app/share/components/SharePasswordInputDialog/SharePasswordInputDialog.tsx +++ b/src/app/share/components/SharePasswordInputDialog/SharePasswordInputDialog.tsx @@ -1,7 +1,6 @@ import Button from 'app/shared/components/Button/Button'; import Modal from 'app/shared/components/Modal'; import { useState } from 'react'; -import { Spinner } from '@phosphor-icons/react'; import Input from 'app/shared/components/Input'; import { useTranslationContext } from 'app/i18n/provider/TranslationProvider'; import validationService from 'app/core/services/validation.service'; @@ -25,7 +24,8 @@ export const SharePasswordInputDialog = ({ const [isLoading, setIsLoading] = useState(false); const [password, setPassword] = useState(''); - const handleConfirm = async () => { + const handleConfirm = async (e: React.FormEvent) => { + e.preventDefault(); setIsLoading(true); await onSavePassword(password); setIsLoading(false); @@ -33,29 +33,31 @@ export const SharePasswordInputDialog = ({ return ( -

- {!isAlreadyProtected - ? translate('modals.shareModal.protectSharingModal.protect') - : translate('modals.shareModal.protectSharingModal.editPasswordTitle')} -

- { - if (value.length <= MAX_PASSWORD_LENGTH && validationService.validatePasswordInput(value)) { - setPassword(value); - } - }} - value={password} - variant="password" - autoComplete="off" - /> -
- - -
+
+

+ {!isAlreadyProtected + ? translate('modals.shareModal.protectSharingModal.protect') + : translate('modals.shareModal.protectSharingModal.editPasswordTitle')} +

+ { + if (value.length <= MAX_PASSWORD_LENGTH && validationService.validatePasswordInput(value)) { + setPassword(value); + } + }} + value={password} + variant="password" + autoComplete="off" + /> +
+ + +
+
); };