Merge pull request #133 from matrix-org/kegan/version-stamp

Add MatrixChat.onNewVersion to trigger the new version bar
This commit is contained in:
Kegsay 2016-02-03 17:09:28 +00:00
commit 3c2e0c1928
2 changed files with 25 additions and 1 deletions

View file

@ -804,6 +804,13 @@ module.exports = React.createClass({
this.showScreen("settings");
},
onVersion: function(current, latest) {
this.setState({
version: current,
hasNewVersion: current !== latest
});
},
updateFavicon: function() {
var notifCount = 0;
@ -851,6 +858,7 @@ module.exports = React.createClass({
var RoomDirectory = sdk.getComponent('structures.RoomDirectory');
var MatrixToolbar = sdk.getComponent('globals.MatrixToolbar');
var GuestWarningBar = sdk.getComponent('globals.GuestWarningBar');
var NewVersionBar = sdk.getComponent('globals.NewVersionBar');
var ForgotPassword = sdk.getComponent('structures.login.ForgotPassword');
// needs to be before normal PageTypes as you are logged in technically
@ -880,7 +888,7 @@ module.exports = React.createClass({
right_panel = <RightPanel roomId={this.state.currentRoom} collapsed={this.state.collapse_rhs} />
break;
case this.PageTypes.UserSettings:
page_element = <UserSettings onClose={this.onUserSettingsClose} />
page_element = <UserSettings onClose={this.onUserSettingsClose} version={this.state.version} />
right_panel = <RightPanel collapsed={this.state.collapse_rhs}/>
break;
case this.PageTypes.CreateRoom:
@ -920,6 +928,19 @@ module.exports = React.createClass({
</div>
</div>
);
} else if (this.state.hasNewVersion) {
return (
<div className="mx_MatrixChat_wrapper">
<NewVersionBar />
<div className="mx_MatrixChat mx_MatrixChat_toolbarShowing">
<LeftPanel selectedRoom={this.state.currentRoom} collapsed={this.state.collapse_lhs} />
<main className="mx_MatrixChat_middlePanel">
{page_element}
</main>
{right_panel}
</div>
</div>
);
}
else {
return (

View file

@ -30,6 +30,7 @@ module.exports = React.createClass({
displayName: 'UserSettings',
propTypes: {
version: React.PropTypes.string,
onClose: React.PropTypes.func
},
@ -377,6 +378,8 @@ module.exports = React.createClass({
</div>
<div className="mx_UserSettings_advanced">
Version {this.state.clientVersion}
<br />
{this.props.version}
</div>
</div>