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 { Error, Success } = require('status-components.jsx') var CommentEditor = React.createClass({ getInitialState () { return { } }, componentDidMount () { this.init(this.props) }, componentWillReceiveProps (props) { this.init(props) }, init (props) { this.setState({ api: props.api }) }, handleChange (event) { var obj = {} obj[event.target.id] = event.target.value this.setState(obj) }, save () { var boards = this.props.api var comment = { text: this.state.text } this.setState({ loading: true }) boards.createComment(comment, this.props.parent, (err, hash) => { if (err) { this.setState({ loading: false, error: err }) } else { this.setState({ loading: false, success: true, hash }) } }) }, render () { if (this.state.error) { return } else if (this.state.loading) { return

Publishing Comment

} else if (this.state.success) { var url = '/@' + this.props.adminID + '/' + this.props.board + '/' + (this.props.post || this.props.parent) + '/' + this.state.hash return View } else { return