a few more navigation fixes

This commit is contained in:
or-else
2018-04-23 20:44:24 -07:00
parent 8148d42ba7
commit 15ffade573
+21 -29
View File
@@ -1456,7 +1456,7 @@
view === 'cred' ? view === 'cred' ?
<ValidationView <ValidationView
onSubmit={this.props.onValidateCredentials} onSubmit={this.props.onValidateCredentials}
validation={this.props.validation} credMethod={this.props.credMethod}
onCancel={this.props.onCancel} onCancel={this.props.onCancel}
onError={this.props.onError} /> : onError={this.props.onError} /> :
@@ -2420,12 +2420,12 @@
handleSubmit: function(e) { handleSubmit: function(e) {
e.preventDefault(); e.preventDefault();
if (this.state.code && this.state.code.trim()) { if (this.state.code && this.state.code.trim()) {
this.props.onSubmit(this.props.validation[0], this.state.code.trim()); this.props.onSubmit(this.props.credMethod[0], this.state.code.trim());
} }
}, },
render: function() { render: function() {
var methods = {'email': 'email', 'tel': 'phone'}; var methods = {'email': 'email', 'tel': 'phone'};
var method = methods[this.props.validation[0]] || this.props.validation[0]; var method = methods[this.props.credMethod[0]] || this.props.credMethod[0];
return ( return (
<div className="panel-form"> <div className="panel-form">
<div className="panel-form-row"> <div className="panel-form-row">
@@ -3120,8 +3120,8 @@
title: '', title: '',
avatar: null, avatar: null,
scrollPosition: 0, scrollPosition: 0,
readOnly: this.props.acs ? !this.props.acs.isWriter() : false, readOnly: this.props.acs ? !this.props.acs.isWriter() : true,
writeOnly: this.props.acs ? !this.props.acs.isReader() : false, writeOnly: this.props.acs ? !this.props.acs.isReader() : true,
typingIndicator: false, typingIndicator: false,
imagePreview: null imagePreview: null
}; };
@@ -3209,8 +3209,8 @@
} }
this.setState({ this.setState({
readOnly: props.acs ? !props.acs.isWriter() : false, readOnly: props.acs ? !props.acs.isWriter() : true,
writeOnly: props.acs ? !props.acs.isReader() : false writeOnly: props.acs ? !props.acs.isReader() : true
}); });
if (!topic.isSubscribed() && tryToResubscribe) { if (!topic.isSubscribed() && tryToResubscribe) {
@@ -3223,6 +3223,12 @@
.withTags() .withTags()
.build()).catch(function(err){ .build()).catch(function(err){
instance.props.onError(err.message, "err"); instance.props.onError(err.message, "err");
instance.setState({
title: "Not found",
avatar: null,
readOnly: true,
writeOnly: true
});
}); });
} }
}, },
@@ -3761,7 +3767,7 @@
serverVersion: 'no connection', serverVersion: 'no connection',
contactsSearchQuery: '', contactsSearchQuery: '',
foundContacts: [], foundContacts: [],
validation: [] credMethod: []
}; };
}, },
componentDidMount: function() { componentDidMount: function() {
@@ -3821,26 +3827,12 @@
} }
} }
// Additional parameters of panels. // Additional parameters of panels.
for (var key in hash.params) { this.setState({
if (hash.params.hasOwnProperty(key)) { credCode: hash.params.code,
switch (key) { credMethod: hash.params.cred,
case 'code': showInfoPanel: hash.params.info,
console.log("Validation code=", hash.params[key]); newTopicTabSelected: hash.params.tab
break; });
case 'cred':
this.setState({validation: hash.params[key]});
break;
case 'info':
console.log("InfoView open?", hash.params[key]);
break;
case 'tab':
console.log("NewTopic tab=", hash.params[key]);
break;
default:
console.log("Unknown parameter", key, hash.params[key]);
}
}
}
}, },
handleOnline: function(online) { handleOnline: function(online) {
@@ -4364,7 +4356,7 @@
errorText={this.state.errorText} errorText={this.state.errorText}
errorLevel={this.state.errorLevel} errorLevel={this.state.errorLevel}
topicSelected={this.state.topicSelected} topicSelected={this.state.topicSelected}
validation={this.state.validation} credMethod={this.state.credMethod}
serverAddress={this.state.serverAddress} serverAddress={this.state.serverAddress}
onConnectionSettings={this.handleConnectionSettings} onConnectionSettings={this.handleConnectionSettings}