Skip to content

Commit

Permalink
Merge pull request #4445 from brave/ntp-ads-unsupported-region
Browse files Browse the repository at this point in the history
New Tab Page WebUI: Rewards widget does not display Ads item if non-ads region
  • Loading branch information
petemill committed Jan 29, 2020
1 parent 91a9174 commit 21edcf4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ class Rewards extends React.PureComponent<RewardsProps, {}> {
renderRewardsInfo = () => {
const {
enabledMain,
walletCreated
walletCreated,
adsSupported
} = this.props

if (!enabledMain || !walletCreated) {
Expand All @@ -229,7 +230,7 @@ class Rewards extends React.PureComponent<RewardsProps, {}> {

return (
<div data-test-id2={'enableMain'}>
{this.renderAmountItem(AmountItemType.ADS)}
{adsSupported && this.renderAmountItem(AmountItemType.ADS)}
{this.renderAmountItem(AmountItemType.TIPS)}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export const NotificationButton = styled(CoinsButton)`
`

export const AmountItem = styled<StyleProps, 'div'>('div')`
margin-top: ${p => p.isLast ? 18 : 12}px;
margin-top: 18px;
margin-bottom: ${p => p.isLast ? -10 : 0}px;
${p => p.isActionPrompt && css`
text-align: center;
Expand Down
1 change: 1 addition & 0 deletions components/brave_new_tab_ui/stories/default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ storiesOf('New Tab/Default', module)
showBrandedWallpaper={boolean('Show branded wallpaper?', false)}
showTopSitesNotification={boolean('Show top sites notification?', false)}
isAdsOn={boolean('Ads on?', true)}
isAdsSupported={boolean('Ads region supported?', true)}
/>
)
})
3 changes: 2 additions & 1 deletion components/brave_new_tab_ui/stories/default/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface Props {
showBrandedWallpaper: boolean
showTopSitesNotification: boolean
isAdsOn: boolean
isAdsSupported: boolean
}

export default class NewTabPage extends React.PureComponent<Props, State> {
Expand Down Expand Up @@ -240,7 +241,7 @@ export default class NewTabPage extends React.PureComponent<Props, State> {
{(showRewards || (showBrandedWallpaper && !this.state.isBrandedWallpaperNotificationDismissed)) &&
<Page.GridItemRewards>
<Rewards
adsSupported={true}
adsSupported={this.props.isAdsSupported}
promotions={promotions}
balance={balance}
enabledAds={enabledAds}
Expand Down

0 comments on commit 21edcf4

Please sign in to comment.