From 666017125ac9dc38200753cdbe86eeb21bd5864a Mon Sep 17 00:00:00 2001
From: Jason <jason.daurus@gmail.com>
Date: Fri, 8 Jul 2016 21:43:18 +0800
Subject: [web] add tests for main view and ui

---
 web/src/js/components/ContentView.jsx | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'web/src/js/components/ContentView.jsx')

diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx
index d6ee5497..6a982a5d 100644
--- a/web/src/js/components/ContentView.jsx
+++ b/web/src/js/components/ContentView.jsx
@@ -17,18 +17,19 @@ ContentView.propTypes = {
 
 ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2)
 
-function ContentView({ flow, message, contentView, selectView, displayLarge }) {
+function ContentView(props) {
+    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge } = props
 
     if (message.contentLength === 0) {
-        return <MetaViews.ContentEmpty {...this.props}/>
+        return <MetaViews.ContentEmpty {...props}/>
     }
 
     if (message.contentLength === null) {
-        return <MetaViews.ContentMissing {...this.props}/>
+        return <MetaViews.ContentMissing {...props}/>
     }
 
     if (!displayLarge && ContentView.isContentTooLarge(message)) {
-        return <MetaViews.ContentTooLarge {...this.props} onClick={() => this.props.setDisplayLarge(true)}/>
+        return <MetaViews.ContentTooLarge {...props} onClick={() => setDisplayLarge(true)}/>
     }
 
     const View = ContentViews[contentView]
-- 
cgit v1.2.3

