diff --git a/lib/boards-api.js b/lib/boards-api.js index 6b87d93..cdb054a 100644 --- a/lib/boards-api.js +++ b/lib/boards-api.js @@ -551,4 +551,8 @@ BoardsAPI.prototype.getMyID = function () { return this.id } +BoardsAPI.prototype.getIPFS = function () { + return this.ipfs +} + module.exports = BoardsAPI diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx index ad13288..eb47360 100644 --- a/webapp/components/navbar.jsx +++ b/webapp/components/navbar.jsx @@ -2,20 +2,40 @@ var React = require('react') var Icon = require('icon.jsx') var Link = require('react-router').Link +var Updater = React.createClass({ + componentDidMount () { + if (this.props.api) this.checkForUpdates(this.props.api) + }, + componentWillReceiveProps (props) { + this.checkForUpdates(props.api) + }, + checkForUpdates (boards) { + var v = window.location.pathname + if (/\/ipfs\/./.test(v)) { + boards.getIPFS().path.resolve(v.substring(6), (err, res) => { + console.log('PATH RESOLVE', err, res) + }) + } + }, + render () { + return
+ } +}) + module.exports = function (boardsAPI) { return React.createClass({ getInitialState: function () { - return { api: false, loading: true } + return { loading: true } }, componentDidMount () { boardsAPI.use(boards => { - if (boards.isInit) this.setState({ api: true }) + if (boards.isInit) this.setState({ api: boards }) boards.getEventEmitter().on('init', err => { if (!this.isMounted()) return if (err) { this.setState({ loading: false, api: false }) } else { - this.setState({ api: true }) + this.setState({ api: boards }) } }) }) @@ -25,6 +45,7 @@ module.exports = function (boardsAPI) { return + } else if (this.state.loading) { return @@ -36,7 +57,7 @@ module.exports = function (boardsAPI) { return (
- {this.props.children ||

Boards

} +

Boards

{this.extraButtons()}