1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00
Files
Boostnote/browser/main/MainPage.js
2015-12-13 14:22:45 +09:00

36 lines
836 B
JavaScript

const electron = require('electron')
const ipc = electron.ipcRenderer
import React, { PropTypes } from 'react'
export default class MainContainer extends React.Component {
constructor (props) {
super(props)
this.state = {updateAvailable: false}
}
componentDidMount () {
ipc.on('update-available', function (message) {
this.setState({updateAvailable: true})
}.bind(this))
}
updateApp () {
ipc.send('update-app', 'Deal with it.')
}
render () {
return (
<div className='Main'>
{this.state.updateAvailable ? (
<button onClick={this.updateApp} className='appUpdateButton'><i className='fa fa-cloud-download'/> Update available!</button>
) : null}
{this.props.children}
</div>
)
}
}
MainContainer.propTypes = {
children: PropTypes.element
}