-
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(cta-interest): implemented CTA section for interest
- Loading branch information
Showing
19 changed files
with
667 additions
and
12 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
365 changes: 365 additions & 0 deletions
365
packages/blockchain-info-components/src/Images/img/bg-banner-pattern.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
47 changes: 47 additions & 0 deletions
47
.../blockchain-wallet-v4-frontend/src/modals/SimpleBuy/OrderSummary/InterestBanner/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,47 @@ | ||
import { bindActionCreators, Dispatch } from 'redux' | ||
import { connect, ConnectedProps } from 'react-redux' | ||
import React, { PureComponent } from 'react' | ||
|
||
import { actions } from 'data' | ||
import { RemoteDataType } from 'core/types' | ||
|
||
import { getData } from './selectors' | ||
import Template from './template.success' | ||
|
||
class InterestBanner extends PureComponent<Props> { | ||
componentDidMount () { | ||
this.props.interestActions.fetchInterestRate() | ||
} | ||
render () { | ||
return this.props.data.cata({ | ||
Success: val => <Template {...this.props} {...val} />, | ||
Failure: () => null, | ||
Loading: () => null, | ||
NotAsked: () => null | ||
}) | ||
} | ||
} | ||
|
||
const mapStateToProps = (state): LinkStatePropsType => ({ | ||
data: getData(state) | ||
}) | ||
|
||
const mapDispatchToProps = (dispatch: Dispatch) => ({ | ||
interestActions: bindActionCreators(actions.components.interest, dispatch) | ||
}) | ||
|
||
const connector = connect(mapStateToProps, mapDispatchToProps) | ||
|
||
export type OwnPropsType = { | ||
handleClose: () => void | ||
} | ||
|
||
export type SuccessStateType = ReturnType<typeof getData>['data'] | ||
|
||
export type LinkStatePropsType = { | ||
data: RemoteDataType<string, SuccessStateType> | ||
} | ||
|
||
export type Props = OwnPropsType & ConnectedProps<typeof connector> | ||
|
||
export default connector(InterestBanner) |
25 changes: 25 additions & 0 deletions
25
...ockchain-wallet-v4-frontend/src/modals/SimpleBuy/OrderSummary/InterestBanner/selectors.ts
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,25 @@ | ||
import { lift } from 'ramda' | ||
|
||
import { ExtractSuccess, SupportedWalletCurrenciesType } from 'core/types' | ||
import { RootState } from 'data/rootReducer' | ||
import { selectors } from 'data' | ||
|
||
export const getData = (state: RootState) => { | ||
const supportedCoinsR = selectors.core.walletOptions.getSupportedCoins(state) | ||
const interestRateR = selectors.components.interest.getInterestRate(state) | ||
const afterTransactionR = selectors.components.interest.getAfterTransaction( | ||
state | ||
) | ||
|
||
return lift( | ||
( | ||
supportedCoins: SupportedWalletCurrenciesType, | ||
interestRate: ExtractSuccess<typeof interestRateR>, | ||
afterTransaction: ExtractSuccess<typeof afterTransactionR> | ||
) => ({ | ||
supportedCoins, | ||
interestRate, | ||
afterTransaction | ||
}) | ||
)(supportedCoinsR, interestRateR, afterTransactionR) | ||
} |
71 changes: 71 additions & 0 deletions
71
...-wallet-v4-frontend/src/modals/SimpleBuy/OrderSummary/InterestBanner/template.success.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,71 @@ | ||
import { FormattedMessage } from 'react-intl' | ||
import React from 'react' | ||
|
||
import { Button, Text } from 'blockchain-info-components' | ||
import { CustomBoxRightOriented } from 'components/Layout' | ||
|
||
import { Props as OwnProps, SuccessStateType } from './index' | ||
|
||
type Props = OwnProps & SuccessStateType | ||
|
||
const InterestBanner: React.FC<Props> = ({ | ||
supportedCoins, | ||
interestRate, | ||
afterTransaction, | ||
interestActions | ||
}) => { | ||
const { amount, currency } = afterTransaction | ||
const { displayName } = supportedCoins[currency] | ||
return ( | ||
<CustomBoxRightOriented> | ||
<div> | ||
<Text | ||
size='16px' | ||
color='grey900' | ||
weight={600} | ||
style={{ marginTop: '16px' }} | ||
> | ||
<FormattedMessage | ||
id='modals.simplebuy.interest_banner.title' | ||
defaultMessage='Earn {interestRate}% on this {displayName} Purchase' | ||
values={{ | ||
displayName, | ||
interestRate: interestRate[currency] | ||
}} | ||
/> | ||
</Text> | ||
<Text | ||
size='14px' | ||
color='grey600' | ||
weight={500} | ||
style={{ marginTop: '4px', lineHeight: 1.5, maxWidth: '286px' }} | ||
> | ||
<FormattedMessage | ||
id='modals.simplebuy.interest_banner.description' | ||
defaultMessage='Send your {amount}{currency} to your {displayName} Interest Account.' | ||
values={{ | ||
amount, | ||
currency, | ||
displayName | ||
}} | ||
/> | ||
</Text> | ||
</div> | ||
<Button | ||
style={{ marginTop: '16px', maxWidth: '144px' }} | ||
nature='light' | ||
data-e2e='earnInterestNow' | ||
onClick={() => | ||
interestActions.showInterestModal('ACCOUNT_SUMMARY', currency) | ||
} | ||
> | ||
<FormattedMessage | ||
id='modals.simplebuy.interest_banner.earn_now' | ||
defaultMessage='Earn Now ->' | ||
/> | ||
</Button> | ||
</CustomBoxRightOriented> | ||
) | ||
} | ||
|
||
export default InterestBanner |
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
Oops, something went wrong.