var React = require('react')
var Icon = require('icon.jsx')
var Link = require('react-router').Link
var Updater = React.createClass({
getInitialState () {
return {}
},
componentDidMount () {
this.checkForUpdates()
},
checkForUpdates () {
var v = window.location.pathname
var gateway = window.location.pathname.indexOf('/ipfs/') === 0 || window.location.pathname.indexOf('/ipns/') === 0
if (v !== '/ipns/boards.ydns.eu/' || !gateway) {
this.setState({ update: true })
}
},
render () {
if (this.state.update) {
return
} else return
}
})
module.exports = function (boardsAPI) {
return React.createClass({
getInitialState: function () {
return { loading: true }
},
componentDidMount () {
boardsAPI.use(boards => {
if (boards.isInit) this.setState({ api: boards, userid: boards.getMyID() })
boards.getEventEmitter().on('init', (err, limited) => {
if (!this.isMounted()) return
if (err) {
this.setState({ loading: false, api: false, limited })
} else {
this.setState({ api: boards, userid: boards.getMyID(), limited })
}
})
})
},
extraButtons: function () {
if (this.state.api) {
return
} else if (this.state.loading) {
return
} else if (this.state.limited) {
return
} else {
return
}
},
render: function () {
return (
)
}
})
}