Use localStorage mx_team_token to decide welcome page

This commit is contained in:
Luke Barnard 2017-02-02 11:12:43 +00:00
parent 40609d7da3
commit 4a34bee2dc
4 changed files with 10 additions and 29 deletions

View file

@ -115,7 +115,7 @@ module.exports = React.createClass({
var TintableSvg = sdk.getComponent('elements.TintableSvg');
var homeButton;
if (SdkConfig.get().home_page) {
if (window.localStorage.getItem('mx_team_token')) {
homeButton = (
<div className="mx_BottomLeftMenu_homePage" onClick={ this.onHomeClick } onMouseEnter={ this.onHomeMouseEnter } onMouseLeave={ this.onHomeMouseLeave } >
<TintableSvg src="img/icons-home.svg" width="25" height="25" />

View file

@ -16,8 +16,6 @@ limitations under the License.
'use strict';
import 'isomorphic-fetch';
var React = require("react");
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
var sdk = require('matrix-react-sdk');
@ -26,40 +24,17 @@ module.exports = React.createClass({
displayName: 'HomePage',
propTypes: {
config: React.PropTypes.object.isRequired,
teamToken: React.PropTypes.string.isRequired,
collapsedRhs: React.PropTypes.bool,
},
getInitialState: function() {
return {
page: ""
};
},
componentWillMount: function() {
fetch(this.props.config.home_page).then(
(response)=>{
return response.text();
},
(error)=>{
console.log(error);
this.setState({ page: "Couldn't load home page" });
}
).done(
(body)=>{
this.setState({ page: body });
}
);
},
render: function() {
// const SimpleRoomHeader = sdk.getComponent('rooms.SimpleRoomHeader');
// <SimpleRoomHeader title="Welcome to Riot" collapsedRhs={ this.props.collapsedRhs }/>
return (
<div className="mx_HomePage">
<div className="mx_HomePage_body" dangerouslySetInnerHTML={{ __html: this.state.page }}>
</div>
<iframe src={`http://localhost:7000/static/${this.props.teamToken}/welcome.html`} style={{width: '100%', border: 'none'}}/>
</div>
);
}

View file

@ -53,6 +53,7 @@
@import "./matrix-react-sdk/views/voip/_VideoView.scss";
@import "./vector-web/_fonts.scss";
@import "./vector-web/structures/_CompatibilityPage.scss";
@import "./vector-web/structures/_HomePage.scss";
@import "./vector-web/structures/_LeftPanel.scss";
@import "./vector-web/structures/_RightPanel.scss";
@import "./vector-web/structures/_RoomDirectory.scss";

View file

@ -20,6 +20,11 @@ limitations under the License.
margin-left: auto;
margin-right: auto;
}
.mx_HomePage iframe {
width: 100%;
height: 90%;
border: 0px;
}
.mx_HomePage_body {
margin-left: 63px;