Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

display different payment options based on user location #3862

Merged
merged 1 commit into from
Sep 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ sync=Sync
privacy=Privacy
shields=Shields
security=Security
visit=visit
visits=Visits
publisher=Site
publishers=Publishers
Expand Down Expand Up @@ -63,6 +64,7 @@ on=on
notifications=notifications
moneyAdd=Use your debit/credit card
moneyAddSubTitle=No Bitcoin needed!
outsideUSAPayment=Need to buy Bitcoin outside of the USA?
coinbaseNotAvailable=Sorry! Adding funds with a credit/debit card is only available for contributions of $5/month at the moment.
add=Fund with debit/credit
transferTime=Transfer may take up to 40 minutes
Expand Down
30 changes: 29 additions & 1 deletion js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ class BitcoinDashboard extends ImmutableComponent {
get canUseCoinbase () {
return this.currency === 'USD' && this.amount < 6
}
get userInAmerica () {
const countryCode = this.props.ledgerData.get('countryCode')
return !(countryCode && countryCode !== 'US')
}
get coinbasePanel () {
if (this.canUseCoinbase) {
return <div className='panel'>
Expand All @@ -311,6 +315,27 @@ class BitcoinDashboard extends ImmutableComponent {
</div>
}
}
get exchangePanel () {
const url = this.props.ledgerData.getIn(['exchangeInfo', 'exchangeURL'])
const name = this.props.ledgerData.getIn(['exchangeInfo', 'exchangeName'])
// Call coinbasePanel if we don't have the URL or Name
if (!url || !name) {
return this.coinbasePanel
} else {
return <div className='panel'>
<div className='settingsPanelDivider'>
<span className='fa fa-credit-card' />
<div className='settingsListTitle' data-l10n-id='outsideUSAPayment' />
</div>
<div className='settingsPanelDivider'>
<span className='visitText' data-l10n-id='visit' />
<a target='_blank' className='browserButton primaryButton' href={url}>
{name}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github somehow lost my comment but i think this should say Go to ${name} instead of just the name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I totally forgot to add the word 'visit' before the button like @bradleyrichter has in his designs! Fixed.

</a>
</div>
</div>
}
}
get smartphonePanel () {
return <div className='panel'>
<div className='settingsPanelDivider'>
Expand Down Expand Up @@ -362,7 +387,10 @@ class BitcoinDashboard extends ImmutableComponent {
: null
}
<div className='board'>
{this.coinbasePanel}
{ (this.userInAmerica)
? this.coinbasePanel
: this.exchangePanel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably fall back to coinbase panel if exchangeUrl is not defined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this approach look?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure, i just think it should show something reasonable if exchangeUrl is empty due to a network connection problem or something

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkup oops, missed the context of your question. looks fine.

}
<div className='panel'>
<div className='settingsPanelDivider'>
<span className='bitcoinIcon fa-stack fa-lg'>
Expand Down
6 changes: 6 additions & 0 deletions less/about/preferences.less
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,12 @@ div.nextPaymentSubmission {
top: 0;
}
}
.visitText {
color: @braveOrange;
line-height: 45px;
margin: 0 13px;
font-size: 14px;
}
#bitcoinPaymentURL {
cursor: pointer;
background-color: @lightGray;
Expand Down