Implement default welcome page and allow custom URL /w config

counterpart to https://github.com/matrix-org/matrix-react-sdk/pull/922
pull/4015/head
Luke Barnard 5 years ago
parent 299dc7fe84
commit efb6316ba0
  1. 3
      config.sample.json
  2. 9
      res/home.html
  3. 1
      scripts/copy-res.js
  4. 17
      src/components/structures/BottomLeftMenu.js
  5. 15
      src/components/structures/HomePage.js
  6. 3
      src/components/structures/LeftPanel.js

@ -11,5 +11,6 @@
"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/...".
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"],

@ -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) }

@ -25,15 +25,24 @@ 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 unset, the 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>
);
}

@ -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>
);
}

Loading…
Cancel
Save