Skip to content
Permalink
Browse files

[DDW-893] Dialogs - Change 'safetyAgreement' logic

  • Loading branch information...
daniloprates committed Sep 11, 2019
1 parent 40c654e commit 049680212ab1a34d08bd998c27bc489757f48673
@@ -38,23 +38,32 @@ export const messages = defineMessages({
type Props = {
onContinue: Function,
onClose: Function,
onToggleSafetyAgreement: Function,
};

type State = {
safetyAgreement: boolean,
};

@observer
export default class WalletRecoveryPhraseStep1 extends Component<Props> {
export default class WalletRecoveryPhraseStep1 extends Component<Props, State> {
static contextTypes = {
intl: intlShape.isRequired,
};

state = {
safetyAgreement: false,
};

onToggleSafetyAgreement = checked => {
this.setState({
safetyAgreement: checked,
});
};

render() {
const { intl } = this.context;
const {
onContinue,
onClose,
onToggleSafetyAgreement,
safetyAgreement,
} = this.props;
const { onContinue, onClose } = this.props;
const { safetyAgreement } = this.state;
const isSubmitting = false;

const actions = [
@@ -79,7 +88,7 @@ export default class WalletRecoveryPhraseStep1 extends Component<Props> {
<p>{intl.formatMessage(messages.recoveryPhraseStep1Paragraph1)}</p>
<p className={styles.checkboxContainer}>
<Checkbox
onChange={onToggleSafetyAgreement}
onChange={this.onToggleSafetyAgreement}
checked={safetyAgreement}
skin={CheckboxSkin}
className={styles.checkbox}
@@ -37,18 +37,32 @@ export const messages = defineMessages({

type Props = {
onClose: Function,
onToggleSafetyAgreement: Function,
};

type State = {
safetyAgreement: boolean,
};

@observer
export default class WalletRecoveryPhraseStep1 extends Component<Props> {
export default class WalletRecoveryPhraseStep1 extends Component<Props, State> {
static contextTypes = {
intl: intlShape.isRequired,
};

state = {
safetyAgreement: false,
};

onToggleSafetyAgreement = checked => {
this.setState({
safetyAgreement: checked,
});
};

render() {
const { intl } = this.context;
const { onClose, onToggleSafetyAgreement, safetyAgreement } = this.props;
const { onClose } = this.props;
const { safetyAgreement } = this.state;

const actions = [
{
@@ -71,7 +85,7 @@ export default class WalletRecoveryPhraseStep1 extends Component<Props> {
<p>{intl.formatMessage(messages.recoveryPhraseStep3Paragraph1)}</p>
<p className={styles.checkboxContainer}>
<Checkbox
onChange={onToggleSafetyAgreement}
onChange={this.onToggleSafetyAgreement}
checked={safetyAgreement}
skin={CheckboxSkin}
className={styles.checkbox}
@@ -7,33 +7,16 @@ import type { InjectedDialogContainerProps } from '../../../../types/injectedPro

type Props = InjectedDialogContainerProps;

type State = {
safetyAgreement: boolean,
};

@inject('stores', 'actions')
@observer
export default class WalletRecoveryPhraseStep1Container extends Component<
Props,
State
> {
export default class WalletRecoveryPhraseStep1Container extends Component<Props> {
static defaultProps = {
actions: null,
stores: null,
children: null,
onClose: () => {},
};

state = {
safetyAgreement: false,
};

handleToggleSafetyAgreement = checked => {
this.setState({
safetyAgreement: checked,
});
};

handleContinue = () => {
this.props.actions.dialogs.open.trigger({
dialog: WalletRecoveryPhraseStep2Dialog,
@@ -42,13 +25,10 @@ export default class WalletRecoveryPhraseStep1Container extends Component<

render() {
const { closeActiveDialog } = this.props.actions.dialogs;
const { safetyAgreement } = this.state;
return (
<WalletRecoveryPhraseStep1Dialog
onContinue={this.handleContinue}
onClose={closeActiveDialog.trigger}
safetyAgreement={safetyAgreement}
onToggleSafetyAgreement={this.handleToggleSafetyAgreement}
/>
);
}
@@ -6,42 +6,20 @@ import type { InjectedDialogContainerProps } from '../../../../types/injectedPro

type Props = InjectedDialogContainerProps;

type State = {
safetyAgreement: boolean,
};

@inject('stores', 'actions')
@observer
export default class WalletRecoveryPhraseStep2Container extends Component<
Props,
State
> {
export default class WalletRecoveryPhraseStep2Container extends Component<Props> {
static defaultProps = {
actions: null,
stores: null,
children: null,
onClose: () => {},
};

state = {
safetyAgreement: false,
};

handleToggleSafetyAgreement = checked => {
this.setState({
safetyAgreement: checked,
});
};

render() {
const { closeActiveDialog } = this.props.actions.dialogs;
const { safetyAgreement } = this.state;
return (
<WalletRecoveryPhraseStep3Dialog
onClose={closeActiveDialog.trigger}
safetyAgreement={safetyAgreement}
onToggleSafetyAgreement={this.handleToggleSafetyAgreement}
/>
<WalletRecoveryPhraseStep3Dialog onClose={closeActiveDialog.trigger} />
);
}
}

0 comments on commit 0496802

Please sign in to comment.
You can’t perform that action at this time.