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

Commit

Permalink
restyle preferences payments
Browse files Browse the repository at this point in the history
  • Loading branch information
jkup authored and cezaraugusto committed Jan 9, 2017
1 parent 6923c7f commit 3e791cb
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 12 deletions.
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ views=Views
timeSpent=Time Spent
include=Include
percentage=%
remove=Remove
bravery=Bravery
hintsTitle=Helpful hints
hint0=The Bravery panel allows you to turn HTTPS Everywhere on or off. HTTPS Everywhere automatically changes your HTTP traffic to HTTPS for supported sites to keep you more secure.
Expand Down
1 change: 1 addition & 0 deletions docs/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ AppStore
'advanced.torrent-viewer-enabled': boolean, // Whether to render magnet links in the browser
'advanced.smooth-scroll-enabled': boolean, // false if smooth scrolling should be explicitly disabled
'advanced.send-crash-reports': boolean, // true or undefined if crash reports should be sent
'advanced.hide-excluded-sites': boolean, // Whether to hide excluded sites in the payments list
'shutdown.clear-history': boolean, // true to clear history on shutdown
'shutdown.clear-downloads': boolean, // true to clear downloads on shutdown
'shutdown.clear-cache': boolean, // true to clear cache on shutdown
Expand Down
30 changes: 26 additions & 4 deletions js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ class LedgerTable extends ImmutableComponent {
return true
}

banSite (hostPattern) {
aboutActions.changeSiteSetting(hostPattern, 'ledgerPaymentsShown', false)
}

getRow (synopsis) {
if (!synopsis || !synopsis.get || !this.shouldShow(synopsis)) {
return []
Expand All @@ -264,6 +268,10 @@ class LedgerTable extends ImmutableComponent {
const defaultSiteSetting = true

return [
{
html: <div className='neverShowSiteIcon' onClick={this.banSite.bind(this, this.getHostPattern(synopsis))}><span className='fa fa-ban' /></div>,
value: ''
},
rank,
{
html: <div className='site'>{verified ? this.getVerifiedIcon() : null}<a href={publisherURL} target='_blank'>{faviconURL ? <img src={faviconURL} alt={site} /> : <span className='fa fa-file-o' />}<span>{site}</span></a></div>,
Expand All @@ -287,11 +295,18 @@ class LedgerTable extends ImmutableComponent {
return null
}
return <div className='ledgerTable'>
<div className='hideExcludedSites'>
<SettingCheckbox
dataL10nId='hideExcluded'
prefKey={settings.HIDE_EXCLUDED_SITES}
settings={this.props.settings}
onChangeSetting={this.props.onChangeSetting}
/>
</div>
<SortableTable
headings={['rank', 'publisher', 'include', 'views', 'timeSpent', 'percentage']}
headings={['remove', 'rank', 'publisher', 'include', 'views', 'timeSpent', 'percentage']}
defaultHeading='rank'
overrideDefaultStyle
columnClassNames={['alignRight', '', '', 'alignRight', 'alignRight', 'alignRight']}
columnClassNames={['', 'alignRight', '', '', 'alignRight', 'alignRight', 'alignRight']}
rowClassNames={
this.synopsis.map((item) =>
this.enabledForSite(item) ? '' : 'paymentsDisabled').toJS()
Expand All @@ -304,7 +319,12 @@ class LedgerTable extends ImmutableComponent {
location: entry.get('publisherURL')
}
}).toJS()}
rows={this.synopsis.map((synopsis) => this.getRow(synopsis)).toJS()} />
rows={this.synopsis.filter((synopsis) => {
return !getSetting(settings.HIDE_EXCLUDED_SITES, this.props.settings) || this.enabledForSite(synopsis)
}).map((synopsis) => {
return this.getRow(synopsis)
}).toJS()}
/>
</div>
}
}
Expand Down Expand Up @@ -972,6 +992,8 @@ class PaymentsTab extends ImmutableComponent {
get tableContent () {
// TODO: This should be sortable. #2497
return <LedgerTable ledgerData={this.props.ledgerData}
settings={this.props.settings}
onChangeSetting={this.props.onChangeSetting}
siteSettings={this.props.siteSettings} />
}

Expand Down
1 change: 1 addition & 0 deletions js/constants/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ module.exports = {
'advanced.smooth-scroll-enabled': false,
'advanced.send-crash-reports': true,
'advanced.send-usage-statistics': false,
'advanced.hide-excluded-sites': false,
'advanced.minimum-visit-time': 8,
'advanced.minimum-visits': 5,
'advanced.minimum-percentage': false,
Expand Down
1 change: 1 addition & 0 deletions js/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const settings = {
SEND_CRASH_REPORTS: 'advanced.send-crash-reports',
SEND_USAGE_STATISTICS: 'advanced.send-usage-statistics',
ADBLOCK_CUSTOM_RULES: 'adblock.customRules',
HIDE_EXCLUDED_SITES: 'advanced.hide-excluded-sites',
MINIMUM_VISIT_TIME: 'advanced.minimum-visit-time',
MINIMUM_VISITS: 'advanced.minimum-visits',
MINIMUM_PERCENTAGE: 'advanced.minimum-percentage',
Expand Down
6 changes: 6 additions & 0 deletions less/about/history.less
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
.domain {
font-size: 11pt;
}

td {
&:nth-of-type(2) {
width: 60%;
}
}
}
}
}
35 changes: 31 additions & 4 deletions less/about/preferences.less
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ table.sortableTable {
}

.paymentsContainer {

@walletTableData: 235px + 30px; // .walletBar td (min-width + padding)
@barMargin: 15px 0 30px;
@fontSize: 14.5px; // .form-control
Expand All @@ -472,14 +471,37 @@ table.sortableTable {
}
}

tr {
th,
td {
padding: 0 15px;
}
}

.neverShowSiteIcon {
font-size: 20px;
text-align: center;

.fa {
visibility: hidden;
}

&:hover {
.fa {
visibility: visible;
}
}
}

th {
color: @darkGray;
font-weight: 600;
}

.sort {
text-align: left;
}
.hideExcludedSites {
text-align: right;
margin: 10px 75px;
}

.modal {
.dialog {
Expand Down Expand Up @@ -1174,6 +1196,11 @@ table.sortableTable {
}
}

.sort {
width: 100%;
text-align: left;
}

.ledgerTable {
tr {
height: 26px;
Expand Down
5 changes: 1 addition & 4 deletions less/sortableTable.less
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,9 @@ table.sortableTable {
td {
color: @mediumGray;
-webkit-font-smoothing: antialiased;
position: relative;
width: auto;

&:nth-of-type(2) {
width: 60%;
}

input[type='range'] {
background: transparent;
-webkit-appearance: none;
Expand Down

0 comments on commit 3e791cb

Please sign in to comment.