proxy-based Twister client written with react-js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.8 KiB

9 years ago
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var PostContent = require("../common/PostContent.js");
module.exports = ReplyModalButton = React.createClass({
getInitialState: function () {
return {
isModalOpen: false
};
},
handleToggle: function () {
this.setState({
isModalOpen: !this.state.isModalOpen
});
},
9 years ago
handleReply: function (msg) {
9 years ago
if (!msg) {
console.log("empty post was passed as new post")
return;
}
Twister.getAccount(this.props.activeAccount).reply(
this.props.replyUsername,
this.props.replyPostId,
msg,
function(post){
var event = new CustomEvent('newpostbyuser',{detail: post});
//alert("scrolled to bottom")
window.dispatchEvent(event);
});
9 years ago
9 years ago
this.handleToggle();
//React.findDOMNode(this.refs.msg).value = '';
return;
},
render: function() {
return (
9 years ago
<a onClick={this.handleToggle} className="link-button-gray">
<Glyphicon glyph='arrow-left' />
<Modal bsStyle='primary' show={this.state.isModalOpen} onHide={this.handleToggle}>
<Modal.Header>
<Glyphicon glyph='arrow-left'/>
</Modal.Header>
<Modal.Body>
<strong>{this.props.replyUserFullname}</strong>
9 years ago
<PostContent content={this.props.originalMsg}/>
9 years ago
<PostComposer onSubmit={this.handleReply} />
</Modal.Body>
</Modal>
</a>
9 years ago
);
}
});