Skip to content

Commit

Permalink
fix bug with disabled save button (#3390)
Browse files Browse the repository at this point in the history
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
  • Loading branch information
CarinaWolli and CarinaWolli committed Jul 15, 2022
1 parent 5e81d9f commit 48916cf
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions apps/web/ee/components/workflows/WorkflowStepContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
return (
<Select
isSearchable={false}
className="mt-3 block w-full min-w-0 flex-1 rounded-sm sm:text-sm"
className="mt-3 block w-full min-w-0 flex-1 rounded-sm text-sm"
onChange={(val) => {
if (val) {
form.setValue("trigger", val.value);
Expand Down Expand Up @@ -134,7 +134,7 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
return (
<Select
isSearchable={false}
className="block min-w-0 flex-1 rounded-sm"
className="block min-w-0 flex-1 rounded-sm text-sm"
onChange={(val) => {
if (val) {
form.setValue("timeUnit", val.value);
Expand Down Expand Up @@ -177,31 +177,36 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
return (
<Select
isSearchable={false}
className="mt-3 block w-full min-w-0 flex-1 rounded-sm"
className="mt-3 block w-full min-w-0 flex-1 rounded-sm text-sm"
onChange={(val) => {
if (val) {
let counter = 0;
if (val.value === WorkflowActions.SMS_NUMBER) {
setIsPhoneNumberNeeded(true);
setEditNumberMode(true);
setEditCounter(editCounter + 1);
counter = counter + 1;
} else {
setIsPhoneNumberNeeded(false);
setEditNumberMode(false);
setEditCounter(editCounter - 1);
}

if (
form.getValues(`steps.${step.stepNumber - 1}.template`) ===
WorkflowTemplates.CUSTOM
) {
setEditEmailBodyMode(true);
counter = counter + 1;
}

if (
val.value === WorkflowActions.EMAIL_ATTENDEE ||
val.value === WorkflowActions.EMAIL_HOST
) {
setIsEmailSubjectNeeded(true);
if (!form.getValues(`steps.${step.stepNumber - 1}.emailSubject`)) {
setEditEmailBodyMode(true);
setEditCounter(editCounter + 1);
}
} else {
setIsEmailSubjectNeeded(false);
}
setEditCounter(counter);
form.setValue(`steps.${step.stepNumber - 1}.action`, val.value);
setErrorMessageNumber("");
setErrorMessageCustomInput("");
Expand Down Expand Up @@ -298,7 +303,7 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
if (isCustomTemplate) {
setEditEmailBodyMode(true);
setEditCounter(editCounter + 1);
} else {
} else if (editEmailBodyMode) {
setEditEmailBodyMode(false);
setEditCounter(editCounter - 1);
}
Expand Down

0 comments on commit 48916cf

Please sign in to comment.