mirror of https://github.com/vector-im/riot-web
quick and dirty support for custom welcome pages, with an example for geektime techfest
parent
34df6ea242
commit
a967ddd1cb
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
/** The types of page which can be shown by the LoggedInView */
|
/** The types of page which can be shown by the LoggedInView */
|
||||||
export default {
|
export default {
|
||||||
|
HomePage: "home_page",
|
||||||
RoomView: "room_view",
|
RoomView: "room_view",
|
||||||
UserSettings: "user_settings",
|
UserSettings: "user_settings",
|
||||||
CreateRoom: "create_room",
|
CreateRoom: "create_room",
|
||||||
|
|
|
@ -136,6 +136,7 @@ export default React.createClass({
|
||||||
var UserSettings = sdk.getComponent('structures.UserSettings');
|
var UserSettings = sdk.getComponent('structures.UserSettings');
|
||||||
var CreateRoom = sdk.getComponent('structures.CreateRoom');
|
var CreateRoom = sdk.getComponent('structures.CreateRoom');
|
||||||
var RoomDirectory = sdk.getComponent('structures.RoomDirectory');
|
var RoomDirectory = sdk.getComponent('structures.RoomDirectory');
|
||||||
|
var HomePage = sdk.getComponent('structures.HomePage');
|
||||||
var MatrixToolbar = sdk.getComponent('globals.MatrixToolbar');
|
var MatrixToolbar = sdk.getComponent('globals.MatrixToolbar');
|
||||||
var GuestWarningBar = sdk.getComponent('globals.GuestWarningBar');
|
var GuestWarningBar = sdk.getComponent('globals.GuestWarningBar');
|
||||||
var NewVersionBar = sdk.getComponent('globals.NewVersionBar');
|
var NewVersionBar = sdk.getComponent('globals.NewVersionBar');
|
||||||
|
@ -189,6 +190,15 @@ export default React.createClass({
|
||||||
/>
|
/>
|
||||||
if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/>
|
if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/>
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PageTypes.HomePage:
|
||||||
|
page_element = <HomePage
|
||||||
|
collapsedRhs={this.props.collapse_rhs}
|
||||||
|
config={this.props.config}
|
||||||
|
/>
|
||||||
|
if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/>
|
||||||
|
break;
|
||||||
|
|
||||||
case PageTypes.UserView:
|
case PageTypes.UserView:
|
||||||
page_element = null; // deliberately null for now
|
page_element = null; // deliberately null for now
|
||||||
right_panel = <RightPanel userId={this.props.viewUserId} opacity={this.props.sideOpacity} />
|
right_panel = <RightPanel userId={this.props.viewUserId} opacity={this.props.sideOpacity} />
|
||||||
|
|
|
@ -410,6 +410,10 @@ module.exports = React.createClass({
|
||||||
this._setPage(PageTypes.RoomDirectory);
|
this._setPage(PageTypes.RoomDirectory);
|
||||||
this.notifyNewScreen('directory');
|
this.notifyNewScreen('directory');
|
||||||
break;
|
break;
|
||||||
|
case 'view_home_page':
|
||||||
|
this._setPage(PageTypes.HomePage);
|
||||||
|
this.notifyNewScreen('home');
|
||||||
|
break;
|
||||||
case 'view_create_chat':
|
case 'view_create_chat':
|
||||||
this._createChat();
|
this._createChat();
|
||||||
break;
|
break;
|
||||||
|
@ -629,7 +633,12 @@ module.exports = React.createClass({
|
||||||
)[0].roomId;
|
)[0].roomId;
|
||||||
self.setState({ready: true, currentRoomId: firstRoom, page_type: PageTypes.RoomView});
|
self.setState({ready: true, currentRoomId: firstRoom, page_type: PageTypes.RoomView});
|
||||||
} else {
|
} else {
|
||||||
self.setState({ready: true, page_type: PageTypes.RoomDirectory});
|
if (self.props.config.home_page) {
|
||||||
|
self.setState({ready: true, page_type: PageTypes.HomePage});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.setState({ready: true, page_type: PageTypes.RoomDirectory});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.setState({ready: true, page_type: PageTypes.RoomView});
|
self.setState({ready: true, page_type: PageTypes.RoomView});
|
||||||
|
@ -649,7 +658,12 @@ module.exports = React.createClass({
|
||||||
} else {
|
} else {
|
||||||
// There is no information on presentedId
|
// There is no information on presentedId
|
||||||
// so point user to fallback like /directory
|
// so point user to fallback like /directory
|
||||||
self.notifyNewScreen('directory');
|
if (self.props.config.home_page) {
|
||||||
|
self.notifyNewScreen('home');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.notifyNewScreen('directory');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dis.dispatch({action: 'focus_composer'});
|
dis.dispatch({action: 'focus_composer'});
|
||||||
|
@ -703,6 +717,10 @@ module.exports = React.createClass({
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_user_settings',
|
action: 'view_user_settings',
|
||||||
});
|
});
|
||||||
|
} else if (screen == 'home') {
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'view_home_page',
|
||||||
|
});
|
||||||
} else if (screen == 'directory') {
|
} else if (screen == 'directory') {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room_directory',
|
action: 'view_room_directory',
|
||||||
|
|
|
@ -138,7 +138,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
const {
|
const {
|
||||||
name, idName, title, url, urls, width, height, resizeMethod,
|
name, idName, title, url, urls, width, height, resizeMethod,
|
||||||
defaultToInitialLetter,
|
defaultToInitialLetter, viewUserOnClick,
|
||||||
...otherProps
|
...otherProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue