-
Notifications
You must be signed in to change notification settings - Fork 973
display different payment options based on user location #3862
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'> | ||
|
@@ -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} | ||
</a> | ||
</div> | ||
</div> | ||
} | ||
} | ||
get smartphonePanel () { | ||
return <div className='panel'> | ||
<div className='settingsPanelDivider'> | ||
|
@@ -362,7 +387,10 @@ class BitcoinDashboard extends ImmutableComponent { | |
: null | ||
} | ||
<div className='board'> | ||
{this.coinbasePanel} | ||
{ (this.userInAmerica) | ||
? this.coinbasePanel | ||
: this.exchangePanel | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should probably fall back to coinbase panel if exchangeUrl is not defined There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how does this approach look? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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'> | ||
|
There was a problem hiding this comment.
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 nameThere was a problem hiding this comment.
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.