diff --git a/packages/features/ee/workflows/pages/index.tsx b/packages/features/ee/workflows/pages/index.tsx index f666161c8c..db54da1b11 100644 --- a/packages/features/ee/workflows/pages/index.tsx +++ b/packages/features/ee/workflows/pages/index.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/navigation"; import type { Dispatch, SetStateAction } from "react"; import { useState } from "react"; -import Shell from "@calcom/features/shell/Shell"; +import Shell, { ShellMain } from "@calcom/features/shell/Shell"; import { classNames } from "@calcom/lib"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; @@ -51,50 +51,51 @@ function WorkflowsPage() { }); return ( - { - createMutation.mutate({ teamId }); - }} - isPending={createMutation.isPending} - disableMobileButton={true} - onlyShowWithNoTeams={true} - /> - ) : null - }> + - <> - {queryRes.data?.totalCount ? ( -
- -
- createMutation.mutate({ teamId })} - isPending={createMutation.isPending} - disableMobileButton={true} - onlyShowWithTeams={true} - /> + { + createMutation.mutate({ teamId }); + }} + isPending={createMutation.isPending} + disableMobileButton={true} + onlyShowWithNoTeams={true} + /> + ) : null + }> + <> + {queryRes.data?.totalCount ? ( +
+ +
+ createMutation.mutate({ teamId })} + isPending={createMutation.isPending} + disableMobileButton={true} + onlyShowWithTeams={true} + /> +
-
- ) : null} - } - noResultsScreen={} - SkeletonLoader={SkeletonLoader}> - - - + ) : null} + } + noResultsScreen={} + SkeletonLoader={SkeletonLoader}> + + + + ); diff --git a/packages/features/ee/workflows/pages/workflow.tsx b/packages/features/ee/workflows/pages/workflow.tsx index dfe4ebaf37..816d376567 100644 --- a/packages/features/ee/workflows/pages/workflow.tsx +++ b/packages/features/ee/workflows/pages/workflow.tsx @@ -7,7 +7,7 @@ import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; -import Shell from "@calcom/features/shell/Shell"; +import Shell, { ShellMain } from "@calcom/features/shell/Shell"; import { classNames } from "@calcom/lib"; import { SENDER_ID } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; @@ -204,124 +204,132 @@ function WorkflowPage() { }); return session.data ? ( -
{ - let activeOnEventTypeIds: number[] = []; - let isEmpty = false; - let isVerified = true; + + + { + let activeOnEventTypeIds: number[] = []; + let isEmpty = false; + let isVerified = true; - values.steps.forEach((step) => { - const strippedHtml = step.reminderBody?.replace(/<[^>]+>/g, "") || ""; + values.steps.forEach((step) => { + const strippedHtml = step.reminderBody?.replace(/<[^>]+>/g, "") || ""; - const isBodyEmpty = !isSMSOrWhatsappAction(step.action) && strippedHtml.length <= 1; + const isBodyEmpty = !isSMSOrWhatsappAction(step.action) && strippedHtml.length <= 1; - if (isBodyEmpty) { - form.setError(`steps.${step.stepNumber - 1}.reminderBody`, { - type: "custom", - message: t("fill_this_field"), + if (isBodyEmpty) { + form.setError(`steps.${step.stepNumber - 1}.reminderBody`, { + type: "custom", + message: t("fill_this_field"), + }); + } + + if (step.reminderBody) { + step.reminderBody = translateVariablesToEnglish(step.reminderBody, { + locale: i18n.language, + t, + }); + } + if (step.emailSubject) { + step.emailSubject = translateVariablesToEnglish(step.emailSubject, { + locale: i18n.language, + t, + }); + } + isEmpty = !isEmpty ? isBodyEmpty : isEmpty; + + //check if phone number is verified + if ( + (step.action === WorkflowActions.SMS_NUMBER || + step.action === WorkflowActions.WHATSAPP_NUMBER) && + !verifiedNumbers?.find((verifiedNumber) => verifiedNumber.phoneNumber === step.sendTo) + ) { + isVerified = false; + + form.setError(`steps.${step.stepNumber - 1}.sendTo`, { + type: "custom", + message: t("not_verified"), + }); + } }); - } - if (step.reminderBody) { - step.reminderBody = translateVariablesToEnglish(step.reminderBody, { locale: i18n.language, t }); - } - if (step.emailSubject) { - step.emailSubject = translateVariablesToEnglish(step.emailSubject, { locale: i18n.language, t }); - } - isEmpty = !isEmpty ? isBodyEmpty : isEmpty; - - //check if phone number is verified - if ( - (step.action === WorkflowActions.SMS_NUMBER || step.action === WorkflowActions.WHATSAPP_NUMBER) && - !verifiedNumbers?.find((verifiedNumber) => verifiedNumber.phoneNumber === step.sendTo) - ) { - isVerified = false; - - form.setError(`steps.${step.stepNumber - 1}.sendTo`, { - type: "custom", - message: t("not_verified"), - }); - } - }); - - if (!isEmpty && isVerified) { - if (values.activeOn) { - activeOnEventTypeIds = values.activeOn.map((option) => { - return parseInt(option.value, 10); - }); - } - updateMutation.mutate({ - id: workflowId, - name: values.name, - activeOn: activeOnEventTypeIds, - steps: values.steps, - trigger: values.trigger, - time: values.time || null, - timeUnit: values.timeUnit || null, - }); - utils.viewer.workflows.getVerifiedNumbers.invalidate(); - } - }}> - - -
- ) - } - hideHeadingOnMobile - heading={ - session.data?.hasValidLicense && - isAllDataLoaded && ( -
-
- {workflow && workflow.name ? workflow.name : "untitled"} -
- {workflow && workflow.team && ( - - {workflow.team.name} - - )} - {readOnly && ( - - {t("readonly")} - - )} -
- ) - }> - - {!isError ? ( - <> - {isAllDataLoaded && user ? ( - <> - - - ) : ( - - )} - - ) : ( - - )} - -
- + if (!isEmpty && isVerified) { + if (values.activeOn) { + activeOnEventTypeIds = values.activeOn.map((option) => { + return parseInt(option.value, 10); + }); + } + updateMutation.mutate({ + id: workflowId, + name: values.name, + activeOn: activeOnEventTypeIds, + steps: values.steps, + trigger: values.trigger, + time: values.time || null, + timeUnit: values.timeUnit || null, + }); + utils.viewer.workflows.getVerifiedNumbers.invalidate(); + } + }}> + + + + ) + } + hideHeadingOnMobile + heading={ + isAllDataLoaded && ( +
+
+ {workflow && workflow.name ? workflow.name : "untitled"} +
+ {workflow && workflow.team && ( + + {workflow.team.name} + + )} + {readOnly && ( + + {t("readonly")} + + )} +
+ ) + }> + {!isError ? ( + <> + {isAllDataLoaded && user ? ( + <> + + + ) : ( + + )} + + ) : ( + + )} +
+ + +
) : ( <> );