From 42895f4fec0f914d2ca3696c6962830140610e6e Mon Sep 17 00:00:00 2001
From: Maximilian Hils <git@maximilianhils.com>
Date: Wed, 25 Oct 2017 15:25:41 +0200
Subject: [web] minor fixes and cleanup

---
 web/src/js/components/MainView.jsx | 55 ++++++++++----------------------------
 1 file changed, 14 insertions(+), 41 deletions(-)

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

diff --git a/web/src/js/components/MainView.jsx b/web/src/js/components/MainView.jsx
index e2bedc88..03bfce7f 100644
--- a/web/src/js/components/MainView.jsx
+++ b/web/src/js/components/MainView.jsx
@@ -1,54 +1,27 @@
-import React, { Component } from 'react'
+import React from 'react'
 import PropTypes from 'prop-types'
 import { connect } from 'react-redux'
 import Splitter from './common/Splitter'
 import FlowTable from './FlowTable'
 import FlowView from './FlowView'
-import * as flowsActions from '../ducks/flows'
 
-class MainView extends Component {
-
-    static propTypes = {
-        highlight: PropTypes.string,
-        sort: PropTypes.object,
-    }
+MainView.propTypes = {
+    hasSelection: PropTypes.bool.isRequired,
+}
 
-    render() {
-        const { flows, selectedFlow, highlight } = this.props
-        return (
-            <div className="main-view">
-                <FlowTable
-                    ref="flowTable"
-                    flows={flows}
-                    selected={selectedFlow}
-                    highlight={highlight}
-                    onSelect={this.props.selectFlow}
-                />
-                {selectedFlow && [
-                    <Splitter key="splitter"/>,
-                    <FlowView
-                        key="flowDetails"
-                        ref="flowDetails"
-                        tab={this.props.tab}
-                        updateFlow={data => this.props.updateFlow(selectedFlow, data)}
-                        flow={selectedFlow}
-                    />
-                ]}
-            </div>
-        )
-    }
+function MainView({ hasSelection }) {
+    return (
+        <div className="main-view">
+            <FlowTable/>
+            {hasSelection && <Splitter key="splitter"/>}
+            {hasSelection && <FlowView key="flowDetails"/>}
+        </div>
+    )
 }
 
 export default connect(
     state => ({
-        flows: state.flows.view,
-        filter: state.flows.filter,
-        highlight: state.flows.highlight,
-        selectedFlow: state.flows.byId[state.flows.selected[0]],
-        tab: state.ui.flow.tab,
+        hasSelection: !!state.flows.byId[state.flows.selected[0]]
     }),
-    {
-        selectFlow: flowsActions.select,
-        updateFlow: flowsActions.update,
-    }
+    {}
 )(MainView)
-- 
cgit v1.2.3

