Skip to content

Commit

Permalink
combine trackers blocked and ads blocked on NTP
Browse files Browse the repository at this point in the history
  • Loading branch information
cezaraugusto authored and bbondy committed Jul 25, 2019
1 parent 39dc5bf commit ffdb89e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 19 deletions.
3 changes: 1 addition & 2 deletions browser/ui/webui/brave_webui_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ void CustomizeWebUIHTMLSource(const std::string &name,
localized_strings = {
{
std::string("newtab"), {
{ "adsBlocked", IDS_BRAVE_NEW_TAB_TOTAL_ADS_BLOCKED },
{ "trackersBlocked", IDS_BRAVE_NEW_TAB_TOTAL_TRACKERS_BLOCKED },
{ "adsTrackersBlocked", IDS_BRAVE_NEW_TAB_TOTAL_ADS_TRACKERS_BLOCKED },
{ "httpsUpgraded", IDS_BRAVE_NEW_TAB_TOTAL_HTTPS_UPGRADES },
{ "estimatedTimeSaved", IDS_BRAVE_NEW_TAB_TOTAL_TIME_SAVED },
{ "thumbRemoved", IDS_BRAVE_NEW_TAB_THUMB_REMOVED },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ export const StyledStatsItem = styled<{}, 'li'>('li')`
color: #FB542B;
}
&:nth-child(2) {
color: #B02FFB;
}
&:nth-child(3) {
color: #4C54D2;
color: #A0A5EB;
}
&:last-child {
color: #FFFFFF;
Expand Down
9 changes: 2 additions & 7 deletions components/brave_new_tab_ui/containers/newTab/stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,16 @@ class Stats extends React.Component<Props, {}> {
}

render () {
const trackedBlockersCount = this.trackedBlockersCount.toLocaleString()
const adblockCount = this.adblockCount.toLocaleString()
const trackedBlockersCount = (this.trackedBlockersCount + this.adblockCount).toLocaleString()
const httpsUpgradedCount = this.httpsUpgradedCount.toLocaleString()
const timeSaved = this.estimatedTimeSaved

return (
<StatsContainer>
<StatsItem
description={getLocale('trackersBlocked')}
description={getLocale('adsTrackersBlocked')}
counter={trackedBlockersCount}
/>
<StatsItem
description={getLocale('adsBlocked')}
counter={adblockCount}
/>
<StatsItem
description={getLocale('httpsUpgraded')}
counter={httpsUpgradedCount}
Expand Down
3 changes: 1 addition & 2 deletions components/brave_new_tab_ui/stories/default/stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class Stats extends React.PureComponent<{}, {}> {
render () {
return (
<StatsContainer>
<StatsItem counter='42' description={getLocale('trackersBlocked')} />
<StatsItem counter='105' description={getLocale('adsBlocked')} />
<StatsItem counter='42' description={getLocale('adsTrackersBlocked')} />
<StatsItem counter='0' description={getLocale('httpsUpgrades')} />
<StatsItem counter='5' text={getLocale('minutes')} description={getLocale('estimatedTimeSaved')} />
</StatsContainer>
Expand Down
3 changes: 1 addition & 2 deletions components/brave_new_tab_ui/stories/fakeLocale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

const locale: any = {
// stats
trackersBlocked: 'Trackers Blocked',
adsBlocked: 'Ads Blocked',
adsTrackersBlocked: 'Ads and Trackers Blocked',
httpsUpgrades: 'HTTPS Upgrades',
estimatedTimeSaved: 'Estimated Time Saved',
minutes: 'minutes',
Expand Down
3 changes: 1 addition & 2 deletions components/resources/brave_components_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@
<release seq="1">
<messages fallback_to_english="true">
<!-- WebUI newtab resources -->
<message name="IDS_BRAVE_NEW_TAB_TOTAL_ADS_BLOCKED" desc="total number of ads blocked">Ads Blocked</message>
<message name="IDS_BRAVE_NEW_TAB_TOTAL_TRACKERS_BLOCKED" desc="total number of trackers blocked">Trackers Blocked</message>
<message name="IDS_BRAVE_NEW_TAB_TOTAL_ADS_TRACKERS_BLOCKED" desc="total number of ads and trackers blocked">Ads and Trackers Blocked</message>
<message name="IDS_BRAVE_NEW_TAB_TOTAL_HTTPS_UPGRADES" desc="total number of HTTPS upgrades">HTTPS Upgrades</message>
<message name="IDS_BRAVE_NEW_TAB_TOTAL_TIME_SAVED" desc="total time saved from blocking ads and trackers">Estimated Time Saved</message>
<message name="IDS_BRAVE_NEW_TAB_THUMB_REMOVED" desc="Shown when a thumbnail is removed from the new tab page">Top site removed.</message>
Expand Down

0 comments on commit ffdb89e

Please sign in to comment.