Skip to content

Commit

Permalink
Fixes brave/brave-browser#9414 - Implements crypto widget toggle logi…
Browse files Browse the repository at this point in the history
…c in componentDidUpdate
  • Loading branch information
ryanml committed Apr 24, 2020
1 parent 2656245 commit 988ebcc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions components/brave_new_tab_ui/containers/newTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,20 @@ class NewTabPage extends React.Component<Props, State> {
this.stopWaitingForBrandedWallpaperNotificationAutoDismiss()
}

// Handles updates from brave://settings/newTab
const oldShowRewards = prevProps.newTabData.showRewards
const oldShowBinance = prevProps.newTabData.showBinance
const { showRewards, showBinance } = this.props.newTabData

if (!oldShowRewards && showRewards) {
this.props.actions.setCurrentStackWidget('rewards')
} else if (!oldShowBinance && showBinance) {
this.props.actions.setCurrentStackWidget('binance')
} else if (oldShowRewards && !showRewards) {
this.props.actions.setCurrentStackWidget('binance')
} else if (oldShowBinance && !showBinance) {
this.props.actions.setCurrentStackWidget('rewards')
}
}

trackCachedImage () {
Expand Down

0 comments on commit 988ebcc

Please sign in to comment.