Skip to content

Commit

Permalink
feat(simple buy): show other order state statuses as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Mar 26, 2020
1 parent 4e6a945 commit a0c6d19
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,33 +1,62 @@
import { FormattedMessage } from 'react-intl'
import { getOrderType } from 'data/components/simpleBuy/model'
import { SBOrderType } from 'core/types'
import { Text } from 'blockchain-info-components'
import React from 'react'

export const Status = ({ order }: { order: SBOrderType }) => {
const type = getOrderType(order)
switch (order.state) {
case 'FINISHED':
return (
<Text size='14px' weight={500} color='green600'>
<FormattedMessage
id='modals.simplebuy.transactionfeed.complete'
defaultMessage='{type} Completed'
values={{ type: type === 'BUY' ? 'Buy' : 'Sell' }}
/>
</Text>
)
case 'PENDING_CONFIRMATION':
case 'PENDING_DEPOSIT':
return (
<FormattedMessage
id='modals.simplebuy.transactionfeed.waitingondepo'
defaultMessage='Pending Deposit'
/>
<Text size='14px' weight={500}>
<FormattedMessage
id='modals.simplebuy.transactionfeed.waitingondepo'
defaultMessage='Pending Deposit'
/>
</Text>
)
case 'DEPOSIT_MATCHED':
return (
<FormattedMessage
id='modals.simplebuy.transactionfeed.pending'
defaultMessage='Pending {type}'
values={{ type: type === 'BUY' ? 'Buy' : 'Sell' }}
/>
<Text size='14px' weight={500}>
<FormattedMessage
id='modals.simplebuy.transactionfeed.pending'
defaultMessage='Pending {type}'
values={{ type: type === 'BUY' ? 'Buy' : 'Sell' }}
/>
</Text>
)
case 'FAILED':
case 'EXPIRED':
case 'CANCELED':
return (
<Text size='14px' weight={500} color='red600'>
<FormattedMessage
id='modals.simplebuy.transactionfeed.failed'
defaultMessage='{type} Failed'
values={{ type: type === 'BUY' ? 'Buy' : 'Sell' }}
/>
</Text>
)
default:
return (
<FormattedMessage
id='modals.simplebuy.transactionfeed.unknown'
defaultMessage='Unknown Status'
/>
<Text size='14px' weight={500} color='red600'>
<FormattedMessage
id='modals.simplebuy.transactionfeed.unknown'
defaultMessage='Unknown Status'
/>
</Text>
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,12 @@ class SimpleBuyListItem extends PureComponent<Props> {
Currencies[order.inputCurrency].units[order.inputCurrency],
value: convertBaseToStandard('FIAT', order.inputQuantity)
})
: Currency.coinToString({
unit:
Currencies[order.inputCurrency].units[order.inputCurrency],
value: convertBaseToStandard(
order.inputCurrency as CoinType,
order.inputQuantity
)
})
: 'Not yet implemented'

// add conditional here to only show if state is DEPOSIT_MATCHED, PENDING_DEPOSIT, 'PENDING_CONFIRMATION'
return (
<TransactionRow>
<StatusColumn data-e2e='orderStatusColumn'>
<Text size='14px' weight={500}>
<Status order={order} />
</Text>
<Status order={order} />
</StatusColumn>
<AmountColumn data-e2e='orderAmountColumn'>
<Text size='14px' weight={500}>
Expand Down

0 comments on commit a0c6d19

Please sign in to comment.