diff --git a/common/containers/Tabs/Swap/components/wantToSwapMy.js b/common/containers/Tabs/Swap/components/wantToSwapMy.js index f82da9f0..f223c1d2 100644 --- a/common/containers/Tabs/Swap/components/wantToSwapMy.js +++ b/common/containers/Tabs/Swap/components/wantToSwapMy.js @@ -47,10 +47,13 @@ export default class WantToSwapMy extends Component { originKindSwap: PropTypes.func, destinationKindSwap: PropTypes.func, originAmountSwap: PropTypes.func, - destinationAmountSwap: PropTypes.func + destinationAmountSwap: PropTypes.func, + partOneCompleteSwap: PropTypes.func }; - onClickStartSwap() {} + onClickStartSwap = () => { + this.props.partOneCompleteSwap(true); + }; onChangeOriginAmount = amount => { let originAmountAsNumber = parseFloat(amount); diff --git a/common/containers/Tabs/Swap/components/yourInformation.js b/common/containers/Tabs/Swap/components/yourInformation.js new file mode 100644 index 00000000..69fe98de --- /dev/null +++ b/common/containers/Tabs/Swap/components/yourInformation.js @@ -0,0 +1,73 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; + +export default class YourInformation extends Component { + constructor(props) { + super(props); + } + + static propTypes = { + originAmount: PropTypes.number.isRequired, + destinationAmount: PropTypes.number.isRequired, + originKind: PropTypes.string.isRequired, + destinationKind: PropTypes.string.isRequired + }; + + computedOriginDestinationRatio = () => { + return this.props.destinationAmount / this.props.originAmount; + }; + + render() { + const { + originAmount, + originKind, + destinationAmount, + destinationKind + } = this.props; + + return ( +
+
+
Your Information
+
+ + {/* Todo - fix*/} + + +
+
+
+
+

+ {' '}{originAmount.toFixedIfLarger(6)} {originKind}{' '} +

+

Amount to send

+
+
+

+ {' '}{destinationAmount.toFixedIfLarger(6)} {destinationKind}{' '} +

+

Amount to receive

+
+
+

+ {' '}{this.computedOriginDestinationRatio().toFixedIfLarger(6)}{' '} + {originKind}/{destinationKind}{' '} +

+

Your rate

+
+
+
+ ); + } +} diff --git a/common/containers/Tabs/Swap/components/yourReceiving.js b/common/containers/Tabs/Swap/components/yourReceiving.js new file mode 100644 index 00000000..9b18113e --- /dev/null +++ b/common/containers/Tabs/Swap/components/yourReceiving.js @@ -0,0 +1,41 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { DONATION_ADDRESSES_MAP } from 'config/data'; + +export default class YourReceiving extends Component { + constructor(props) { + super(props); + } + + static propTypes = { + destinationKind: PropTypes.string.isRequired + }; + + render() { + const { destinationKind } = this.props; + return ( +
+
+
+
+ + +
+
+
+ + Start Swap + +
+
+
+ ); + } +} diff --git a/common/containers/Tabs/Swap/index.js b/common/containers/Tabs/Swap/index.js index 62dc6158..a97cfef0 100644 --- a/common/containers/Tabs/Swap/index.js +++ b/common/containers/Tabs/Swap/index.js @@ -1,6 +1,9 @@ import React, { Component } from 'react'; import WantToSwapMy from './components/wantToSwapMy'; +import YourInformation from './components/yourInformation'; import CurrentRates from './components/currentRates'; +import YourReceiving from './components/yourReceiving'; + import { connect } from 'react-redux'; import * as swapActions from 'actions/swap'; @@ -18,6 +21,7 @@ class Swap extends Component { originAmount: PropTypes.any, destinationAmount: PropTypes.any, originKind: PropTypes.string, + partOneComplete: PropTypes.bool, destinationKind: PropTypes.string, destinationKindOptions: PropTypes.array, originKindOptions: PropTypes.array, @@ -25,7 +29,8 @@ class Swap extends Component { destinationKindSwap: PropTypes.func, originAmountSwap: PropTypes.func, destinationAmountSwap: PropTypes.func, - updateBityRatesSwap: PropTypes.func + updateBityRatesSwap: PropTypes.func, + partOneCompleteSwap: PropTypes.func }; componentDidMount() { @@ -55,7 +60,9 @@ class Swap extends Component { originKindSwap, destinationKindSwap, originAmountSwap, - destinationAmountSwap + destinationAmountSwap, + partOneComplete, + partOneCompleteSwap } = this.props; let wantToSwapMyProps = { @@ -69,15 +76,31 @@ class Swap extends Component { originKindSwap, destinationKindSwap, originAmountSwap, - destinationAmountSwap + destinationAmountSwap, + partOneCompleteSwap + }; + + let yourInformationProps = { + originAmount, + destinationAmount, + originKind, + destinationKind }; return (
- - + {!partOneComplete && +
+ + +
} + {partOneComplete && +
+ + +
}
@@ -87,6 +110,7 @@ class Swap extends Component { function mapStateToProps(state) { return { + partOneComplete: state.swap.partOneComplete, originAmount: state.swap.originAmount, destinationAmount: state.swap.destinationAmount, originKind: state.swap.originKind,