Merge pull request #4015 from vector-im/luke/new-guest-access-default-welcome

Implement default welcome page and allow custom URL /w config
This commit is contained in:
Luke Barnard 2017-05-25 10:28:55 +01:00 committed by GitHub
commit 36ec156d2e
5 changed files with 28 additions and 18 deletions

9
res/home.html Normal file
View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Riot - Home</title>
</head>
<body>
<div>Welcome to Riot</div>
</body>
</html>

View File

@ -8,6 +8,7 @@
// "dest/b/...".
const COPY_LIST = [
["res/manifest.json", "webapp"],
["res/home.html", "webapp"],
["res/{media,vector-icons}/**", "webapp"],
["res/flags/*", "webapp/flags/"],
["src/skins/vector/{fonts,img}/**", "webapp"],

View File

@ -27,7 +27,6 @@ module.exports = React.createClass({
propTypes: {
collapsed: React.PropTypes.bool.isRequired,
teamToken: React.PropTypes.string,
},
getInitialState: function() {
@ -114,21 +113,13 @@ module.exports = React.createClass({
render: function() {
var TintableSvg = sdk.getComponent('elements.TintableSvg');
var homeButton;
if (this.props.teamToken) {
homeButton = (
<AccessibleButton className="mx_BottomLeftMenu_homePage" onClick={ this.onHomeClick } onMouseEnter={ this.onHomeMouseEnter } onMouseLeave={ this.onHomeMouseLeave } >
<TintableSvg src="img/icons-home.svg" width="25" height="25" />
{ this.getLabel("Welcome page", this.state.homeHover) }
</AccessibleButton>
);
}
return (
<div className="mx_BottomLeftMenu">
<div className="mx_BottomLeftMenu_options">
{ homeButton }
<AccessibleButton className="mx_BottomLeftMenu_homePage" onClick={ this.onHomeClick } onMouseEnter={ this.onHomeMouseEnter } onMouseLeave={ this.onHomeMouseLeave } >
<TintableSvg src="img/icons-home.svg" width="25" height="25" />
{ this.getLabel("Welcome page", this.state.homeHover) }
</AccessibleButton>
<AccessibleButton className="mx_BottomLeftMenu_people" onClick={ this.onPeopleClick } onMouseEnter={ this.onPeopleMouseEnter } onMouseLeave={ this.onPeopleMouseLeave } >
<TintableSvg src="img/icons-people.svg" width="25" height="25" />
{ this.getLabel("Start chat", this.state.peopleHover) }

View File

@ -25,15 +25,25 @@ module.exports = React.createClass({
displayName: 'HomePage',
propTypes: {
// URL base of the team server.
teamServerUrl: React.PropTypes.string.isRequired,
teamToken: React.PropTypes.string.isRequired,
collapsedRhs: React.PropTypes.bool,
// Team token. Optional. If set, used as to get the static homepage of the team
// associated. If unset, homePageUrl will be used.
teamToken: React.PropTypes.string,
// URL to use as the iFrame src. Defaults to /home.html.
homePageUrl: React.PropTypes.string,
},
render: function() {
let src = this.props.homePageUrl || '/home.html';
if (this.props.teamToken) {
src = `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`;
}
return (
<div className="mx_HomePage">
<iframe src={`${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`}/>
<iframe src={src}/>
</div>
);
}

View File

@ -30,7 +30,6 @@ var LeftPanel = React.createClass({
propTypes: {
collapsed: React.PropTypes.bool.isRequired,
teamToken: React.PropTypes.string,
},
getInitialState: function() {
@ -129,7 +128,7 @@ var LeftPanel = React.createClass({
collapsed={this.props.collapsed}
searchFilter={this.state.searchFilter}
ConferenceHandler={VectorConferenceHandler} />
<BottomLeftMenu collapsed={this.props.collapsed} teamToken={this.props.teamToken}/>
<BottomLeftMenu collapsed={this.props.collapsed}/>
</aside>
);
}