summaryrefslogtreecommitdiffstats
path: root/web/react/components/post_body.jsx
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-07-23 09:39:29 -0400
committerJoramWilander <jwawilander@gmail.com>2015-08-18 08:58:02 -0400
commit32f7b50bb5c62d27def3f2e6d2839511c0b8f9a9 (patch)
tree1203fd854bf7ea843a35ce52382b0846ffa3873a /web/react/components/post_body.jsx
parent4805608cc9cf79277f37b94bbe38398816469884 (diff)
downloadchat-32f7b50bb5c62d27def3f2e6d2839511c0b8f9a9.tar.gz
chat-32f7b50bb5c62d27def3f2e6d2839511c0b8f9a9.tar.bz2
chat-32f7b50bb5c62d27def3f2e6d2839511c0b8f9a9.zip
adds predictive posting on the client
Diffstat (limited to 'web/react/components/post_body.jsx')
-rw-r--r--web/react/components/post_body.jsx32
1 files changed, 22 insertions, 10 deletions
diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx
index 860c96d84..65e045344 100644
--- a/web/react/components/post_body.jsx
+++ b/web/react/components/post_body.jsx
@@ -59,23 +59,35 @@ module.exports = React.createClass({
postClass += " post-comment";
}
+ var loading;
+ if (post.did_fail) {
+ postClass += " post-fail";
+ loading = <a className="post-retry pull-right" href="#" onClick={this.props.retryPost}>Retry</a>;
+ } else if (post.is_loading) {
+ postClass += " post-waiting";
+ loading = <img className="post-loading-gif pull-right" src="/static/images/load.gif"/>;
+ }
+
var embed;
if (filenames.length === 0 && this.state.links) {
embed = utils.getEmbed(this.state.links[0]);
}
+ var fileAttachmentHolder = '';
+ if (filenames && filenames.length > 0) {
+ fileAttachmentHolder = (<FileAttachmentList
+ filenames={filenames}
+ modalId={'view_image_modal_' + post.id}
+ channelId={post.channel_id}
+ userId={post.user_id} />);
+ }
+
return (
<div className="post-body">
- { comment }
- <p key={post.id+"_message"} className={postClass}><span>{inner}</span></p>
- { filenames && filenames.length > 0 ?
- <FileAttachmentList
- filenames={filenames}
- modalId={"view_image_modal_" + post.id}
- channelId={post.channel_id}
- userId={post.user_id} />
- : "" }
- { embed }
+ {comment}
+ <p key={post.id+"_message"} className={postClass}>{loading}<span>{inner}</span></p>
+ {fileAttachmentHolder}
+ {embed}
</div>
);
}