diff --git a/src/component-index.js b/src/component-index.js index 456f8176f..4e6eefb6f 100644 --- a/src/component-index.js +++ b/src/component-index.js @@ -34,6 +34,8 @@ import structures$LeftPanel from './components/structures/LeftPanel'; structures$LeftPanel && (module.exports.components['structures.LeftPanel'] = structures$LeftPanel); import structures$RightPanel from './components/structures/RightPanel'; structures$RightPanel && (module.exports.components['structures.RightPanel'] = structures$RightPanel); +import structures$HomePage from './components/structures/HomePage'; +structures$HomePage && (module.exports.components['structures.HomePage'] = structures$HomePage); import structures$RoomDirectory from './components/structures/RoomDirectory'; structures$RoomDirectory && (module.exports.components['structures.RoomDirectory'] = structures$RoomDirectory); import structures$RoomSubList from './components/structures/RoomSubList'; diff --git a/src/components/structures/BottomLeftMenu.js b/src/components/structures/BottomLeftMenu.js index 1e352fa12..668ca5462 100644 --- a/src/components/structures/BottomLeftMenu.js +++ b/src/components/structures/BottomLeftMenu.js @@ -33,11 +33,17 @@ module.exports = React.createClass({ return({ directoryHover : false, roomsHover : false, + homeHover: false, peopleHover : false, settingsHover : false, + teamToken: null, }); }, + componentWillMount: function() { + this.teamToken = window.localStorage.getItem('mx_team_token'); + }, + // Room events onDirectoryClick: function() { dis.dispatch({ action: 'view_room_directory' }); @@ -63,6 +69,19 @@ module.exports = React.createClass({ this.setState({ roomsHover: false }); }, + // Home button events + onHomeClick: function() { + dis.dispatch({ action: 'view_home_page' }); + }, + + onHomeMouseEnter: function() { + this.setState({ homeHover: true }); + }, + + onHomeMouseLeave: function() { + this.setState({ homeHover: false }); + }, + // People events onPeopleClick: function() { dis.dispatch({ action: 'view_create_chat' }); @@ -99,9 +118,21 @@ module.exports = React.createClass({ render: function() { var TintableSvg = sdk.getComponent('elements.TintableSvg'); + + var homeButton; + if (this.state.teamToken) { + homeButton = ( + + + { this.getLabel("Welcome page", this.state.homeHover) } + + ); + } + return (
+ { homeButton } { this.getLabel("Start chat", this.state.peopleHover) } diff --git a/src/components/structures/HomePage.js b/src/components/structures/HomePage.js new file mode 100644 index 000000000..8d44c90a2 --- /dev/null +++ b/src/components/structures/HomePage.js @@ -0,0 +1,40 @@ +/* +Copyright 2016 OpenMarket Ltd +Copyright 2017 Vector Creations Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +'use strict'; + +import React from 'react'; +import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; +import sdk from 'matrix-react-sdk'; + +module.exports = React.createClass({ + displayName: 'HomePage', + + propTypes: { + teamServerUrl: React.PropTypes.string.isRequired, + teamToken: React.PropTypes.string.isRequired, + collapsedRhs: React.PropTypes.bool, + }, + + render: function() { + return ( +
+