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"; import { ModalProps } from "../types"; const Code = styled.code` user-select: all; `; /** * TOTP enable modal */ export default function MFAEnableTOTP({ identifier, secret, callback, onClose, }: ModalProps<"mfa_enable_totp">) { const uri = `otpauth://totp/Revolt:${identifier}?secret=${secret}&issuer=Revolt`; const [value, setValue] = useState(""); return ( } description={} actions={[ { palette: "primary", children: , onClick: () => { callback(value.trim().replace(/\s/g, "")); return true; }, confirmation: true, }, { palette: "plain", children: , onClick: () => { callback(); return true; }, }, ]} onClose={() => { callback(); onClose(); }}> {secret} setValue(e.currentTarget.value)} /> ); }