1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Remove handleSlider

This commit is contained in:
Gonçalo Santos
2020-03-05 16:34:04 +00:00
parent 8a6df8bf95
commit 38ed5b8541

View File

@@ -63,9 +63,6 @@ class UiTab extends React.Component {
} }
ipc.addListener('APP_SETTING_DONE', this.handleSettingDone) ipc.addListener('APP_SETTING_DONE', this.handleSettingDone)
ipc.addListener('APP_SETTING_ERROR', this.handleSettingError) ipc.addListener('APP_SETTING_ERROR', this.handleSettingError)
this.handleSlider(null, 1)
this.handleSlider(null, 2)
} }
componentWillUnmount() { componentWillUnmount() {
@@ -230,24 +227,6 @@ class UiTab extends React.Component {
return `${hour}:${minute}` return `${hour}:${minute}`
} }
handleSlider(e, number) {
const sliderID = 'rs-range-line-' + number
const bulletID = 'rs-bullet-' + number
const rangeSlider = document.getElementById(sliderID)
const rangeBullet = document.getElementById(bulletID)
if (rangeSlider && rangeBullet) {
const bulletPosition = rangeSlider.value / rangeSlider.max
rangeBullet.style.left =
bulletPosition * 574 + 6 * (1 - bulletPosition) + 'px'
}
if (e) {
this.handleUIChange(e)
}
}
render() { render() {
const UiAlert = this.state.UiAlert const UiAlert = this.state.UiAlert
const UiAlertElement = const UiAlertElement =
@@ -308,7 +287,7 @@ class UiTab extends React.Component {
<label> <label>
<input <input
onChange={e => this.handleUIChange(e)} onChange={e => this.handleUIChange(e)}
checked={this.state.config.ui.enableScheduleTheme} checked={config.ui.enableScheduleTheme}
ref='enableScheduleTheme' ref='enableScheduleTheme'
type='checkbox' type='checkbox'
/> />
@@ -322,6 +301,7 @@ class UiTab extends React.Component {
</div> </div>
<div styleName='group-section-control'> <div styleName='group-section-control'>
<select <select
disabled={!config.ui.enableScheduleTheme}
value={config.ui.scheduledTheme} value={config.ui.scheduledTheme}
onChange={e => this.handleUIChange(e)} onChange={e => this.handleUIChange(e)}
ref='uiScheduledTheme' ref='uiScheduledTheme'
@@ -361,6 +341,7 @@ class UiTab extends React.Component {
styleName='rs-label' styleName='rs-label'
>{`End: ${this.formatTime(config.ui.scheduleEnd)}`}</span> >{`End: ${this.formatTime(config.ui.scheduleEnd)}`}</span>
<input <input
disabled={!config.ui.enableScheduleTheme}
id='rs-range-line-1' id='rs-range-line-1'
styleName='rs-range' styleName='rs-range'
type='range' type='range'
@@ -369,7 +350,7 @@ class UiTab extends React.Component {
max='1440' max='1440'
step='5' step='5'
ref='scheduleEnd' ref='scheduleEnd'
onChange={e => this.handleSlider(e, 1)} onChange={e => this.handleUIChange(e)}
/> />
</div> </div>
<div styleName='range-slider' id='secondRow'> <div styleName='range-slider' id='secondRow'>
@@ -378,6 +359,7 @@ class UiTab extends React.Component {
styleName='rs-label' styleName='rs-label'
>{`Start: ${this.formatTime(config.ui.scheduleStart)}`}</span> >{`Start: ${this.formatTime(config.ui.scheduleStart)}`}</span>
<input <input
disabled={!config.ui.enableScheduleTheme}
id='rs-range-line-2' id='rs-range-line-2'
styleName='rs-range' styleName='rs-range'
type='range' type='range'
@@ -386,7 +368,7 @@ class UiTab extends React.Component {
max='1440' max='1440'
step='5' step='5'
ref='scheduleStart' ref='scheduleStart'
onChange={e => this.handleSlider(e, 2)} onChange={e => this.handleUIChange(e)}
/> />
</div> </div>
<div styleName='box-minmax'> <div styleName='box-minmax'>