More random tweaks

- Make onBlur reset the EditText to show that it hasn't submitted it.
- Add the user ID of the logged in user to Advanced.
- Remove remnants of the Save/Cancel buttons.
This commit is contained in:
Kegan Dougal 2015-12-23 16:02:18 +00:00
parent 72b8cf1be2
commit 19bd39b066
3 changed files with 20 additions and 19 deletions

View file

@ -40,7 +40,7 @@ module.exports = React.createClass({
avatarUrl: null,
threePids: [],
clientVersion: version,
phase: "UserSettings.LOADING", // LOADING, DISPLAY, SAVING
phase: "UserSettings.LOADING", // LOADING, DISPLAY
};
},
@ -71,13 +71,15 @@ module.exports = React.createClass({
componentDidMount: function() {
this.dispatcherRef = dis.register(this.onAction);
this._me = MatrixClientPeg.get().credentials.userId;
},
componentWillUnmount: function() {
dis.unregister(this.dispatcherRef);
},
onSaveClicked: function(ev) {
/*
onSaveClicked: function(ev) { // XXX unused
var self = this;
var savePromises = [];
@ -116,7 +118,7 @@ module.exports = React.createClass({
description: error.toString()
});
});
},
}, */
onAction: function(payload) {
if (payload.action === "notifier_enabled") {
@ -189,14 +191,12 @@ module.exports = React.createClass({
},
render: function() {
var Loader = sdk.getComponent("elements.Spinner");
var saving;
switch (this.state.phase) {
case "UserSettings.LOADING":
return <Loader />
case "UserSettings.SAVING":
saving = <Loader />
// intentional fall through
var Loader = sdk.getComponent("elements.Spinner");
return (
<Loader />
);
case "UserSettings.DISPLAY":
break; // quit the switch to return the common state
default:
@ -209,7 +209,7 @@ module.exports = React.createClass({
return (
<div className="mx_UserSettings">
<RoomHeader simpleHeader="Settings" onCancelClick={ this.props.onClose } />
<RoomHeader simpleHeader="Settings" />
<h2>Profile</h2>
@ -290,14 +290,10 @@ module.exports = React.createClass({
<div className="mx_UserSettings_section">
<div className="mx_UserSettings_advanced">
Version {this.state.clientVersion}
Logged in as {this._me}
</div>
</div>
<div className="mx_UserSettings_save">
<div className="mx_UserSettings_spinner">{ saving }</div>
<div className="mx_UserSettings_button" onClick={this.onSaveClicked}>
Save and close
<div className="mx_UserSettings_advanced">
Version {this.state.clientVersion}
</div>
</div>
</div>

View file

@ -113,6 +113,10 @@ module.exports = React.createClass({
}
},
onBlur: function() {
this.cancelEdit();
},
render: function() {
var editable_el;
@ -125,7 +129,8 @@ module.exports = React.createClass({
} else if (this.state.phase == this.Phases.Edit) {
editable_el = (
<div>
<input type="text" defaultValue={this.state.value} onKeyUp={this.onKeyUp} onFocus={this.onFocus} onBlur={this.onFinish} placeholder={this.props.placeHolder} autoFocus/>
<input type="text" defaultValue={this.state.value}
onKeyUp={this.onKeyUp} onFocus={this.onFocus} onBlur={this.onBlur} placeholder={this.props.placeHolder} autoFocus/>
</div>
);
}

View file

@ -117,7 +117,7 @@ module.exports = React.createClass({
<div className={this.props.className}>
<div className={rowClassName}>
<div className={rowLabelClassName}>
<label htmlFor="passwordold">Old password</label>
<label htmlFor="passwordold">Current password</label>
</div>
<div className={rowInputClassName}>
<input id="passwordold" type="password" ref="old_input" />