Skip to content

Commit

Permalink
feat(sell): add sell button to top of feed
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoB committed Dec 4, 2020
1 parent df92b51 commit 21bbd01
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,7 @@ type MessagesType = {
'modals.simplebuy.confirm.buynow': 'Buy Now'
'modals.simplebuy.confirm.jump_to_payment': 'Select Cash or Card'
'modals.simplebuy.confirm.payment': 'Payment Method'
'modals.simplebuy.comfirm.price': '{baseCoinTicker} Price'
'modals.simplebuy.confirm.rate': 'Exchange Rate'
'modals.simplebuy.confirm.coin_price': '{coin} Price'
'modals.simplebuy.doing.work': 'Doing Work...'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ const getPayloadObjectForStep = (payload: StepActionsPayload) => {
return {
step: payload.step,
cryptoCurrency: payload.cryptoCurrency,
fiatCurrency: payload.fiatCurrency
fiatCurrency: payload.fiatCurrency,
orderType: payload.orderType
}
case 'TRANSFER_DETAILS':
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export function simpleBuyReducer (
...state,
cryptoCurrency: action.payload.cryptoCurrency,
fiatCurrency: action.payload.fiatCurrency,
orderType: action.payload.orderType,
step: action.payload.step,
swapAccount: undefined,
addBank: undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,15 @@ export default ({
orderType
})
))
orderType === 'SELL' &&
(yield put(
A.setStep({
step: 'CRYPTO_SELECTION',
cryptoCurrency,
fiatCurrency,
orderType
})
))
} else {
yield put(
A.setStep({ step: 'CRYPTO_SELECTION', cryptoCurrency, fiatCurrency })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ export type StepActionsPayload =
}
| {
cryptoCurrency?: CoinType
fiatCurrency: FiatType
fiatCurrency: FiatType,
orderType?: SBOrderActionType,
step: 'CRYPTO_SELECTION'
}
| {
Expand Down Expand Up @@ -370,7 +371,7 @@ interface SetStepAction {
interface ShowModalAction {
payload: {
cryptoCurrency?: CoinType
orderType?: SBOrderActionType,
orderType?: SBOrderActionType
origin: SBShowModalOriginType
}
type: typeof AT.SHOW_MODAL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const getData = state => {
state
) as SBCheckoutFormValuesType
const invitationsR = selectors.core.settings.getInvitations(state)
// checks orderType on state for the 'SELL' button on top of actitivty feed
const stateOrderType = selectors.components.simpleBuy.getOrderType(state)
const pairsR = selectors.components.simpleBuy.getSBPairs(state)
const userDataR = selectors.modules.profile.getUserData(state)
const walletCurrencyR = selectors.core.settings.getCurrency(state)
Expand All @@ -26,7 +28,11 @@ export const getData = state => {
userData: ExtractSuccess<typeof userDataR>,
walletCurrency: FiatType
) => ({
orderType: formValues ? formValues.orderType : 'BUY',
// Doing this to check if state has been updated for orderType to be 'SELL'
// If user clicks on sell button on activity feed header
orderType: formValues
? formValues.orderType
: stateOrderType || 'BUY',
accounts,
coins,
eligibility,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,24 @@ class TransactionsContainer extends React.PureComponent<Props> {
<TitleActionContainer>
{coin in CoinTypeEnum && (
<>
{/* <Button
nature='primary'
data-e2e='sellCrypto'
<Button
nature='primary'
data-e2e='sellCrypto'
width='100px'
onClick={() => {
this.props.simpleBuyActions.showModal(
'TransactionList',
coin as CoinType,
'SELL'
)
}}
>
<FormattedMessage id="buttons.sell" defaultMessage="Sell" />
</Button> */}
style={{ marginRight: '8px' }}
onClick={() => {
this.props.simpleBuyActions.showModal(
'TransactionList',
coin as CoinType,
'SELL'
)
}}
>
<FormattedMessage
id='buttons.sell'
defaultMessage='Sell'
/>
</Button>
<Button
nature='primary'
data-e2e='buyCrypto'
Expand Down

0 comments on commit 21bbd01

Please sign in to comment.