Skip to content

Commit

Permalink
feat(SFOX): add empty order state
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Welber committed May 30, 2018
1 parent 5575b53 commit b49cc80
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ class SfoxCheckout extends React.PureComponent {
}

render () {
const { data, modalActions, sfoxActions, sfoxDataActions, payment, orderState } = this.props
const { data, modalActions, sfoxActions, sfoxDataActions, payment, orderState, formActions } = this.props
const { handleTrade, fetchQuote, refreshQuote, refreshSellQuote, fetchSellQuote } = sfoxDataActions
const { sfoxNotAsked } = sfoxActions
const { showModal } = modalActions
const { change } = formActions

const busy = orderState.cata({
Success: () => false,
Expand All @@ -44,6 +45,7 @@ class SfoxCheckout extends React.PureComponent {
busy={busy}
payment={payment}
clearTradeError={() => sfoxNotAsked()}
changeTab={tab => change('buySellTabStatus', 'status', tab)}
/>,
Failure: (error) => <div>Failure: {error && error.message}</div>,
Loading: () => <Loading />,
Expand All @@ -67,7 +69,8 @@ const mapDispatchToProps = dispatch => ({
modalActions: bindActionCreators(actions.modals, dispatch),
sfoxActions: bindActionCreators(actions.modules.sfox, dispatch),
sfoxDataActions: bindActionCreators(actions.core.data.sfox, dispatch),
sendBtcActions: bindActionCreators(actions.components.sendBtc, dispatch)
sendBtcActions: bindActionCreators(actions.components.sendBtc, dispatch),
formActions: bindActionCreators(actions.form, dispatch)
})

export default connect(mapStateToProps, mapDispatchToProps)(SfoxCheckout)
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Stepper, { StepView } from 'components/Utilities/Stepper'
import OrderCheckout from './OrderCheckout'
import { OrderDetails, OrderSubmit } from './OrderReview'
import Helper from 'components/BuySell/FAQ'
import EmptyOrderHistoryContainer from 'components/BuySell/EmptyOrderHistory'

const CheckoutWrapper = styled.div`
width: 50%;
Expand Down Expand Up @@ -70,6 +71,7 @@ const Success = props => {
showModal,
handleTradeDetailsClick,
clearTradeError,
changeTab,
...rest } = props

const accounts = Remote.of(props.value.accounts).getOrElse([])
Expand Down Expand Up @@ -180,22 +182,27 @@ const Success = props => {
buy: 1e8,
sell: 1e8
}
return (
<OrderHistoryWrapper>
<OrderHistoryContent>
<Text size='15px' weight={400}>
<FormattedMessage id='scenes.buysell.sfoxcheckout.trades.pending' defaultMessage='Pending Orders' />
</Text>
<OrderHistoryTable trades={filter(isPending, trades)} conversion={conversion} handleDetailsClick={trade => showModal('SfoxTradeDetails', { trade })} />
</OrderHistoryContent>
<OrderHistoryContent>
<Text size='15px' weight={400}>
<FormattedMessage id='scenes.buysell.sfoxcheckout.trades.completed' defaultMessage='Completed Orders' />
</Text>
<OrderHistoryTable trades={filter(isCompleted, trades)} conversion={conversion} handleDetailsClick={trade => showModal('SfoxTradeDetails', { trade })} />
</OrderHistoryContent>
</OrderHistoryWrapper>
)

if (!trades.length) {
return <EmptyOrderHistoryContainer changeTab={changeTab} />
} else {
return (
<OrderHistoryWrapper>
<OrderHistoryContent>
<Text size='15px' weight={400}>
<FormattedMessage id='scenes.buysell.sfoxcheckout.trades.pending' defaultMessage='Pending Orders' />
</Text>
<OrderHistoryTable trades={filter(isPending, trades)} conversion={conversion} handleDetailsClick={trade => showModal('SfoxTradeDetails', { trade })} />
</OrderHistoryContent>
<OrderHistoryContent>
<Text size='15px' weight={400}>
<FormattedMessage id='scenes.buysell.sfoxcheckout.trades.completed' defaultMessage='Completed Orders' />
</Text>
<OrderHistoryTable trades={filter(isCompleted, trades)} conversion={conversion} handleDetailsClick={trade => showModal('SfoxTradeDetails', { trade })} />
</OrderHistoryContent>
</OrderHistoryWrapper>
)
}
} else {
return null
}
Expand Down

0 comments on commit b49cc80

Please sign in to comment.