From ab2c76d4824a288f875608ea8f8dfb2a3996df2a Mon Sep 17 00:00:00 2001 From: James Elliott Date: Mon, 20 Mar 2023 06:21:31 +1100 Subject: [PATCH] web: fix layouts --- .../TOTPRegisterDialogController.tsx | 77 ++++++++++--------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/web/src/views/Settings/TwoFactorAuthentication/TOTPRegisterDialogController.tsx b/web/src/views/Settings/TwoFactorAuthentication/TOTPRegisterDialogController.tsx index 4244676a0..c56ff20bf 100644 --- a/web/src/views/Settings/TwoFactorAuthentication/TOTPRegisterDialogController.tsx +++ b/web/src/views/Settings/TwoFactorAuthentication/TOTPRegisterDialogController.tsx @@ -43,7 +43,7 @@ import { getTOTPOptions } from "@services/UserInfoTOTPConfiguration"; import { State } from "@views/LoginPortal/SecondFactor/OneTimePasswordMethod"; import OTPDial from "@views/LoginPortal/SecondFactor/OTPDial"; -const steps = ["Start", "Scan QR Code", "Confirmation"]; +const steps = ["Start", "Register", "Confirm"]; interface Props { open: boolean; @@ -216,16 +216,18 @@ export default function TOTPRegisterDialogController(props: Props) { const hidePeriods = advanced && optionPeriods.length <= 1; const qrcodeFuzzyStyle = totpIsLoading || hasErrored ? styles.fuzzy : undefined; - function SecretButton(text: string | undefined, action: string, icon: IconDefinition) { + function SecretButton(text: string, action: string, icon: IconDefinition) { + const handleOnClick = (event: React.MouseEvent) => { + (async () => { + event.preventDefault(); + + await navigator.clipboard.writeText(text); + createSuccessNotification(action); + })(); + }; + return ( - { - navigator.clipboard.writeText(`${text}`); - createSuccessNotification(`${action}`); - }} - size="large" - > + ); @@ -341,24 +343,10 @@ export default function TOTPRegisterDialogController(props: Props) { case 1: return ( - - - - {translate("Need Google Authenticator?")} - - - - - + {!hasErrored && totpIsLoading ? ( ) : null} @@ -395,14 +383,13 @@ export default function TOTPRegisterDialogController(props: Props) { ? SecretButton(totpSecretURL, translate("OTP URL copied to clipboard"), faCopy) : null} - + + + + + {translate("Need Google Authenticator?")} + + + + ); case 2: return ( - - - + + + + + ); } } @@ -451,7 +454,7 @@ export default function TOTPRegisterDialogController(props: Props) { - + {renderStep(activeStep)}