Files
ThreadNet-Web/src/components/views/dialogs/CryptoStoreTooNewDialog.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
2.5 KiB
TypeScript
Raw Normal View History

2018-11-16 11:33:09 +00:00
/*
Copyright 2018 New Vector Ltd
2020-07-10 19:07:11 +01:00
Copyright 2020 The Matrix.org Foundation C.I.C.
2018-11-16 11:33:09 +00:00
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import React from "react";
2021-10-22 17:23:32 -05:00
2020-05-13 20:41:41 -06:00
import dis from "../../../dispatcher/dispatcher";
2018-11-16 11:33:09 +00:00
import { _t } from "../../../languageHandler";
2020-07-10 19:07:11 +01:00
import SdkConfig from "../../../SdkConfig";
2018-11-16 11:33:09 +00:00
import Modal from "../../../Modal";
2021-07-02 17:19:01 +02:00
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
import QuestionDialog from "./QuestionDialog";
2018-11-16 11:33:09 +00:00
interface IProps {
onFinished(logout?: boolean): void;
}
2021-07-02 17:25:30 +02:00
const CryptoStoreTooNewDialog: React.FC<IProps> = (props: IProps) => {
2020-07-10 19:07:11 +01:00
const brand = SdkConfig.get().brand;
const _onLogoutClicked = (): void => {
2022-06-14 17:51:51 +01:00
Modal.createDialog(QuestionDialog, {
title: _t("action|sign_out"),
description: _t("encryption|incompatible_database_sign_out_description", { brand }),
button: _t("action|sign_out"),
2018-11-16 11:33:09 +00:00
focus: false,
onFinished: (doLogout) => {
if (doLogout) {
2021-06-29 13:11:58 +01:00
dis.dispatch({ action: "logout" });
props.onFinished(true);
2018-11-16 11:33:09 +00:00
}
},
});
};
const description = _t("encryption|incompatible_database_description", { brand });
2018-11-16 11:33:09 +00:00
return (
<BaseDialog
className="mx_CryptoStoreTooNewDialog"
contentId="mx_Dialog_content"
title={_t("encryption|incompatible_database_title")}
2018-11-16 11:33:09 +00:00
hasCancel={false}
onFinished={props.onFinished}
>
<div className="mx_Dialog_content" id="mx_Dialog_content">
{description}
2022-12-12 12:24:14 +01:00
</div>
2018-11-16 11:33:09 +00:00
<DialogButtons
primaryButton={_t("encryption|incompatible_database_disable")}
2018-11-16 11:33:09 +00:00
hasCancel={false}
onPrimaryButtonClick={() => props.onFinished(false)}
2022-12-12 12:24:14 +01:00
>
<button onClick={_onLogoutClicked}>{_t("action|sign_out")}</button>
2018-11-16 11:33:09 +00:00
</DialogButtons>
</BaseDialog>
);
};
2021-07-02 17:25:30 +02:00
export default CryptoStoreTooNewDialog;