diff --git a/app/extensions/brave/locales/en-US/preferences.properties b/app/extensions/brave/locales/en-US/preferences.properties index 75965b6189f..bc95aaf4bf7 100644 --- a/app/extensions/brave/locales/en-US/preferences.properties +++ b/app/extensions/brave/locales/en-US/preferences.properties @@ -82,6 +82,7 @@ rank=Rank views=Views timeSpent=Time Spent include=Include +percentage=% bravery=Bravery hintsTitle=Helpful hints hint0=The Bravery panel allows you turn HTTPS Everywhere on or off. HTTPS Everywhere automatically rewrites your HTTP traffic to HTTPS for supported sites to keep you more secure. diff --git a/js/about/preferences.js b/js/about/preferences.js index 2c1c4453acb..61c712d2169 100644 --- a/js/about/preferences.js +++ b/js/about/preferences.js @@ -21,7 +21,6 @@ const getSetting = require('../settings').getSetting const SortableTable = require('../components/sortableTable') const Button = require('../components/button') const searchProviders = require('../data/searchProviders') -const pad = require('underscore.string/pad') const adblock = appConfig.resourceNames.ADBLOCK const cookieblock = appConfig.resourceNames.COOKIEBLOCK @@ -163,16 +162,16 @@ class SiteSettingCheckbox extends ImmutableComponent { } } -class LedgerTableRow extends ImmutableComponent { +class LedgerTable extends ImmutableComponent { get synopsis () { - return this.props.synopsis + return this.props.ledgerData.get('synopsis') } - get formattedTime () { - var d = this.synopsis.get('daysSpent') - var h = this.synopsis.get('hoursSpent') - var m = this.synopsis.get('minutesSpent') - var s = this.synopsis.get('secondsSpent') + getFormattedTime (synopsis) { + var d = synopsis.get('daysSpent') + var h = synopsis.get('hoursSpent') + var m = synopsis.get('minutesSpent') + var s = synopsis.get('secondsSpent') if (d << 0 > 364) { return '>1y' } @@ -183,14 +182,12 @@ class LedgerTableRow extends ImmutableComponent { return (d + h + m + s + '') } - padLeft (v) { return pad(v, 12, '0') } - - get hostPattern () { - return `https?://${this.synopsis.get('site')}` + getHostPattern (synopsis) { + return `https?://${synopsis.get('site')}` } - get enabled () { - const hostSettings = this.props.siteSettings.get(this.hostPattern) + enabledForSite (synopsis) { + const hostSettings = this.props.siteSettings.get(this.getHostPattern(synopsis)) if (hostSettings) { const result = hostSettings.get('ledgerPayments') if (typeof result === 'boolean') { @@ -200,54 +197,53 @@ class LedgerTableRow extends ImmutableComponent { return true } - render () { - const faviconURL = this.synopsis.get('faviconURL') || appConfig.defaultFavicon - const rank = this.synopsis.get('rank') - const views = this.synopsis.get('views') - const duration = this.synopsis.get('duration') - const publisherURL = this.synopsis.get('publisherURL') - // TODO: This should redistribute percentages accordingly when a site is - // enabled/disabled for payments. - const percentage = this.synopsis.get('percentage') - const site = this.synopsis.get('site') + getRow (synopsis) { + if (!synopsis || !synopsis.get) { + return [] + } + const faviconURL = synopsis.get('faviconURL') || appConfig.defaultFavicon + const rank = synopsis.get('rank') + const views = synopsis.get('views') + const duration = synopsis.get('duration') + const publisherURL = synopsis.get('publisherURL') + const percentage = synopsis.get('percentage') + const site = synopsis.get('site') const defaultSiteSetting = true - return
- | - | - | - | - | % | -
---|