import styled from '@emotion/styled'; import Button from 'sentry/components/button'; import Clipboard from 'sentry/components/clipboard'; import Confirm from 'sentry/components/confirm'; import EmptyMessage from 'sentry/components/emptyMessage'; import { Panel, PanelAlert, PanelBody, PanelHeader, PanelItem, } from 'sentry/components/panels'; import {IconCopy, IconDownload, IconPrint} from 'sentry/icons'; import {t} from 'sentry/locale'; import space from 'sentry/styles/space'; type Props = { codes: string[]; isEnrolled: boolean; onRegenerateBackupCodes: () => void; className?: string; }; const RecoveryCodes = ({ className, isEnrolled, codes, onRegenerateBackupCodes, }: Props) => { const printCodes = () => { // eslint-disable-next-line dot-notation const iframe = window.frames['printable']; iframe.document.write(codes.join('')); iframe.print(); iframe.document.close(); }; if (!isEnrolled || !codes) { return null; } const formattedCodes = codes.join(' \n'); return ( {t('Unused Codes')} {t('Regenerate Codes')} {t( 'Make sure to save a copy of your recovery codes and store them in a safe place.' )} {!!codes.length && codes.map(code => {code})} {!codes.length && ( {t('You have no more recovery codes to use')} )} ); }; export default RecoveryCodes; const CodeContainer = styled(Panel)` margin-top: ${space(4)}; `; const Actions = styled('div')` display: grid; grid-auto-flow: column; gap: ${space(1)}; `; const Code = styled(PanelItem)` font-family: ${p => p.theme.text.familyMono}; padding: ${space(2)}; `;
{code}