From e5bf1e930a5b6ba0b3300b02daf792d65d795202 Mon Sep 17 00:00:00 2001
From: Jason <jason.daurus@gmail.com>
Date: Tue, 14 Jun 2016 23:52:00 +0800
Subject: [web] FlowView and ContentView

---
 web/src/js/components/Header.jsx | 67 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 web/src/js/components/Header.jsx

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

diff --git a/web/src/js/components/Header.jsx b/web/src/js/components/Header.jsx
new file mode 100644
index 00000000..93ca5154
--- /dev/null
+++ b/web/src/js/components/Header.jsx
@@ -0,0 +1,67 @@
+import React, { Component, PropTypes } from 'react'
+import { connect } from 'react-redux'
+import classnames from 'classnames'
+import { toggleEventLogVisibility } from '../ducks/eventLog'
+import MainMenu from './Header/MainMenu'
+import ViewMenu from './Header/ViewMenu'
+import OptionMenu from './Header/OptionMenu'
+import FileMenu from './Header/FileMenu'
+import FlowMenu from './Header/FlowMenu'
+import {setActiveMenu} from '../ducks/ui.js'
+
+class Header extends Component {
+    static entries = [MainMenu, ViewMenu, OptionMenu]
+
+    static propTypes = {
+        settings: PropTypes.object.isRequired,
+    }
+
+    handleClick(active, e) {
+        e.preventDefault()
+        this.props.setActiveMenu(active.title)
+       // this.props.updateLocation(active.route)
+       // this.setState({ active })
+    }
+
+    render() {
+        const { settings, updateLocation, query, selectedFlow, activeMenu} = this.props
+
+        let entries = [...Header.entries]
+        if(selectedFlow)
+            entries.push(FlowMenu)
+
+        const Active = _.find(entries, (e) => e.title == activeMenu)
+
+        return (
+            <header>
+                <nav className="nav-tabs nav-tabs-lg">
+                    <FileMenu/>
+                    {entries.map(Entry => (
+                        <a key={Entry.title}
+                           href="#"
+                           className={classnames({ active: Entry === Active})}
+                           onClick={e => this.handleClick(Entry, e)}>
+                            {Entry.title}
+                        </a>
+                    ))}
+                </nav>
+                <div className="menu">
+                    <Active
+                        settings={settings}
+                        updateLocation={updateLocation}
+                        query={query}
+                        />
+                </div>
+            </header>
+        )
+    }
+}
+export default connect(
+    (state) => ({
+        selectedFlow: state.flows.selected[0],
+        activeMenu: state.ui.activeMenu
+    }),
+    {
+        setActiveMenu,
+    }
+)(Header)
-- 
cgit v1.2.3

