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

Correction UiTab

This commit is contained in:
Paul Rosset
2017-12-01 19:03:04 +00:00
parent c86e451198
commit d1e5781c24
4 changed files with 13 additions and 17 deletions

View File

@@ -63,7 +63,7 @@ class StatusBar extends React.Component {
{status.updateReady
? <button onClick={this.updateApp} styleName='update'>
<i styleName='update-icon' className='fa fa-cloud-download' /> Ready to Update!
</button>
</button>
: null
}
</div>

View File

@@ -79,9 +79,9 @@ class HotkeyTab extends React.Component {
this.props.haveToSave(null)
} else {
this.props.haveToSave({
tab: "Hotkey",
type: 'warning',
message: 'You have to save!'
tab: 'Hotkey',
type: 'warning',
message: 'You have to save!'
})
}
}

View File

@@ -38,16 +38,12 @@ class UiTab extends React.Component {
message: err.message != null ? err.message : 'Error occurs!'
}})
}
if (JSON.parse(localStorage.getItem('config'))) {
const {ui, editor, preview} = JSON.parse(localStorage.getItem('config'))
this.currentConfig = {ui, editor, preview}
}
ipc.addListener('APP_SETTING_DONE', this.handleSettingDone)
ipc.addListener('APP_SETTING_ERROR', this.handleSettingError)
}
componentWillMount () {
CodeMirror.autoLoadMode(ReactCodeMirror, 'javascript')
CodeMirror.autoLoadMode(ReactCodeMirror, 'javascript')
}
componentWillUnmount () {
@@ -96,18 +92,20 @@ class UiTab extends React.Component {
if (newCodemirrorTheme !== codemirrorTheme) {
checkHighLight.setAttribute('href', `../node_modules/codemirror/theme/${newCodemirrorTheme.split(' ')[0]}.css`)
}
this.setState({ config: newConfig, codemirrorTheme: newCodemirrorTheme },
() => {
this.setState({ config: newConfig, codemirrorTheme: newCodemirrorTheme }, () => {
if (JSON.parse(localStorage.getItem('config'))) {
const {ui, editor, preview} = JSON.parse(localStorage.getItem('config'))
this.currentConfig = {ui, editor, preview}
if (JSON.stringify(this.currentConfig) === JSON.stringify(this.state.config)) {
this.props.haveToSave(null)
} else {
this.props.haveToSave({
tab: "UI",
tab: 'UI',
type: 'warning',
message: 'You have to save!'
})
}
}
})
}

View File

@@ -111,7 +111,7 @@ class Preferences extends React.Component {
const navButtons = tabs.map((tab) => {
const isActive = this.state.currentTab === tab.target
const isOk = typeof tab[tab.label] !== "undefined" && tab[tab.label] !== null
const isOk = typeof tab[tab.label] !== 'undefined' && tab[tab.label] !== null
return (
<button styleName={isActive
? 'nav-button--active'
@@ -123,9 +123,7 @@ class Preferences extends React.Component {
<span styleName='nav-button-label'>
{tab.label}
</span>
{isOk && tab.label === tab[tab.label].tab
? <p styleName={`saving--${tab[tab.label].type}`}>{tab[tab.label].message}</p>
: null}
{isOk && tab.label === tab[tab.label].tab ? <p styleName={`saving--${tab[tab.label].type}`}>{tab[tab.label].message}</p> : null}
</button>
)
})