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

Hides lion badge when count is 0 #7877

Merged
merged 1 commit into from
Mar 25, 2017
Merged
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
10 changes: 6 additions & 4 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ class Main extends ImmutableComponent {
const trackers = frames.getIn(['trackingProtection', 'blocked'])
const blocked = (ads ? ads.size : 0) + (trackers ? trackers.size : 0)

return (blocked > 99) ? '99+' : blocked
return (blocked.size === 0) ? false : ((blocked > 99) ? '99+' : blocked)
Copy link
Member

Choose a reason for hiding this comment

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

The change looks great. I think it could be better though if you pulled the logic out to a method and then had a unit test for it, using enzyme 😄

}

render () {
Expand Down Expand Up @@ -945,6 +945,7 @@ class Main extends ImmutableComponent {

const appStateSites = this.props.appState.get('sites')
const activeTabShowingMessageBox = !!(activeTab && activeTab.get('messageBoxDetail'))
const totalBlocks = this.getTotalBlocks(activeFrame)

return <div id='window'
className={cx({
Expand Down Expand Up @@ -1077,9 +1078,9 @@ class Main extends ImmutableComponent {
: null
}
{
!this.braveShieldsDisabled
!this.braveShieldsDisabled && totalBlocks
? <div className={css(styles.lionBadge)} data-test-id='lionBadge'>
{this.getTotalBlocks(activeFrame)}
{totalBlocks}
</div>
: null
}
Expand Down Expand Up @@ -1370,7 +1371,8 @@ const styles = StyleSheet.create({
font: '7pt "Arial Narrow"',
textAlign: 'center',
border: '.5px solid #FFF',
background: '#555555'
background: '#555555',
minWidth: '9px'
}
})

Expand Down