flip logic (comment from PR #18)
This commit is contained in:
@@ -40,9 +40,10 @@ class Contact extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleEmailEdit(e){
|
handleEmailEdit(e){
|
||||||
const isEmailInvalid = e.length >= EMAIL_MAX_LENGTH;
|
const isEmailValid = e.length < EMAIL_MAX_LENGTH;
|
||||||
if (isEmailInvalid) return;
|
if (isEmailValid){
|
||||||
this.setState({contactEmail: e});
|
this.setState({contactEmail: e});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -155,44 +155,48 @@ class IntentDetails extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleQuestionEdit (e, index) {
|
handleQuestionEdit (e, index) {
|
||||||
const isQuestionInvalid = e.length >= QUESTION_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e);
|
const isQuestionValid = e.length < QUESTION_MAX_LENGTH && /^[a-z,.' ]*$/i.test (e);
|
||||||
if (isQuestionInvalid) return;
|
if (isQuestionValid){
|
||||||
let newIntent = this.state.intent;
|
let newIntent = this.state.intent;
|
||||||
newIntent.questions[index] = e;
|
newIntent.questions[index] = e;
|
||||||
this.setState ({intent: newIntent});
|
this.setState ({intent: newIntent});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleIntentExplanationEdit (e, index) {
|
handleIntentExplanationEdit (e, index) {
|
||||||
const isExplanationInvalid = e.length >= INTENT_EXPLANATION_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e);
|
const isExplanationValid = e.length < INTENT_EXPLANATION_MAX_LENGTH && /^[a-z,.' ]*$/i.test (e);
|
||||||
if (isExplanationInvalid)
|
if (isExplanationValid){
|
||||||
return;
|
let newIntent = this.state.intent;
|
||||||
let newIntent = this.state.intent;
|
newIntent.intentExplanation = e;
|
||||||
newIntent.intentExplanation = e;
|
this.setState ({intent: newIntent});
|
||||||
this.setState ({intent: newIntent});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleAnswerEdit (e) {
|
handleAnswerEdit (e) {
|
||||||
const isAnswerInvalid = e.length >= ANSWER_MAX_LENGTH || !/^[a-z,.' ]*$/i.test (e);
|
const isAnswerValid = e.length < ANSWER_MAX_LENGTH && /^[a-z,.' ]*$/i.test (e);
|
||||||
if (isAnswerInvalid) return;
|
if (isAnswerValid){
|
||||||
let newIntent = this.state.intent;
|
let newIntent = this.state.intent;
|
||||||
newIntent.answer = e;
|
newIntent.answer = e;
|
||||||
this.setState ({intent: newIntent});
|
this.setState ({intent: newIntent});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleAnswerSourceEdit (e) {
|
handleAnswerSourceEdit (e) {
|
||||||
const isAnswerSourceInvalid = e.length >= ANSWER_MAX_LENGTH;
|
const isAnswerSourceValid = e.length < ANSWER_MAX_LENGTH;
|
||||||
if (isAnswerSourceInvalid) return;
|
if (isAnswerSourceValid){
|
||||||
let newIntent = this.state.intent;
|
let newIntent = this.state.intent;
|
||||||
newIntent.externalAnswerSource = e;
|
newIntent.externalAnswerSource = e;
|
||||||
this.setState ({intent: newIntent});
|
this.setState ({intent: newIntent});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleIntentNameEdit (e) {
|
handleIntentNameEdit (e) {
|
||||||
const isIntentNameInvalid = e.length >= INTENT_NAME_MAX_LENGTH || !/^[a-z]*$/i.test (e);
|
const isIntentNameValid = e.length < INTENT_NAME_MAX_LENGTH && /^[a-z]*$/i.test (e);
|
||||||
if (isIntentNameInvalid) return;
|
if (isIntentNameValid){
|
||||||
let newIntent = this.state.intent;
|
let newIntent = this.state.intent;
|
||||||
newIntent.intentName = e;
|
newIntent.intentName = e;
|
||||||
this.setState ({intent: newIntent});
|
this.setState ({intent: newIntent});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleExternalSourceSave (answerType) {
|
handleExternalSourceSave (answerType) {
|
||||||
|
|||||||
@@ -52,15 +52,17 @@ class LaunchRequest extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleNameEdit(e){
|
handleNameEdit(e){
|
||||||
const isInvocationNameInvalid = e.length === INVOCATION_NAME_MAX_LENGTH || !(/^[a-z,.' ]*$/.test(e));
|
const isInvocationNameValid = e.length < INVOCATION_NAME_MAX_LENGTH && (/^[a-z,.' ]*$/.test(e));
|
||||||
if (isInvocationNameInvalid) return;
|
if (isInvocationNameValid) {
|
||||||
this.setState({invocationName: e});
|
this.setState({invocationName: e});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleAnswerEdit(e){
|
handleAnswerEdit(e){
|
||||||
const isInvocationAnswerInvalid = e.length === INVOCATION_ANSWER_MAX_LENGTH || !(/^[a-z,.' ]*$/i.test(e));
|
const isInvocationAnswerValid = e.length < INVOCATION_ANSWER_MAX_LENGTH && (/^[a-z,.' ]*$/i.test(e));
|
||||||
if (isInvocationAnswerInvalid) return;
|
if (isInvocationAnswerValid){
|
||||||
this.setState({invocationAnswer: e});
|
this.setState({invocationAnswer: e});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user