From 7680931f5fd3d1efed9e0543b40f980fdedc1e5c Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sun, 12 Jun 2022 21:11:23 +0100 Subject: [PATCH] chore: i18n --- external/lang | 2 +- .../account/MultiFactorAuthentication.tsx | 34 +++++++++++++------ .../modals/components/MFAEnableTOTP.tsx | 15 ++++---- src/context/modals/components/MFAFlow.tsx | 34 +++++++++++++------ src/context/modals/components/MFARecovery.tsx | 13 +++---- 5 files changed, 63 insertions(+), 35 deletions(-) diff --git a/external/lang b/external/lang index c47a2eea..a38d0dc7 160000 --- a/external/lang +++ b/external/lang @@ -1 +1 @@ -Subproject commit c47a2eeaad9b6684d8a7c3fe577f0af05a04cc29 +Subproject commit a38d0dc72a39ea2b5a6f54c1c999f2021b899e50 diff --git a/src/components/settings/account/MultiFactorAuthentication.tsx b/src/components/settings/account/MultiFactorAuthentication.tsx index f10ca559..1b7bfbf8 100644 --- a/src/components/settings/account/MultiFactorAuthentication.tsx +++ b/src/components/settings/account/MultiFactorAuthentication.tsx @@ -173,15 +173,23 @@ export default function MultiFactorAuthentication() { } description={ - mfa?.recovery_active - ? "View and download your 2FA backup codes." - : "Get ready to use 2FA by setting up a recovery method." + } disabled={!mfa} onClick={recoveryAction}> - {mfa?.recovery_active - ? "View Backup Codes" - : "Generate Recovery Codes"} + - {mfa?.totp_mfa ? "Disable" : "Enable"} Authenticator App + {mfa && ( - {mfaActive - ? "Two-factor authentication is currently on!" - : "Two-factor authentication is currently off!"} + )} diff --git a/src/context/modals/components/MFAEnableTOTP.tsx b/src/context/modals/components/MFAEnableTOTP.tsx index 7fc4ee2c..68e5ca84 100644 --- a/src/context/modals/components/MFAEnableTOTP.tsx +++ b/src/context/modals/components/MFAEnableTOTP.tsx @@ -1,6 +1,7 @@ import { QRCodeSVG } from "qrcode.react"; import styled from "styled-components"; +import { Text } from "preact-i18n"; import { useState } from "preact/hooks"; import { Category, Centred, Column, InputBox, Modal } from "@revoltchat/ui"; @@ -25,14 +26,12 @@ export default function MFAEnableTOTP({ return ( } + description={} actions={[ { palette: "primary", - children: "Continue", + children: , onClick: () => { callback(value.trim().replace(/\s/g, "")); return true; @@ -41,7 +40,7 @@ export default function MFAEnableTOTP({ }, { palette: "plain", - children: "Cancel", + children: , onClick: () => { callback(); return true; @@ -65,7 +64,9 @@ export default function MFAEnableTOTP({ - Enter Code + + + ) { return ( } description={ - selectedMethod - ? "Please confirm using selected method." - : "Please select a method to authenticate your request." + } actions={ selectedMethod ? [ { palette: "primary", - children: "Confirm", + children: ( + + ), onClick: generateTicket, confirmation: true, }, { palette: "plain", - children: - methods!.length === 1 ? "Cancel" : "Back", + children: ( + + ), onClick: () => { if (methods!.length === 1) { props.callback(); return true; - } - setSelected(undefined); - + } + setSelected(undefined); }, }, ] : [ { palette: "plain", - children: "Cancel", + children: ( + + ), onClick: () => { props.callback(); return true; diff --git a/src/context/modals/components/MFARecovery.tsx b/src/context/modals/components/MFARecovery.tsx index de8e7f60..27cc37ca 100644 --- a/src/context/modals/components/MFARecovery.tsx +++ b/src/context/modals/components/MFARecovery.tsx @@ -1,5 +1,6 @@ import styled from "styled-components"; +import { Text } from "preact-i18n"; import { useCallback, useState } from "preact/hooks"; import { Modal } from "@revoltchat/ui"; @@ -49,29 +50,29 @@ export default function MFARecovery({ } return false; - }, []); + }, [client]); return ( } + description={} actions={[ { palette: "primary", - children: "Done", + children: , onClick: noopTrue, confirmation: true, }, { palette: "plain", - children: "Reset", + children: , onClick: reset, }, ]} onClose={onClose}> {known.map((code) => ( - {code} + {code} ))}