From 7f8ba9fd56f4d55763f81e020b9dd50a566881c1 Mon Sep 17 00:00:00 2001 From: Yuya Ochiai Date: Wed, 23 Dec 2015 00:34:24 +0900 Subject: [PATCH] Use config file to show multiple teams --- src/browser/index.html | 2 +- src/browser/index.jsx | 101 +++++++++++++++++++++++++++++++---------- 2 files changed, 77 insertions(+), 26 deletions(-) diff --git a/src/browser/index.html b/src/browser/index.html index f231c32f..dd4e566f 100644 --- a/src/browser/index.html +++ b/src/browser/index.html @@ -13,7 +13,7 @@
- + \ No newline at end of file diff --git a/src/browser/index.jsx b/src/browser/index.jsx index 6f715ae2..56761f16 100644 --- a/src/browser/index.jsx +++ b/src/browser/index.jsx @@ -1,25 +1,76 @@ -'use strict'; - -var MainPage = React.createClass({ - render: function() { - var style = { - position: 'absolute', - top: 0, - right: 0, - bottom: 0, - left: 0 - }; - // 'disablewebsecurity' is necessary to display external images. - // However, it allows also CSS/JavaScript. - // So webview should use 'allowDisplayingInsecureContent' as same as BrowserWindow. - return ( - - ); - } -}); - - -ReactDOM.render( - , - document.getElementById('content') -); +'use strict'; + +const Grid = ReactBootstrap.Grid; +const Row = ReactBootstrap.Row; +const Col = ReactBootstrap.Col; +const Tabs = ReactBootstrap.Tabs; +const Tab = ReactBootstrap.Tab; + +const electron = require('electron'); +const remote = electron.remote; + +const settings = require('../common/settings'); + +var MainPage = React.createClass({ + getInitialState: function() { + return { + key: 0 + }; + }, + handleSelect: function(key) { + this.setState({ + key + }); + }, + visibleStyle: function(visible) { + var visibility = visible ? 'initial' : 'hidden'; + return { + position: 'absolute', + top: 42, + right: 0, + bottom: 0, + left: 0, + visibility: visibility + }; + }, + render: function() { + var tabs = this.props.teams.map(function(team, index) { + return (); + }); + var thisObj = this; + var views = this.props.teams.map(function(team, index) { + return () + }); + return ( + + + + { tabs } + + + + { views } + + + ); + } +}); + +var MattermostView = React.createClass({ + render: function() { + // 'disablewebsecurity' is necessary to display external images. + // However, it allows also CSS/JavaScript. + // So webview should use 'allowDisplayingInsecureContent' as same as BrowserWindow. + return ( + + ); + } +}); + +var configFile = remote.getGlobal('config-file'); +var config = settings.readFileSync(configFile); + +ReactDOM.render( + , + document.getElementById('content') +);