diff --git a/browser/main/modals/PreferencesModal/ConfigTab.styl b/browser/main/modals/PreferencesModal/ConfigTab.styl index f34b19bc..3c35b32a 100644 --- a/browser/main/modals/PreferencesModal/ConfigTab.styl +++ b/browser/main/modals/PreferencesModal/ConfigTab.styl @@ -17,7 +17,9 @@ span first-child margin-top 18px padding-right 10px + padding-left 10px position relative + background $ui-backgroundColor div[id^="secondRow"] position absolute; @@ -70,7 +72,9 @@ div[id^="firstRow"] font-weight: normal box-sizing: border-box border: none - margin-bottom: -15px + margin-bottom: -5px + margin-top: -10px + width: 0px margin-left: 0px left: attr(value) color: $ui-text-color @@ -248,12 +252,10 @@ body[data-theme="dark"] select, .group-section-control-input colorDarkControl() - .box-minmax - colorDarkControl() - - .rs-range + .box-minmax, .rs-range, .rs-label colorDarkControl() + body[data-theme="solarized-dark"] .root color $ui-solarized-dark-text-color @@ -280,6 +282,8 @@ body[data-theme="solarized-dark"] .group-section-control select, .group-section-control-input colorSolarizedDarkControl() + .box-minmax, .rs-range, .rs-label + colorSolarizedDarkControl() body[data-theme="monokai"] .root @@ -307,6 +311,8 @@ body[data-theme="monokai"] .group-section-control select, .group-section-control-input colorMonokaiControl() + .box-minmax, .rs-range, .rs-label + colorMonokaiControl() body[data-theme="dracula"] .root @@ -333,4 +339,6 @@ body[data-theme="dracula"] colorDraculaControl() .group-section-control select, .group-section-control-input - colorDraculaControl() \ No newline at end of file + colorDraculaControl() + .box-minmax, .rs-range, .rs-label + colorDraculaControl() \ No newline at end of file diff --git a/browser/main/modals/PreferencesModal/UiTab.js b/browser/main/modals/PreferencesModal/UiTab.js index fe85008d..498ba897 100644 --- a/browser/main/modals/PreferencesModal/UiTab.js +++ b/browser/main/modals/PreferencesModal/UiTab.js @@ -44,6 +44,10 @@ class UiTab extends React.Component { } ipc.addListener('APP_SETTING_DONE', this.handleSettingDone) ipc.addListener('APP_SETTING_ERROR', this.handleSettingError) + + this.handleSlider(null, 1) + this.handleSlider(null, 2) + } componentWillUnmount () { @@ -65,6 +69,10 @@ class UiTab extends React.Component { const newConfig = { ui: { theme: this.refs.uiTheme.value, + enableScheduleTheme: this.refs.enableScheduleTheme.value, + scheduledTheme: this.refs.uiScheduledTheme.value, + scheduleStart: this.refs.scheduleStart.value, + scheduleEnd: this.refs.scheduleEnd.value, language: this.refs.uiLanguage.value, defaultNote: this.refs.defaultNote.value, showCopyNotification: this.refs.showCopyNotification.checked, @@ -162,7 +170,26 @@ class UiTab extends React.Component { }, 2000)() } - handleSlider (number) { + /** + * Gets the total number of minutes and returns a string in the HH:MM format + * @param {Number} time total number of minutes + */ + formatTime (time) { + let hour = Math.floor(time / 60) + let minute = time % 60 + + if (hour < 10) { + hour = '0' + hour + } + + if (minute < 10) { + minute = '0' + minute + } + + return `${hour}:${minute}` + } + + handleSlider (e, number) { const sliderID = 'rs-range-line-' + number const bulletID = 'rs-bullet-' + number @@ -170,10 +197,16 @@ class UiTab extends React.Component { const rangeBullet = document.getElementById(bulletID) if (rangeSlider && rangeBullet) { - rangeBullet.innerHTML = Math.floor(rangeSlider.value / 60) + ':' + rangeSlider.value % 60 + rangeBullet.innerHTML = this.formatTime(rangeSlider.value) const bulletPosition = (rangeSlider.value / rangeSlider.max) rangeBullet.style.left = (bulletPosition * 578) + 'px' } + + if (e) { + this.handleUIChange(e) + } else { + console.log('HEY') + } } render () { @@ -212,17 +245,48 @@ class UiTab extends React.Component { +