add fancy changelog dialog

This commit is contained in:
Aviral Dasgupta 2016-08-16 03:30:26 +05:30
parent 9b5e5c9acb
commit be28a96d8d
5 changed files with 135 additions and 14 deletions

View file

@ -17,20 +17,36 @@ limitations under the License.
'use strict';
var React = require('react');
var sdk = require('matrix-react-sdk')
var sdk = require('matrix-react-sdk');
import Modal from 'matrix-react-sdk/lib/Modal';
module.exports = React.createClass({
displayName: 'NewVersionBar',
export default function NewVersionBar(props) {
const onChangelogClicked = () => {
const ChangelogDialog = sdk.getComponent('dialogs.ChangelogDialog');
console.log(props);
Modal.createDialog(ChangelogDialog, {
version: props.version,
newVersion: props.newVersion,
onFinished: (update) => {
if(update) {
window.location.reload();
}
}
});
};
render: function() {
return (
<div className="mx_MatrixToolbar">
<img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="/!\"/>
<div>
A new version of Vector is available. Refresh your browser.
</div>
return (
<div className="mx_MatrixToolbar">
<img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="/!\"/>
<div style={{flex: 1}}>
A new version of Vector is available. Refresh your browser.
</div>
);
}
});
<button style={{marginRight: 16}} onClick={onChangelogClicked}>Changelog</button>
</div>
);
}
NewVersionBar.propTypes = {
version: React.PropTypes.string.isRequired,
newVersion: React.PropTypes.string.isRequired,
};