diff --git a/src/components/views/dialogs/SessionRestoreErrorDialog.js b/src/components/views/dialogs/SessionRestoreErrorDialog.tsx similarity index 80% rename from src/components/views/dialogs/SessionRestoreErrorDialog.js rename to src/components/views/dialogs/SessionRestoreErrorDialog.tsx index eeeadbbfe5..752b023f0b 100644 --- a/src/components/views/dialogs/SessionRestoreErrorDialog.js +++ b/src/components/views/dialogs/SessionRestoreErrorDialog.tsx @@ -17,27 +17,27 @@ limitations under the License. */ import React from 'react'; -import PropTypes from 'prop-types'; -import * as sdk from '../../../index'; import SdkConfig from '../../../SdkConfig'; import Modal from '../../../Modal'; import { _t } from '../../../languageHandler'; import { replaceableComponent } from "../../../utils/replaceableComponent"; +import QuestionDialog from "./QuestionDialog"; +import BugReportDialog from "./BugReportDialog"; +import BaseDialog from "./BaseDialog"; +import DialogButtons from "../elements/DialogButtons"; + +interface IProps { + error: string; + onFinished: () => void; +} @replaceableComponent("views.dialogs.SessionRestoreErrorDialog") -export default class SessionRestoreErrorDialog extends React.Component { - static propTypes = { - error: PropTypes.string.isRequired, - onFinished: PropTypes.func.isRequired, - }; - - _sendBugReport = () => { - const BugReportDialog = sdk.getComponent("dialogs.BugReportDialog"); +export default class SessionRestoreErrorDialog extends React.Component { + private sendBugReport = (): void => { Modal.createTrackedDialog('Session Restore Error', 'Send Bug Report Dialog', BugReportDialog, {}); }; - _onClearStorageClick = () => { - const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); + private onClearStorageClick = (): void => { Modal.createTrackedDialog('Session Restore Confirm Logout', '', QuestionDialog, { title: _t("Sign out"), description: @@ -48,19 +48,17 @@ export default class SessionRestoreErrorDialog extends React.Component { }); }; - _onRefreshClick = () => { + private onRefreshClick = (): void => { // Is this likely to help? Probably not, but giving only one button // that clears your storage seems awful. - window.location.reload(true); + window.location.reload(); }; - render() { + public render(): JSX.Element { const brand = SdkConfig.get().brand; - const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); - const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); const clearStorageButton = ( - ); @@ -68,7 +66,7 @@ export default class SessionRestoreErrorDialog extends React.Component { let dialogButtons; if (SdkConfig.get().bug_report_endpoint_url) { dialogButtons = @@ -76,7 +74,7 @@ export default class SessionRestoreErrorDialog extends React.Component { ; } else { dialogButtons =