From efb6316ba06f44970540126d305497b8af78621f Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 24 May 2017 17:58:03 +0100 Subject: [PATCH] Implement default welcome page and allow custom URL /w config counterpart to https://github.com/matrix-org/matrix-react-sdk/pull/922 --- config.sample.json | 3 ++- res/home.html | 9 +++++++++ scripts/copy-res.js | 1 + src/components/structures/BottomLeftMenu.js | 17 ++++------------- src/components/structures/HomePage.js | 15 ++++++++++++--- src/components/structures/LeftPanel.js | 3 +-- 6 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 res/home.html diff --git a/config.sample.json b/config.sample.json index 9be92fa7..f26a6553 100644 --- a/config.sample.json +++ b/config.sample.json @@ -11,5 +11,6 @@ "matrix.org" ] }, - "welcomeUserId": "@RiotBot:matrix.org" + "welcomeUserId": "@RiotBot:matrix.org", + "welcomePageUrl": "https://about.riot.im" } diff --git a/res/home.html b/res/home.html new file mode 100644 index 00000000..ddcfb0e8 --- /dev/null +++ b/res/home.html @@ -0,0 +1,9 @@ + + + + Riot - Home + + +
Welcome to Riot
+ + \ No newline at end of file diff --git a/scripts/copy-res.js b/scripts/copy-res.js index d3a2ee5e..c1779259 100755 --- a/scripts/copy-res.js +++ b/scripts/copy-res.js @@ -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"], diff --git a/src/components/structures/BottomLeftMenu.js b/src/components/structures/BottomLeftMenu.js index f378cac6..f357bede 100644 --- a/src/components/structures/BottomLeftMenu.js +++ b/src/components/structures/BottomLeftMenu.js @@ -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 = ( - - - { this.getLabel("Welcome page", this.state.homeHover) } - - ); - } - return (
- { homeButton } + + + { this.getLabel("Welcome page", this.state.homeHover) } + { this.getLabel("Start chat", this.state.peopleHover) } diff --git a/src/components/structures/HomePage.js b/src/components/structures/HomePage.js index 8d44c90a..4f93eaae 100644 --- a/src/components/structures/HomePage.js +++ b/src/components/structures/HomePage.js @@ -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 (
-