-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(simple buy): show other order state statuses as well
- Loading branch information
Philip London
committed
Mar 26, 2020
1 parent
4e6a945
commit a0c6d19
Showing
2 changed files
with
44 additions
and
25 deletions.
There are no files selected for viewing
55 changes: 42 additions & 13 deletions
55
packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/TransactionList/model.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters