From 32f7b50bb5c62d27def3f2e6d2839511c0b8f9a9 Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Thu, 23 Jul 2015 09:39:29 -0400
Subject: adds predictive posting on the client

---
 web/react/components/post_body.jsx | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

(limited to 'web/react/components/post_body.jsx')

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>
         );
     }
-- 
cgit v1.2.3-1-g7c22

