mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
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"
|
||||
]
|
||||
},
|
||||
"welcomeUserId": "@RiotBot:matrix.org"
|
||||
"welcomeUserId": "@RiotBot:matrix.org",
|
||||
"welcomePageUrl": "https://about.riot.im"
|
||||
}
|
||||
|
9
res/home.html
Normal file
9
res/home.html
Normal file
@ -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…
Reference in New Issue
Block a user