Use ChangeDisplayNname / ChangeAvatar widgets to prompt for display name & avatar at signup.

Fixes #7.
This commit is contained in:
David Baker 2015-10-09 11:56:16 +01:00
parent ccc5f30c9b
commit c68ef38399
4 changed files with 90 additions and 6 deletions

View file

@ -51,9 +51,6 @@ module.exports = React.createClass({
<input type="file" onChange={this.onFileSelected}/>
{this.state.errorText}
</div>
<div className="mx_Dialog_buttons">
<button onClick={this.props.onFinished}>Cancel</button>
</div>
</div>
);
case this.Phases.Uploading:

View file

@ -30,7 +30,15 @@ module.exports = React.createClass({
editAvatar: function() {
var url = MatrixClientPeg.get().mxcUrlToHttp(this.state.avatarUrl);
var ChangeAvatar = sdk.getComponent('molecules.ChangeAvatar');
Modal.createDialog(ChangeAvatar, {initialAvatarUrl: url});
var avatarDialog = (
<div>
<ChangeAvatar initialAvatarUrl={url} />
<div className="mx_Dialog_buttons">
<button onClick={this.onAvatarDialogCancel}>Cancel</button>
</div>
</div>
);
this.avatarDialog = Modal.createDialogWithElement(avatarDialog);
},
addEmail: function() {
@ -55,6 +63,10 @@ module.exports = React.createClass({
this.logoutModal.closeDialog();
},
onAvatarDialogCancel: function() {
this.avatarDialog.close();
},
render: function() {
switch (this.state.phase) {
case this.Phases.Loading:
@ -80,7 +92,7 @@ module.exports = React.createClass({
<div className="mx_UserSettings_3pids">
{this.state.threepids.map(function(val) {
return <div>{val.address}</div>;
return <div key={val.address}>{val.address}</div>;
})}
</div>

View file

@ -19,10 +19,11 @@ limitations under the License.
var React = require('react');
var sdk = require('matrix-react-sdk')
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg')
var Loader = require("react-loader");
var RegisterController = require('matrix-react-sdk/lib/controllers/templates/Register')
var RegisterController = require('../../../../controllers/templates/Register')
module.exports = React.createClass({
DEFAULT_HS_URL: 'https://matrix.org',
@ -79,6 +80,10 @@ module.exports = React.createClass({
this.forceUpdate();
},
onProfileContinueClicked: function() {
this.onAccountReady();
},
componentForStep: function(step) {
switch (step) {
case 'initial':
@ -127,6 +132,18 @@ module.exports = React.createClass({
return (
<Loader />
);
} else if (this.state.step == 'profile') {
var ChangeDisplayName = sdk.getComponent('molecules.ChangeDisplayName');
var ChangeAvatar = sdk.getComponent('molecules.ChangeAvatar');
return (
<div className="mx_Login_profile">
Set a display name:
<ChangeDisplayName />
Upload an avatar:
<ChangeAvatar initialAvatarUrl={MatrixClientPeg.get().mxcUrlToHttp(this.state.avatarUrl)} />
<button onClick={this.onProfileContinueClicked}>Continue</button>
</div>
);
} else {
return (
<div>