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

Commit

Permalink
Adds default include for pinnned publishers
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Mar 11, 2017
1 parent 4490b2a commit 819f9fd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
33 changes: 27 additions & 6 deletions app/renderer/components/preferences/payment/ledgerTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {StyleSheet, css} = require('aphrodite')
// components
const ImmutableComponent = require('../../../../../js/components/immutableComponent')
const SortableTable = require('../../../../../js/components/sortableTable')
const SwitchControl = require('../../../../../js/components/switchControl')

// style
const globalStyles = require('../../styles/global')
Expand Down Expand Up @@ -90,6 +91,7 @@ class LedgerTable extends ImmutableComponent {
togglePinSite (hostPattern, pinned) {
if (pinned) {
aboutActions.changeSiteSetting(hostPattern, 'ledgerPinPercentage', 1)
aboutActions.changeSiteSetting(hostPattern, 'ledgerPayments', 1)
} else {
aboutActions.changeSiteSetting(hostPattern, 'ledgerPinPercentage', 0)
}
Expand Down Expand Up @@ -152,12 +154,21 @@ class LedgerTable extends ImmutableComponent {
value: site
},
{
html: <SiteSettingCheckbox small
hostPattern={this.getHostPattern(synopsis)}
defaultValue={defaultSiteSetting}
prefKey='ledgerPayments'
siteSettings={this.props.siteSettings}
checked={this.enabledForSite(synopsis)} />,
html: pinned
? <SwitchControl
className={css(styles.noPointer)}
backgroundClassName={css(styles.pinnedToggle)}
small
checkedOn
onClick={() => {}}
/>
: <SiteSettingCheckbox small
hostPattern={this.getHostPattern(synopsis)}
defaultValue={defaultSiteSetting}
prefKey='ledgerPayments'
siteSettings={this.props.siteSettings}
checked={this.enabledForSite(synopsis)}
/>,
value: this.enabledForSite(synopsis) ? 1 : 0
},
views,
Expand Down Expand Up @@ -283,6 +294,10 @@ const styles = StyleSheet.create({
}
},

noPointer: {
cursor: 'default'
},

tableClass: {
width: '100%',
textAlign: 'left',
Expand Down Expand Up @@ -418,6 +433,12 @@ const styles = StyleSheet.create({
backgroundColor: '#fff',
borderColor: globalStyles.color.highlightBlue
}
},

pinnedToggle: {
backgroundColor: '#f5f4f4',
cursor: 'default',
boxShadow: 'inset 0 1px 4px rgba(0, 0, 0, 0.20)'
}
})

Expand Down
3 changes: 2 additions & 1 deletion js/components/switchControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class SwitchControl extends ImmutableComponent {
}
<div className={cx({
switchBackground: true,
switchedOn: this.props.checkedOn
switchedOn: this.props.checkedOn,
[this.props.backgroundClassName]: !!this.props.backgroundClassName
})} onClick={this.onClick}>
<div className='switchIndicator' />
</div>
Expand Down

0 comments on commit 819f9fd

Please sign in to comment.