Fixed modals

This commit is contained in:
hackrush 2017-08-31 09:45:13 +05:30
parent 21175ba608
commit b973524901
5 changed files with 81 additions and 1 deletions

View file

@ -0,0 +1,16 @@
import React from "react";
import { connect } from "react-redux";
import { doCloseModal, doNavigate } from "actions/app";
import ModalInsufficientBalance from "./view";
const select = state => ({});
const perform = dispatch => ({
addBalance: () => {
dispatch(doNavigate("/wallet"));
dispatch(doCloseModal());
},
closeModal: () => dispatch(doCloseModal()),
});
export default connect(select, perform)(ModalInsufficientBalance);

View file

@ -0,0 +1,26 @@
import React from "react";
import { Modal } from "modal/modal";
class ModalInsufficientBalance extends React.PureComponent {
render() {
const { addBalance, closeModal } = this.props;
return (
<Modal
isOpen={true}
type="confirm"
contentLabel={__("Not enough credits")}
confirmButtonLabel={__("Get Credits")}
abortButtonLabel={__("Cancel")}
onAborted={closeModal}
onConfirmed={addBalance}
>
{__(
"Insufficient balance: after this transaction you would have less than 1 LBC in your wallet."
)}
</Modal>
);
}
}
export default ModalInsufficientBalance;

View file

@ -6,8 +6,10 @@ import ModalInsufficientCredits from "modal/modalInsufficientCredits";
import ModalUpgrade from "modal/modalUpgrade";
import ModalWelcome from "modal/modalWelcome";
import ModalFirstReward from "modal/modalFirstReward";
import * as modals from "constants/modal_types";
import ModalCreditIntro from "modal/modalCreditIntro";
import ModalTransactionFailed from "modal/modalTransactionFailed";
import ModalInsufficientBalance from "modal/modalInsufficientBalance";
import * as modals from "constants/modal_types";
class ModalRouter extends React.PureComponent {
componentWillMount() {
@ -51,6 +53,10 @@ class ModalRouter extends React.PureComponent {
return <ModalAuthFailure />;
case modals.CREDIT_INTRO:
return <ModalCreditIntro />;
case modals.TRANSACTION_FAILED:
return <ModalTransactionFailed />;
case modals.INSUFFICIENT_BALANCE:
return <ModalInsufficientBalance />;
default:
return null;
}

View file

@ -0,0 +1,12 @@
import React from "react";
import { connect } from "react-redux";
import { doCloseModal } from "actions/app";
import ModalTransactionFailed from "./view";
const select = state => ({});
const perform = dispatch => ({
closeModal: () => dispatch(doCloseModal()),
});
export default connect(select, perform)(ModalTransactionFailed);

View file

@ -0,0 +1,20 @@
import React from "react";
import { Modal } from "modal/modal";
class ModalTransactionFailed extends React.PureComponent {
render() {
const { closeModal } = this.props;
return (
<Modal
isOpen={true}
contentLabel={__("Transaction failed")}
onConfirmed={closeModal}
>
{__("Something went wrong")}:
</Modal>
);
}
}
export default ModalTransactionFailed;