From 66e9db3713d54c67be1cf2bef1b0633db084649c Mon Sep 17 00:00:00 2001
From: Clemens <cle1000.cb@gmail.com>
Date: Thu, 18 Aug 2016 18:05:38 +0200
Subject: refactor contentviews, dropdown, filemenu and footer

---
 web/src/js/components/ContentView/ContentViews.jsx | 33 +++++++++++++++-------
 1 file changed, 23 insertions(+), 10 deletions(-)

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

diff --git a/web/src/js/components/ContentView/ContentViews.jsx b/web/src/js/components/ContentView/ContentViews.jsx
index cd593023..5b07969c 100644
--- a/web/src/js/components/ContentView/ContentViews.jsx
+++ b/web/src/js/components/ContentView/ContentViews.jsx
@@ -30,6 +30,12 @@ function Edit({ content, onChange }) {
 Edit = ContentLoader(Edit)
 
 class ViewServer extends Component {
+    static propTypes  = {
+        showFullContent: PropTypes.bool.isRequired,
+        maxLines: PropTypes.number.isRequired,
+        setContentViewDescription : PropTypes.func.isRequired,
+        setContent: PropTypes.func.isRequired
+    }
 
     componentWillMount(){
         this.setContentView(this.props)
@@ -40,6 +46,7 @@ class ViewServer extends Component {
             this.setContentView(nextProps)
         }
     }
+
     setContentView(props){
         try {
             this.data = JSON.parse(props.content)
@@ -50,25 +57,31 @@ class ViewServer extends Component {
         props.setContentViewDescription(props.contentView != this.data.description ? this.data.description : '')
         props.setContent(this.data.lines)
     }
+
     render() {
         const {content, contentView, message, maxLines} = this.props
         let lines = this.props.showFullContent ? this.data.lines : this.data.lines.slice(0, maxLines)
-        return <div>
+        return (
+            <div>
                 <pre>
                     {lines.map((line, i) =>
                         <div key={`line${i}`}>
-                            {line.map((tuple, j) =>
-                                <span key={`tuple${j}`} className={tuple[0]}>
-                                    {tuple[1]}
-                                </span>
-                            )}
+                            {line.map((element, j) => {
+                                let style, text = element
+                                return (
+                                    <span key={`tuple${j}`} className={style}>
+                                        {element}
+                                    </span>
+                                )
+                            })}
                         </div>
                     )}
                 </pre>
-            {ViewImage.matches(message) &&
-            <ViewImage {...this.props} />
-            }
-        </div>
+                {ViewImage.matches(message) &&
+                <ViewImage {...this.props} />
+                }
+            </div>
+        )
     }
 
 }
-- 
cgit v1.2.3

