Convert StorageEvictedDialog to TS
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
161937ac92
commit
1f670e225c
1 changed files with 13 additions and 16 deletions
|
@ -15,40 +15,37 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import * as sdk from '../../../index';
|
|
||||||
import SdkConfig from '../../../SdkConfig';
|
import SdkConfig from '../../../SdkConfig';
|
||||||
import Modal from '../../../Modal';
|
import Modal from '../../../Modal';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
|
import BaseDialog from "./BaseDialog";
|
||||||
|
import DialogButtons from "../elements/DialogButtons";
|
||||||
|
import BugReportDialog from "./BugReportDialog";
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
onFinished: (confirmed: boolean) => void;
|
||||||
|
}
|
||||||
|
|
||||||
@replaceableComponent("views.dialogs.StorageEvictedDialog")
|
@replaceableComponent("views.dialogs.StorageEvictedDialog")
|
||||||
export default class StorageEvictedDialog extends React.Component {
|
export default class StorageEvictedDialog extends React.Component<IProps> {
|
||||||
static propTypes = {
|
private sendBugReport = (ev: React.MouseEvent): void => {
|
||||||
onFinished: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
_sendBugReport = ev => {
|
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
const BugReportDialog = sdk.getComponent("dialogs.BugReportDialog");
|
|
||||||
Modal.createTrackedDialog('Storage evicted', 'Send Bug Report Dialog', BugReportDialog, {});
|
Modal.createTrackedDialog('Storage evicted', 'Send Bug Report Dialog', BugReportDialog, {});
|
||||||
};
|
};
|
||||||
|
|
||||||
_onSignOutClick = () => {
|
private onSignOutClick = (): void => {
|
||||||
this.props.onFinished(true);
|
this.props.onFinished(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
public render(): JSX.Element {
|
||||||
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
|
||||||
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
|
||||||
|
|
||||||
let logRequest;
|
let logRequest;
|
||||||
if (SdkConfig.get().bug_report_endpoint_url) {
|
if (SdkConfig.get().bug_report_endpoint_url) {
|
||||||
logRequest = _t(
|
logRequest = _t(
|
||||||
"To help us prevent this in future, please <a>send us logs</a>.",
|
"To help us prevent this in future, please <a>send us logs</a>.",
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
a: text => <a href="#" onClick={this._sendBugReport}>{ text }</a>,
|
a: text => <a href="#" onClick={this.sendBugReport}>{ text }</a>,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +70,7 @@ export default class StorageEvictedDialog extends React.Component {
|
||||||
) } { logRequest }</p>
|
) } { logRequest }</p>
|
||||||
</div>
|
</div>
|
||||||
<DialogButtons primaryButton={_t("Sign out")}
|
<DialogButtons primaryButton={_t("Sign out")}
|
||||||
onPrimaryButtonClick={this._onSignOutClick}
|
onPrimaryButtonClick={this.onSignOutClick}
|
||||||
focus={true}
|
focus={true}
|
||||||
hasCancel={false}
|
hasCancel={false}
|
||||||
/>
|
/>
|
Loading…
Reference in a new issue