Implement default welcome page and allow custom URL /w config
counterpart to https://github.com/matrix-org/matrix-react-sdk/pull/922
This commit is contained in:
parent
299dc7fe84
commit
efb6316ba0
|
@ -11,5 +11,6 @@
|
||||||
"matrix.org"
|
"matrix.org"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"welcomeUserId": "@RiotBot:matrix.org"
|
"welcomeUserId": "@RiotBot:matrix.org",
|
||||||
|
"welcomePageUrl": "https://about.riot.im"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Riot - Home</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Welcome to Riot</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -8,6 +8,7 @@
|
||||||
// "dest/b/...".
|
// "dest/b/...".
|
||||||
const COPY_LIST = [
|
const COPY_LIST = [
|
||||||
["res/manifest.json", "webapp"],
|
["res/manifest.json", "webapp"],
|
||||||
|
["res/home.html", "webapp"],
|
||||||
["res/{media,vector-icons}/**", "webapp"],
|
["res/{media,vector-icons}/**", "webapp"],
|
||||||
["res/flags/*", "webapp/flags/"],
|
["res/flags/*", "webapp/flags/"],
|
||||||
["src/skins/vector/{fonts,img}/**", "webapp"],
|
["src/skins/vector/{fonts,img}/**", "webapp"],
|
||||||
|
|
|
@ -27,7 +27,6 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
collapsed: React.PropTypes.bool.isRequired,
|
collapsed: React.PropTypes.bool.isRequired,
|
||||||
teamToken: React.PropTypes.string,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
|
@ -114,21 +113,13 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var TintableSvg = sdk.getComponent('elements.TintableSvg');
|
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 (
|
return (
|
||||||
<div className="mx_BottomLeftMenu">
|
<div className="mx_BottomLeftMenu">
|
||||||
<div className="mx_BottomLeftMenu_options">
|
<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 } >
|
<AccessibleButton className="mx_BottomLeftMenu_people" onClick={ this.onPeopleClick } onMouseEnter={ this.onPeopleMouseEnter } onMouseLeave={ this.onPeopleMouseLeave } >
|
||||||
<TintableSvg src="img/icons-people.svg" width="25" height="25" />
|
<TintableSvg src="img/icons-people.svg" width="25" height="25" />
|
||||||
{ this.getLabel("Start chat", this.state.peopleHover) }
|
{ this.getLabel("Start chat", this.state.peopleHover) }
|
||||||
|
|
|
@ -25,15 +25,24 @@ module.exports = React.createClass({
|
||||||
displayName: 'HomePage',
|
displayName: 'HomePage',
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
// URL base of the team server.
|
||||||
teamServerUrl: React.PropTypes.string.isRequired,
|
teamServerUrl: React.PropTypes.string.isRequired,
|
||||||
teamToken: React.PropTypes.string.isRequired,
|
// Team token. Optional. If unset, the homePageUrl will be used
|
||||||
collapsedRhs: React.PropTypes.bool,
|
teamToken: React.PropTypes.string,
|
||||||
|
// URL to use as the iFrame src. Defaults to /home.html.
|
||||||
|
homePageUrl: React.PropTypes.string,
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
let src = this.props.homePageUrl || '/home.html';
|
||||||
|
|
||||||
|
if (this.props.teamToken) {
|
||||||
|
src = `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_HomePage">
|
<div className="mx_HomePage">
|
||||||
<iframe src={`${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`}/>
|
<iframe src={src}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ var LeftPanel = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
collapsed: React.PropTypes.bool.isRequired,
|
collapsed: React.PropTypes.bool.isRequired,
|
||||||
teamToken: React.PropTypes.string,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
|
@ -129,7 +128,7 @@ var LeftPanel = React.createClass({
|
||||||
collapsed={this.props.collapsed}
|
collapsed={this.props.collapsed}
|
||||||
searchFilter={this.state.searchFilter}
|
searchFilter={this.state.searchFilter}
|
||||||
ConferenceHandler={VectorConferenceHandler} />
|
ConferenceHandler={VectorConferenceHandler} />
|
||||||
<BottomLeftMenu collapsed={this.props.collapsed} teamToken={this.props.teamToken}/>
|
<BottomLeftMenu collapsed={this.props.collapsed}/>
|
||||||
</aside>
|
</aside>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue