var React = require('react')
var Markdown = require('markdown.jsx')
var Link = require('react-router').Link
var Icon = require('icon.jsx')
module.exports = function(boardsAPI){
var GetIPFS = require('getipfs.jsx')(boardsAPI)
return React.createClass({
getInitialState: function(){
return { name: '...', boards: [], api: false }
},
componentDidMount: function(){
boardsAPI.use(boards => {
if(boards.isInit){
this.setState({ api: true, id: boards.id })
this.init()
}
var ee = boards.getEventEmitter()
ee.on('init',err => {
if(!err && this.isMounted()){
this.setState({ api: true, id: boards.id })
this.init()
}
})
})
},
init: function(){
if(this.state.init) return
boardsAPI.use(boards => {
var ee = boards.getEventEmitter()
if(boards.isInit || this.state.api){
var uid = this.props.params.userid
if(uid === 'me') uid = boards.id
console.log('About to ask for profile for',uid)
ee.on('boards for '+uid,l => {
if(!this.isMounted()) return true
this.setState({ boards: l })
})
boards.getProfile(uid,(err,res) => {
if(!this.isMounted()) return true
if(err){
this.setState({
name: