-
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.
- Loading branch information
Showing
14 changed files
with
598 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
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
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
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
39 changes: 39 additions & 0 deletions
39
packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/SellCancelOrder/index.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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// import { actions } from 'data' | ||
// import { bindActionCreators, compose, Dispatch } from 'redux' | ||
// import { connect } from 'react-redux' | ||
// import { SwapOrderType } from 'core/types' | ||
// import React, { PureComponent } from 'react' | ||
// import Template from './template' | ||
|
||
// export type OwnProps = { | ||
// handleClose: () => void | ||
// order: SwapOrderType | ||
// } | ||
// export type LinkDispatchPropsType = { | ||
// swapActions: typeof actions.components.swap | ||
// } | ||
// type LinkStatePropsType = {} | ||
// type Props = OwnProps & LinkDispatchPropsType & LinkStatePropsType | ||
// type State = {} | ||
|
||
// class CancelOrder extends PureComponent<Props, State> { | ||
// state = {} | ||
|
||
// handleSubmit = () => { | ||
// this.props.swapActions.cancelOrder(this.props.order) | ||
// } | ||
|
||
// render () { | ||
// return <Template {...this.props} onSubmit={this.handleSubmit} /> | ||
// } | ||
// } | ||
|
||
// const mapStateToProps = (): LinkStatePropsType => ({}) | ||
|
||
// const mapDispatchToProps = (dispatch: Dispatch): LinkDispatchPropsType => ({ | ||
// swapActions: bindActionCreators(actions.components.swap, dispatch) | ||
// }) | ||
|
||
// const enhance = compose(connect(mapStateToProps, mapDispatchToProps)) | ||
|
||
// export default enhance(CancelOrder) |
116 changes: 116 additions & 0 deletions
116
packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/SellCancelOrder/template.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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// import { Button, HeartbeatLoader, Icon, Text } from 'blockchain-info-components' | ||
// import { ErrorCartridge } from 'components/Cartridge' | ||
// import { FlyoutWrapper } from 'components/Flyout' | ||
// import { Form } from 'components/Form' | ||
// import { FormattedMessage } from 'react-intl' | ||
// import { getOrderType } from 'data/components/simpleBuy/model' | ||
// import { InjectedFormProps, reduxForm } from 'redux-form' | ||
// import { LinkDispatchPropsType, OwnProps } from '.' | ||
// import React from 'react' | ||
// import styled from 'styled-components' | ||
|
||
// const Wrapper = styled.div` | ||
// width: 100%; | ||
// height: 100%; | ||
// display: flex; | ||
// align-items: center; | ||
// justify-content: center; | ||
// ` | ||
// const CustomForm = styled(Form)` | ||
// text-align: center; | ||
// ` | ||
|
||
// type Props = OwnProps & LinkDispatchPropsType | ||
|
||
// const Template: React.FC<InjectedFormProps<{}, Props> & Props> = props => { | ||
// return ( | ||
// <Wrapper> | ||
// <FlyoutWrapper> | ||
// <CustomForm onSubmit={props.handleSubmit}> | ||
// <Icon | ||
// name='alert-filled' | ||
// color='orange400' | ||
// size='52px' | ||
// style={{ display: 'block' }} | ||
// /> | ||
// <Text | ||
// color='grey800' | ||
// size='24px' | ||
// weight={600} | ||
// style={{ marginTop: '32px' }} | ||
// > | ||
// <FormattedMessage | ||
// id='modals.simplebuy.cancelorder.areyousure' | ||
// defaultMessage='Are you sure?' | ||
// /> | ||
// </Text> | ||
// <Text | ||
// color='grey600' | ||
// weight={500} | ||
// size='16px' | ||
// lineHeight='150%' | ||
// style={{ marginTop: '8px', marginBottom: '48px' }} | ||
// > | ||
// <FormattedMessage | ||
// id='modals.simplebuy.cancelorder.outcome' | ||
// defaultMessage='Cancelling this {pair} {orderType} will remove your order. You can always create a new order from the menu if you cancel now.' | ||
// values={{ | ||
// pair: props.order.pair, | ||
// orderType: orderType === 'BUY' ? 'Buy' : 'Sell' | ||
// }} | ||
// /> | ||
// </Text> | ||
// {props.error && ( | ||
// <div style={{ marginBottom: '16px' }}> | ||
// <ErrorCartridge>Error: {props.error}</ErrorCartridge> | ||
// </div> | ||
// )} | ||
// <Button | ||
// fullwidth | ||
// size='16px' | ||
// height='48px' | ||
// nature='light' | ||
// data-e2e='cancelSBOrder' | ||
// disabled={props.submitting} | ||
// type='submit' | ||
// > | ||
// {props.submitting ? ( | ||
// <HeartbeatLoader color='blue100' height='20px' width='20px' /> | ||
// ) : ( | ||
// <FormattedMessage | ||
// id='modals.simplebuy.cancelorder.cancel' | ||
// defaultMessage='Yes. Cancel Order' | ||
// /> | ||
// )} | ||
// </Button> | ||
// <Button | ||
// fullwidth | ||
// size='16px' | ||
// height='48px' | ||
// nature='primary' | ||
// data-e2e='cancelSBOrder' | ||
// disabled={props.submitting} | ||
// onClick={() => | ||
// props.simpleBuyActions.setStep({ | ||
// step: | ||
// props.order.state === 'PENDING_CONFIRMATION' | ||
// ? 'CHECKOUT_CONFIRM' | ||
// : 'ORDER_SUMMARY', | ||
// order: props.order | ||
// }) | ||
// } | ||
// style={{ marginTop: '16px' }} | ||
// type='button' | ||
// > | ||
// <FormattedMessage | ||
// id='modals.simplebuy.cancelorder.goback' | ||
// defaultMessage='No. Go Back' | ||
// /> | ||
// </Button> | ||
// </CustomForm> | ||
// </FlyoutWrapper> | ||
// </Wrapper> | ||
// ) | ||
// } | ||
|
||
// export default reduxForm<{}, Props>({ form: 'cancelSBOrderForm' })(Template) |
66 changes: 66 additions & 0 deletions
66
packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/SellOrderSummary/index.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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { actions, selectors } from 'data' | ||
import { bindActionCreators, Dispatch } from 'redux' | ||
import { connect, ConnectedProps } from 'react-redux' | ||
import { | ||
FiatTypeEnum, | ||
SupportedCoinType, | ||
SupportedWalletCurrenciesType, | ||
SwapOrderType | ||
} from 'core/types' | ||
import { RootState } from 'data/rootReducer' | ||
import React, { PureComponent } from 'react' | ||
import Success from './template.success' | ||
|
||
// This is a new order summary created for sell p3. Order type looks like what is currently a swap order type rather than an SB order type | ||
// Created this separate template so that we don't have to force types to match. Should be resued when Buy uses swap2.0 apis, and OrderSummary folder | ||
// can be deleted | ||
|
||
class SellOrderSummary extends PureComponent<Props> { | ||
state = {} | ||
|
||
componentDidMount () { | ||
this.props.simpleBuyActions.fetchSBOrders() | ||
} | ||
|
||
handleRefresh = () => { | ||
this.props.simpleBuyActions.fetchSBCards() | ||
} | ||
|
||
render () { | ||
return <Success {...this.props} /> | ||
} | ||
} | ||
|
||
const mapStateToProps = (state: RootState): LinkStatePropsType => ({ | ||
sellOrder: selectors.components.simpleBuy.getSellOrder(state), | ||
supportedCoins: selectors.core.walletOptions | ||
.getSupportedCoins(state) | ||
.getOrElse({ | ||
ALGO: { colorCode: 'algo' } as SupportedCoinType, | ||
BTC: { colorCode: 'btc' } as SupportedCoinType, | ||
BCH: { colorCode: 'bch' } as SupportedCoinType, | ||
ETH: { colorCode: 'eth' } as SupportedCoinType, | ||
PAX: { colorCode: 'pax' } as SupportedCoinType, | ||
USDT: { colorCode: 'usdt' } as SupportedCoinType, | ||
WDGLD: { colorCode: 'wdgld' } as SupportedCoinType, | ||
XLM: { colorCode: 'xlm' } as SupportedCoinType | ||
} as Omit<SupportedWalletCurrenciesType, keyof FiatTypeEnum>) | ||
}) | ||
|
||
const mapDispatchToProps = (dispatch: Dispatch) => ({ | ||
simpleBuyActions: bindActionCreators(actions.components.simpleBuy, dispatch), | ||
sendActions: bindActionCreators(actions.components.send, dispatch) | ||
}) | ||
const connector = connect(mapStateToProps, mapDispatchToProps) | ||
|
||
export type OwnProps = { | ||
handleClose: () => void | ||
} | ||
|
||
type LinkStatePropsType = { | ||
sellOrder: SwapOrderType | undefined, | ||
supportedCoins: SupportedWalletCurrenciesType | ||
} | ||
export type Props = OwnProps & ConnectedProps<typeof connector> | ||
|
||
export default connector(SellOrderSummary) |
Oops, something went wrong.