This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 974
Refactor of paymentTab #7481
Merged
Merged
Refactor of paymentTab #7481
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,12 @@ ledgerBackupTitle=Backup your Brave wallet | |
ledgerBackupContent=Below, you will find the anonymized recovery keys that are required if you ever lose access to this computer. | ||
minimumPageTimeSetting=Minimum page time before logging a visit | ||
minimumVisitsSetting=Minimum visits for publisher relevancy | ||
minimumPageTimeLow=5 seconds | ||
minimumPageTimeMedium=8 seconds | ||
minimumPageTimeHigh=1 minute | ||
minimumVisitsLow=1 visit | ||
minimumVisitsMedium=5 visits | ||
minimumVisitsHigh=10 visits | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ++! |
||
backupLedger=Backup your wallet | ||
balanceRecovered={{balance}} was recovered and transferred to your Brave wallet. | ||
recoverLedger=Recover your wallet | ||
|
147 changes: 147 additions & 0 deletions
147
app/renderer/components/preferences/payment/advancedSettings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const React = require('react') | ||
const {StyleSheet, css} = require('aphrodite') | ||
|
||
// util | ||
const {changeSetting} = require('../../../lib/settingsUtil') | ||
|
||
// components | ||
const Button = require('../../../../../js/components/button') | ||
const {SettingsList, SettingItem, SettingCheckbox} = require('../../settings') | ||
const {SettingDropdown} = require('../../dropdown') | ||
const ImmutableComponent = require('../../../../../js/components/immutableComponent') | ||
|
||
// style | ||
const commonStyles = require('../../styles/commonStyles') | ||
const globalStyles = require('../../styles/global') | ||
const {paymentCommon} = require('../../styles/payment') | ||
|
||
// other | ||
const settings = require('../../../../../js/constants/settings') | ||
|
||
class AdvancedSettingsContent extends ImmutableComponent { | ||
render () { | ||
const minDuration = this.props.ledgerData.getIn(['synopsisOptions', 'minDuration']) | ||
const minPublisherVisits = this.props.ledgerData.getIn(['synopsisOptions', 'minPublisherVisits']) | ||
|
||
return <div className={css(paymentCommon.board)}> | ||
<div className={css(paymentCommon.panel, styles.advancedSettings, commonStyles.noMarginTop, commonStyles.noMarginBottom)} data-test-id='advancedSettings'> | ||
<div className={css(styles.settingsPanelDivider, styles.deviderFirst)}> | ||
<div className={css(styles.minimumSetting)} data-l10n-id='minimumPageTimeSetting' /> | ||
<SettingsList> | ||
<SettingItem> | ||
<SettingDropdown | ||
data-test-id='durationSelector' | ||
defaultValue={minDuration || 8000} | ||
onChange={changeSetting.bind(null, this.props.onChangeSetting, settings.MINIMUM_VISIT_TIME)}> | ||
<option data-l10n-id='minimumPageTimeLow' value='5000' /> | ||
<option data-l10n-id='minimumPageTimeMedium' value='8000' /> | ||
<option data-l10n-id='minimumPageTimeHigh' value='60000' /> | ||
</SettingDropdown> | ||
</SettingItem> | ||
</SettingsList> | ||
<div className={css(styles.minimumSetting)} data-l10n-id='minimumVisitsSetting' /> | ||
<SettingsList className={css(commonStyles.noMarginBottom)}> | ||
<SettingItem> | ||
<SettingDropdown | ||
data-test-id='visitSelector' | ||
defaultValue={minPublisherVisits || 1} | ||
onChange={changeSetting.bind(null, this.props.onChangeSetting, settings.MINIMUM_VISITS)}> | ||
<option data-l10n-id='minimumVisitsLow' value='1' /> | ||
<option data-l10n-id='minimumVisitsMedium' value='5' /> | ||
<option data-l10n-id='minimumVisitsHigh' value='10' /> | ||
</SettingDropdown> | ||
</SettingItem> | ||
</SettingsList> | ||
</div> | ||
<div className={css(styles.settingsPanelDivider, styles.lastDivider)}> | ||
<SettingsList className={css(commonStyles.noMarginBottom)} | ||
listClassName={css(styles.list)} | ||
> | ||
<SettingCheckbox | ||
dataL10nId='minimumPercentage' | ||
prefKey={settings.MINIMUM_PERCENTAGE} | ||
settings={this.props.settings} | ||
onChangeSetting={this.props.onChangeSetting} | ||
className={css(styles.listItem)} | ||
switchClassName={css(styles.checkboxSwitch)} | ||
labelClassName={css(commonStyles.noMarginBottom)} | ||
/> | ||
<SettingCheckbox | ||
dataL10nId='notifications' | ||
prefKey={settings.PAYMENTS_NOTIFICATIONS} | ||
settings={this.props.settings} | ||
onChangeSetting={this.props.onChangeSetting} | ||
className={css(styles.listItem, commonStyles.noMarginBottom)} | ||
switchClassName={css(styles.checkboxSwitch)} | ||
labelClassName={css(commonStyles.noMarginBottom)} | ||
/> | ||
</SettingsList> | ||
</div> | ||
</div> | ||
</div> | ||
} | ||
} | ||
|
||
class AdvancedSettingsFooter extends ImmutableComponent { | ||
render () { | ||
return <div className={css(paymentCommon.advanceFooter)}> | ||
<Button l10nId='backupLedger' | ||
className={css(commonStyles.buttonPrimary)} | ||
onClick={this.props.showOverlay.bind(this, 'ledgerBackup')} | ||
/> | ||
<Button l10nId='recoverLedger' | ||
className={css(commonStyles.buttonPrimary, paymentCommon.marginButtons)} | ||
onClick={this.props.showOverlay.bind(this, 'ledgerRecovery')} | ||
/> | ||
<Button l10nId='done' | ||
className={css(commonStyles.whiteButton, commonStyles.inlineButton, paymentCommon.marginButtons)} | ||
onClick={this.props.hideOverlay.bind(this, 'advancedSettings')} | ||
/> | ||
</div> | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
advancedSettings: { | ||
paddingLeft: '50px', | ||
paddingRight: '50px', | ||
display: 'flex', | ||
flexWrap: 'nowrap' | ||
}, | ||
settingsPanelDivider: { | ||
width: '100%' | ||
}, | ||
minimumSetting: { | ||
marginBottom: globalStyles.spacing.modalPanelHeaderMarginBottom | ||
}, | ||
lastDivider: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
width: 'auto', | ||
position: 'relative', | ||
left: '1em' | ||
}, | ||
list: { | ||
display: 'flex', | ||
flexFlow: 'column nowrap', | ||
justifyContent: 'space-between' | ||
}, | ||
listItem: { | ||
display: 'flex', | ||
marginBottom: '1em' | ||
}, | ||
checkboxSwitch: { | ||
marginTop: '2px', | ||
paddingTop: 0, | ||
paddingBottom: 0 | ||
} | ||
}) | ||
|
||
module.exports = { | ||
AdvancedSettingsContent, | ||
AdvancedSettingsFooter | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! thanks for pulling this out- will make testing easy