diff --git a/web/settings/account-settings.react.js b/web/settings/account-settings.react.js --- a/web/settings/account-settings.react.js +++ b/web/settings/account-settings.react.js @@ -31,7 +31,6 @@ import css from './account-settings.css'; import AppearanceChangeModal from './appearance-change-modal.react.js'; -import BackupTestRestoreModal from './backup-test-restore-modal.react.js'; import DebugLogsModal from './debug-logs-modal.react.js'; import BlockListModal from './relationship/block-list-modal.react.js'; import FriendListModal from './relationship/friend-list-modal.react.js'; @@ -146,11 +145,6 @@ } }, [identityContext, sendMessageToDevice]); - const openBackupTestRestoreModal = React.useCallback( - () => pushModal(), - [popModal, pushModal], - ); - const processAndSendDMOperation = useProcessAndSendDMOperation(); const onCreateDMThread = React.useCallback(async () => { invariant(userID, 'userID should be set'); @@ -240,24 +234,6 @@ ); } - let backup; - if (staffCanSee) { - backup = ( -
-

Backup menu

-
-
    -
  • - Test backup restore - -
  • -
-
-
- ); - } let deviceData; if (staffCanSee) { deviceData = ( @@ -351,7 +327,6 @@ {preferences} {tunnelbroker} - {backup} {deviceData} {dms} {debugLogs} diff --git a/web/settings/backup-test-restore-modal.css b/web/settings/backup-test-restore-modal.css deleted file mode 100644 --- a/web/settings/backup-test-restore-modal.css +++ /dev/null @@ -1,25 +0,0 @@ -.modalBody { - padding: 24px 40px 32px; - color: var(--fg); -} - -.content { - display: flex; - flex-direction: column; - gap: 10px; -} - -.footer { - display: flex; - flex-direction: row-reverse; - justify-content: space-between; - padding-top: 8px; -} - -.modalError { - font-size: var(--xs-font-12); - color: var(--error); - font-style: italic; - padding-left: 6px; - align-self: center; -} diff --git a/web/settings/backup-test-restore-modal.react.js b/web/settings/backup-test-restore-modal.react.js deleted file mode 100644 --- a/web/settings/backup-test-restore-modal.react.js +++ /dev/null @@ -1,118 +0,0 @@ -// @flow - -import invariant from 'invariant'; -import * as React from 'react'; - -import { IdentityClientContext } from 'lib/shared/identity-client-context.js'; - -import css from './backup-test-restore-modal.css'; -import Button from '../components/button.react.js'; -import Input from '../modals/input.react.js'; -import Modal from '../modals/modal.react.js'; -import { getCommSharedWorker } from '../shared-worker/shared-worker-provider.js'; -import { workerRequestMessageTypes } from '../types/worker-types.js'; - -type Props = { - +onClose: () => void, -}; - -function BackupTestRestoreModal(props: Props): React.Node { - const { onClose } = props; - const [backupID, setBackupID] = React.useState(''); - const [backupDataKey, setBackupDataKey] = React.useState(''); - const [backupLogDataKey, setBackupLogDataKey] = React.useState(''); - const [inProgress, setInProgress] = React.useState(false); - const [errorMessage, setErrorMessage] = React.useState(''); - - const client = React.useContext(IdentityClientContext); - - const onSubmit = React.useCallback( - async (event: SyntheticEvent) => { - event.preventDefault(); - - setInProgress(true); - void (async () => { - try { - if (!client) { - throw new Error('No identity client'); - } - - const authMetadata = await client.getAuthMetadata(); - - const sharedWorker = await getCommSharedWorker(); - await sharedWorker.schedule({ - type: workerRequestMessageTypes.BACKUP_RESTORE, - authMetadata, - backupID, - backupDataKey, - backupLogDataKey, - }); - } catch (e) { - setErrorMessage(e.message); - } - setInProgress(false); - })(); - }, - [backupDataKey, backupID, backupLogDataKey, client], - ); - - let errorMsg; - if (errorMessage) { - errorMsg =
{errorMessage}
; - } - - return ( - -
-
- ) => { - const target = event.target; - invariant(target instanceof HTMLInputElement, 'target not input'); - setBackupID(target.value); - }} - disabled={inProgress} - label="Backup ID" - /> - ) => { - const target = event.target; - invariant(target instanceof HTMLInputElement, 'target not input'); - setBackupDataKey(target.value); - }} - disabled={inProgress} - label="Backup Data Encryption Key" - /> - ) => { - const target = event.target; - invariant(target instanceof HTMLInputElement, 'target not input'); - setBackupLogDataKey(target.value); - }} - disabled={inProgress} - label="Backup Logs Encryption Key" - /> -
-
- - {errorMsg} -
-
-
- ); -} - -export default BackupTestRestoreModal;