var React = require('react')
var Markdown = require('markdown.jsx')
var Icon = require('icon.jsx')
var Clock = require('clock.jsx')
var Link = require('react-router').Link
var UserID = require('userID.jsx')
var Comment = React.createClass({
getInitialState: function(){
return { moment: false }
},
componentDidMount: function(){
require.ensure(['moment'],_ => {
if(this.isMounted()) this.setState({ moment: require('moment') })
})
},
getPermalink: function(){
if(this.props.adminID && this.props.board && this.props.post && this.props.comment.hash){
return
Permalink
}
},
getParentlink: function(){
if(this.props.showParent && this.props.comment.parent && this.props.comment.parent !== this.props.post){
return
Parent
}
},
getComments: function(){
return
},
render: function(){
if(this.props.comment){
return
{this.getPermalink()}
{this.getParentlink()}
{this.getComments()}
} else {
return
Invalid Comment
}
}
})
var Comments = React.createClass({
getInitialState: function(){
return { comments: [] }
},
componentDidMount: function(){
var boards = this.props.api
if(boards){
boards.getEventEmitter().on('comment for '+this.props.parent,cmnt => {
if(this.isMounted()) this.setState({ comments: this.state.comments.concat(cmnt) })
})
if(boards.isInit && this.isMounted()){
boards.getCommentsFor(this.props.parent,this.props.board,this.props.adminID)
}
boards.getEventEmitter().on('init', err => {
if(!err && this.isMounted())
boards.getCommentsFor(this.props.parent,this.props.board,this.props.adminID)
})
}
},
getComments: function(){
if(this.state.comments.length > 0){
return this.state.comments.map(cmnt => () )
}
else return
},
render: function(){
return {this.getComments()}
}
})
module.exports = { Comment, Comments }