chore: UX Fixes (#26643)

* Copy changes

* Move search bar inline with new button

* Get rid of no more results message

* Change hidden badge to (hidden)

* Remove Cal.ai badge from sidebar

* Add dropdown to create button when there is multiple options

* Fix delete dialog

* Saved filters updates

* More string fixes

* Switch members table to use names

* Fix member spacing

* Fix routing form identifier field

* Fix routing forms stuff

* Only show SMS hint on SMS options

* Make workflow delete button minimal

* Fix padding on workflow steps

* Remove min width on workflow title

* Fix delete workflow PR

* Fix org profile buttons

* Fix org profile screen partially scrolled down

* Improve logos & banner uploads

* Personal profile fixes

* Fix settings general view stuff

* Sentence case consistency

* Fix stuff I broke

* Fix fab

* Fix hidden translation string

* Fix text fields

* Make button small for solo users too

* fix: update E2E tests to match sentence case labels in routing forms

* fix: update tests to match sentence case label changes

- insights.e2e.ts: chart titles (14 strings)
- event-types.e2e.ts: Organizer phone number location
- EditLocationDialog.test.tsx: phone number labels

* fix: address Cubic AI review feedback (confidence 9+)

- Replace hardcoded text-gray-500 with text-muted in TextField.tsx hint section
- Replace text locator with data-testid in E2E test for location select

Co-Authored-By: unknown <>

* fix: update E2E tests for sentence case label changes

- Use data-testid selectors for location options (more reliable than text)
- Update field identifiers in routing-forms tests to match new labels
- Fix Long text selector in manage-booking-questions test

* fix: replace text locator with data-testid in manage-booking-questions E2E test

Replace fragile text="Long text" locator with resilient
page.getByTestId("select-option-textarea") selector per E2E best practices.

Addresses Cubic AI review feedback (confidence 9/10).

Co-Authored-By: unknown <>

* fix: use .last() for multiple location select items

---------

Co-authored-by: Pedro Castro <[email protected]>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-01-13 00:56:08 -05:00
1 parent 32d97fbea4
commit 7c66f33de2
31 files changed
+3350 -1887

No files matched your search

+151 -77
View File
@@ -25,7 +25,10 @@ import { Form } from "@calcom/ui/components/form";
import { Label } from "@calcom/ui/components/form";
import { TextField } from "@calcom/ui/components/form";
import { Icon } from "@calcom/ui/components/icon";
import { BannerUploader, ImageUploader } from "@calcom/ui/components/image-uploader";
import {
BannerUploader,
ImageUploader,
} from "@calcom/ui/components/image-uploader";
// if I include this in the above barrel import, I get a runtime error that the component is not exported.
import { OrgBanner } from "@calcom/ui/components/organization-banner";
import {
@@ -108,6 +111,13 @@ const OrgProfileView = ({
[error, router]
);
// Scroll to top when page loads
useEffect(() => {
if (!isPending && orgBranding && currentOrganisation) {
window.scrollTo(0, 0);
}
}, [isPending, orgBranding, currentOrganisation]);
if (isPending || !orgBranding || !currentOrganisation) {
return <SkeletonLoader />;
}
@@ -126,7 +136,8 @@ const OrgProfileView = ({
calVideoLogo: currentOrganisation?.calVideoLogo || "",
slug:
currentOrganisation?.slug ||
((currentOrganisation?.metadata as Prisma.JsonObject)?.requestedSlug as string) ||
((currentOrganisation?.metadata as Prisma.JsonObject)
?.requestedSlug as string) ||
"",
};
@@ -142,15 +153,18 @@ const OrgProfileView = ({
<div className="border-subtle flex rounded-b-md border border-t-0 px-4 py-8 sm:px-6">
<div className="grow">
<div>
<Label className="text-emphasis">{t("organization_name")}</Label>
<p className="text-default text-sm">{currentOrganisation?.name}</p>
<Label className="text-emphasis">
{t("organization_name")}
</Label>
<p className="text-default text-sm">
{currentOrganisation?.name}
</p>
</div>
{!isBioEmpty && (
<>
<Label className="text-emphasis mt-5">{t("about")}</Label>
<div
className=" text-subtle wrap-break-word text-sm [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600"
dangerouslySetInnerHTML={{
__html: markdownToSafeHTML(currentOrganisation.bio || ""),
}}
@@ -164,7 +178,8 @@ const OrgProfileView = ({
onClick={() => {
navigator.clipboard.writeText(orgBranding.fullDomain);
showToast("Copied to clipboard", "success");
}}>
}}
>
{t("copy_link_org")}
</LinkIconButton>
</div>
@@ -189,7 +204,10 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
const mutation = trpc.viewer.organizations.update.useMutation({
onError: (err) => {
// Handle JSON parsing errors from body size limit exceeded
if (err.message.includes("Unexpected token") && err.message.includes("Body excee")) {
if (
err.message.includes("Unexpected token") &&
err.message.includes("Body excee")
) {
showToast(t("converted_image_size_limit_exceed"), "error");
return;
}
@@ -239,40 +257,87 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
};
mutation.mutate(variables);
}}>
}}
>
<div className="border-subtle border-x px-4 py-8 sm:px-6">
<div className="flex items-center">
<div className="grid grid-cols-2 gap-8">
<Controller
control={form.control}
name="logoUrl"
render={({ field: { value, onChange } }) => {
const showRemoveLogoButton = value !== null;
return (
<>
<div className="flex items-center gap-4">
<Avatar
data-testid="profile-upload-logo"
alt={form.getValues("name")}
imageSrc={getPlaceholderAvatar(value, form.getValues("name"))}
imageSrc={getPlaceholderAvatar(
value,
form.getValues("name")
)}
size="lg"
/>
<div className="ms-4">
<div>
<div className="flex gap-2">
<ImageUploader
target="logo"
id="avatar-upload"
buttonMsg={t("upload_logo")}
handleAvatarChange={onChange}
imageSrc={getPlaceholderAvatar(value, form.getValues("name"))}
triggerButtonColor={showRemoveLogoButton ? "secondary" : "primary"}
imageSrc={getPlaceholderAvatar(
value,
form.getValues("name")
)}
triggerButtonColor="secondary"
/>
{showRemoveLogoButton && (
<Button color="secondary" onClick={() => onChange(null)}>
<Button color="minimal" onClick={() => onChange(null)}>
{t("remove")}
</Button>
)}
</div>
</div>
</>
</div>
);
}}
/>
<Controller
control={form.control}
name="calVideoLogo"
render={({ field: { value, onChange } }) => {
const showRemoveLogoButton = !!value;
return (
<div className="flex items-center gap-4">
<Avatar
alt="calVideoLogo"
imageSrc={value}
fallback={
<Icon name="plus" className="text-subtle h-6 w-6" />
}
size="lg"
/>
<div>
<div className="flex gap-2">
<ImageUploader
target="avatar"
id="cal-video-logo-upload"
buttonMsg={t("upload_cal_video_logo")}
handleAvatarChange={onChange}
imageSrc={value || undefined}
uploadInstruction={t(
"cal_video_logo_upload_instruction"
)}
triggerButtonColor="secondary"
testId="cal-video-logo"
/>
{showRemoveLogoButton && (
<Button color="minimal" onClick={() => onChange(null)}>
{t("remove")}
</Button>
)}
</div>
</div>
</div>
);
}}
/>
@@ -291,67 +356,72 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
data-testid="profile-upload-banner"
alt={`${defaultValues.name} Banner` || ""}
className="grid min-h-[150px] w-full place-items-center rounded-md sm:min-h-[200px]"
fallback={t("no_target", { target: "banner" })}
fallback={
!value ? (
<div className="flex flex-col items-center gap-3">
<p className="text-muted text-sm">
{t("no_target", { target: "banner" })}
</p>
<div className="hidden">
<BannerUploader
height={500}
width={1500}
target="banner"
uploadInstruction={t("org_banner_instructions", {
height: 500,
width: 1500,
})}
id="banner-upload-inline"
buttonMsg={t("upload_banner")}
handleAvatarChange={onChange}
imageSrc={value || undefined}
triggerButtonColor="secondary"
/>
</div>
<Button
color="secondary"
StartIcon="upload"
onClick={() => {
// Trigger the BannerUploader dialog
const triggerButton = document.querySelector(
'[data-testid="open-upload-banner-dialog"]'
) as HTMLButtonElement;
triggerButton?.click();
}}>
{t("upload_banner")}
</Button>
</div>
) : (
t("no_target", { target: "banner" })
)
}
imageSrc={value}
/>
<div className="ms-4">
<div className="flex gap-2">
<BannerUploader
height={500}
width={1500}
target="banner"
uploadInstruction={t("org_banner_instructions", { height: 500, width: 1500 })}
id="banner-upload"
buttonMsg={t("upload_banner")}
handleAvatarChange={onChange}
imageSrc={value || undefined}
triggerButtonColor={showRemoveBannerButton ? "secondary" : "primary"}
/>
{showRemoveBannerButton && (
<Button color="destructive" onClick={() => onChange(null)}>
{t("remove")}
</Button>
)}
{value && (
<div className="mt-2">
<div className="flex gap-2">
<BannerUploader
height={500}
width={1500}
target="banner"
uploadInstruction={t("org_banner_instructions", {
height: 500,
width: 1500,
})}
id="banner-upload"
buttonMsg={t("upload_banner")}
handleAvatarChange={onChange}
imageSrc={value || undefined}
triggerButtonColor="secondary"
/>
{showRemoveBannerButton && (
<Button color="minimal" onClick={() => onChange(null)}>
{t("remove")}
</Button>
)}
</div>
</div>
</div>
</>
);
}}
/>
</div>
<div className="mt-2 flex items-center">
<Controller
control={form.control}
name="calVideoLogo"
render={({ field: { value, onChange } }) => {
const showRemoveLogoButton = !!value;
return (
<>
<Avatar
alt="calVideoLogo"
imageSrc={value}
fallback={<Icon name="plus" className="text-subtle h-6 w-6" />}
size="lg"
/>
<div className="ms-4">
<div className="flex gap-2">
<ImageUploader
target="avatar"
id="cal-video-logo-upload"
buttonMsg={t("upload_cal_video_logo")}
handleAvatarChange={onChange}
imageSrc={value || undefined}
uploadInstruction={t("cal_video_logo_upload_instruction")}
triggerButtonColor={showRemoveLogoButton ? "secondary" : "primary"}
testId="cal-video-logo"
/>
{showRemoveLogoButton && (
<Button color="secondary" onClick={() => onChange(null)}>
{t("remove")}
</Button>
)}
</div>
</div>
)}
</>
);
}}
@@ -406,7 +476,8 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
size="sm"
type="button"
aria-label="copy organization id"
onClick={() => handleCopy(value.toString())}>
onClick={() => handleCopy(value.toString())}
>
<Icon name="copy" className="ml-1 h-4 w-4" />
</Button>
</Tooltip>
@@ -419,7 +490,9 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
<Label>{t("about")}</Label>
<Editor
getText={() => md.render(form.getValues("bio") || "")}
setText={(value: string) => form.setValue("bio", turndown(value), { shouldDirty: true })}
setText={(value: string) =>
form.setValue("bio", turndown(value), { shouldDirty: true })
}
excludedToolbarItems={["blockType"]}
disableLists
firstRender={firstRender}
@@ -435,7 +508,8 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
color="primary"
type="submit"
loading={mutation.isPending}
disabled={isDisabled}>
disabled={isDisabled}
>
{t("update")}
</Button>
</SectionBottomActions>
@@ -12,7 +12,13 @@ import { Avatar } from "@calcom/ui/components/avatar";
import { Form } from "@calcom/ui/components/form";
import { ToggleGroup, Select } from "@calcom/ui/components/form";
import { Icon } from "@calcom/ui/components/icon";
import { Sheet, SheetContent, SheetFooter, SheetHeader, SheetBody } from "@calcom/ui/components/sheet";
import {
Sheet,
SheetContent,
SheetFooter,
SheetHeader,
SheetBody,
} from "@calcom/ui/components/sheet";
import { Skeleton, Loader } from "@calcom/ui/components/skeleton";
import { showToast } from "@calcom/ui/components/toast";
import { Tooltip } from "@calcom/ui/components/tooltip";
@@ -50,7 +56,9 @@ export function EditMemberSheet({
(state) => [state.editMode, state.setEditMode, state.setMutationLoading],
shallow
);
const [role, setRole] = useState<string>(selectedUser.customRoleId || selectedUser.role);
const [role, setRole] = useState<string>(
selectedUser.customRoleId || selectedUser.role
);
const name =
selectedUser.name ||
(() => {
@@ -61,16 +69,19 @@ export function EditMemberSheet({
const bookerUrl = selectedUser.bookerUrl;
const utils = trpc.useUtils();
const bookerUrlWithoutProtocol = bookerUrl.replace(/^https?:\/\//, "");
const bookingLink = selectedUser.username ? `${bookerUrlWithoutProtocol}/${selectedUser.username}` : "";
const bookingLink = selectedUser.username
? `${bookerUrlWithoutProtocol}/${selectedUser.username}`
: "";
// Load custom roles for the team
const { data: customRoles, isPending: isLoadingRoles } = trpc.viewer.pbac.getTeamRoles.useQuery(
{ teamId },
{
enabled: !!teamId,
retry: false, // Don't retry if PBAC is not enabled
}
);
const { data: customRoles, isPending: isLoadingRoles } =
trpc.viewer.pbac.getTeamRoles.useQuery(
{ teamId },
{
enabled: !!teamId,
retry: false, // Don't retry if PBAC is not enabled
}
);
const options = useMemo(() => {
// If we have custom roles, only show custom roles
@@ -95,7 +106,10 @@ export function EditMemberSheet({
label: t("owner"),
value: MembershipRole.OWNER,
},
].filter(({ value }) => value !== MembershipRole.OWNER || currentMember === MembershipRole.OWNER);
].filter(
({ value }) =>
value !== MembershipRole.OWNER || currentMember === MembershipRole.OWNER
);
}, [t, currentMember, customRoles]);
// Determine if we should use Select (when custom roles exist) or ToggleGroup (traditional only)
@@ -109,10 +123,11 @@ export function EditMemberSheet({
},
});
const { data: getUserConnectedApps, isPending } = trpc.viewer.teams.getUserConnectedApps.useQuery({
userIds: [selectedUser.id],
teamId,
});
const { data: getUserConnectedApps, isPending } =
trpc.viewer.teams.getUserConnectedApps.useQuery({
userIds: [selectedUser.id],
teamId,
});
const connectedApps = getUserConnectedApps?.[selectedUser.id];
@@ -191,21 +206,32 @@ export function EditMemberSheet({
onOpenChange={() => {
setEditMode(false);
dispatch({ type: "CLOSE_MODAL" });
}}>
}}
>
<SheetContent className="bg-cal-muted">
{!isPending && !isLoadingRoles ? (
<Form form={form} handleSubmit={changeRole} className="flex h-full flex-col">
<Form
form={form}
handleSubmit={changeRole}
className="flex h-full flex-col"
>
<SheetHeader showCloseButton={false} className="w-full">
<div className="border-sublte bg-default w-full rounded-xl border p-4">
<div className="border-subtle bg-default w-full rounded-xl border p-4">
<div
className="block w-full rounded-lg ring-1 ring-[#0000000F]"
style={{
background: "linear-gradient(to top right, var(--cal-bg-emphasis), var(--cal-bg))",
background:
"linear-gradient(to top right, var(--cal-bg-emphasis), var(--cal-bg))",
height: "110px",
}}
/>
<div className="bg-default ml-3 w-fit translate-y-[-50%] rounded-full p-1 ring-1 ring-[#0000000F]">
<Avatar asChild size="lg" alt={`${name} avatar`} imageSrc={selectedUser.avatarUrl} />
<Avatar
asChild
size="lg"
alt={`${name} avatar`}
imageSrc={selectedUser.avatarUrl}
/>
</div>
<Skeleton as="p" waitForTranslation={false}>
<h2 className="text-emphasis font-sans text-2xl font-semibold">
@@ -214,16 +240,28 @@ export function EditMemberSheet({
</Skeleton>
<Skeleton as="p" waitForTranslation={false}>
<p className="text-subtle max-h-[3em] overflow-hidden text-ellipsis text-sm font-normal">
{selectedUser.bio ? selectedUser?.bio : t("user_has_no_bio")}
{selectedUser.bio
? selectedUser?.bio
: t("user_has_no_bio")}
</p>
</Skeleton>
</div>
</SheetHeader>
<SheetBody className="stack-y-4 flex flex-col p-4">
<div className="stack-y-4 mb-4 flex flex-col">
<h3 className="text-emphasis mb-1 text-base font-semibold">{t("profile")}</h3>
<DisplayInfo label="Cal" value={bookingLink} icon="external-link" />
<DisplayInfo label={t("email")} value={selectedUser.email} icon="at-sign" />
<h3 className="text-emphasis mb-1 text-base font-semibold">
{t("profile")}
</h3>
<DisplayInfo
label="Cal"
value={bookingLink}
icon="external-link"
/>
<DisplayInfo
label={t("email")}
value={selectedUser.email}
icon="at-sign"
/>
{!editMode ? (
<DisplayInfo
label={t("role")}
@@ -239,7 +277,9 @@ export function EditMemberSheet({
<div className="flex flex-1">
{shouldUseSelect ? (
<Select
value={options.find((option) => option.value === form.watch("role"))}
value={options.find(
(option) => option.value === form.watch("role")
)}
onChange={(selectedOption: any) => {
if (selectedOption) {
form.setValue("role", selectedOption.value);
@@ -247,7 +287,9 @@ export function EditMemberSheet({
}}
options={options}
isDisabled={isLoadingRoles}
placeholder={isLoadingRoles ? t("loading") : t("select_role")}
placeholder={
isLoadingRoles ? t("loading") : t("select_role")
}
className="flex-1"
/>
) : (
@@ -267,7 +309,9 @@ export function EditMemberSheet({
<div className="flex items-center gap-6">
<div className="flex w-[110px] items-center gap-2">
<Icon className="text-subtle h-4 w-4" name="grid-3x3" />
<label className="text-subtle text-sm font-medium">{t("apps")}</label>
<label className="text-subtle text-sm font-medium">
{t("apps")}
</label>
</div>
<div className="flex flex-1">
{!connectedApps ? (
@@ -62,12 +62,22 @@ export function CreateButton(props: CreateBtnProps) {
const hasTeams = !!options.find((option) => option.teamId);
const platform = !!options.find((option) => option.platform);
const hasMultipleOptions = options.length > 1;
const isFabVariant = !disableMobileButton;
// On FAB variant, EndIcon shows as "plus" on mobile, so we remove StartIcon to avoid duplicate
// On button variant, both icons work correctly
const startIcon = isFabVariant && hasMultipleOptions ? undefined : "plus";
const endIcon = hasMultipleOptions ? "chevron-down" : undefined;
// inject selection data into url for correct router history
const openModal = (option: Option) => {
const _searchParams = new URLSearchParams(searchParams.toString());
function setParamsIfDefined(key: string, value: string | number | boolean | null | undefined) {
if (value !== undefined && value !== null) _searchParams.set(key, value.toString());
function setParamsIfDefined(
key: string,
value: string | number | boolean | null | undefined
) {
if (value !== undefined && value !== null)
_searchParams.set(key, value.toString());
}
setParamsIfDefined("dialog", "new");
setParamsIfDefined("eventPage", option.slug);
@@ -82,7 +92,6 @@ export function CreateButton(props: CreateBtnProps) {
<>
{!hasTeams && !platform ? (
<Button
size="sm"
onClick={() =>
CreateDialog
? openModal(options[0])
@@ -91,11 +100,17 @@ export function CreateButton(props: CreateBtnProps) {
: null
}
data-testid="create-button"
StartIcon="plus"
StartIcon={startIcon}
EndIcon={endIcon}
size="sm"
loading={isPending}
variant={disableMobileButton ? "button" : "fab"}
className={classNames(disableMobileButton && "md:min-h-min md:min-w-min", className)}
{...restProps}>
className={classNames(
disableMobileButton && "md:min-h-min md:min-w-min",
className
)}
{...restProps}
>
{buttonText ? buttonText : t("new")}
</Button>
) : (
@@ -103,16 +118,25 @@ export function CreateButton(props: CreateBtnProps) {
<DropdownMenuTrigger asChild>
<Button
variant={disableMobileButton ? "button" : "fab"}
StartIcon="plus"
StartIcon={startIcon}
EndIcon={endIcon}
size="sm"
data-testid="create-button-dropdown"
loading={isPending}
className={classNames(disableMobileButton && "md:min-h-min md:min-w-min", className)}
{...restProps}>
className={classNames(
disableMobileButton && "md:min-h-min md:min-w-min",
className
)}
{...restProps}
>
{buttonText ? buttonText : t("new")}
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent sideOffset={14} align="end" className="scroll-bar max-h-60 overflow-y-auto">
<DropdownMenuContent
sideOffset={14}
align="end"
className="scroll-bar max-h-60 overflow-y-auto"
>
<DropdownMenuLabel>
<div className="w-48 text-left text-xs">{subtitle}</div>
</DropdownMenuLabel>
@@ -121,14 +145,24 @@ export function CreateButton(props: CreateBtnProps) {
<DropdownItem
type="button"
data-testid={`option${option.teamId ? "-team" : ""}-${idx}`}
CustomStartIcon={<Avatar alt={option.label || ""} imageSrc={option.image} size="sm" />}
CustomStartIcon={
<Avatar
alt={option.label || ""}
imageSrc={option.image}
size="sm"
/>
}
onClick={() =>
CreateDialog
? openModal(option)
: createFunction
? createFunction(option.teamId || undefined, option.platform)
? createFunction(
option.teamId || undefined,
option.platform
)
: null
}>
}
>
{" "}
{/*improve this code */}
<span>{option.label}</span>
@@ -13,7 +13,11 @@ import { ALLOWED_FORM_WORKFLOW_ACTIONS } from "@calcom/features/ee/workflows/lib
import emailReminderTemplate from "@calcom/features/ee/workflows/lib/reminders/templates/emailReminderTemplate";
import type { FormValues } from "@calcom/features/ee/workflows/lib/types";
import type { WorkflowPermissions } from "@calcom/features/workflows/repositories/WorkflowPermissionsRepository";
import { SENDER_ID, SENDER_NAME, SCANNING_WORKFLOW_STEPS } from "@calcom/lib/constants";
import {
SENDER_ID,
SENDER_NAME,
SCANNING_WORKFLOW_STEPS,
} from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { getTimeFormatStringFromUserTimeFormat } from "@calcom/lib/timeFormat";
import { WorkflowActions } from "@calcom/prisma/enums";
@@ -23,7 +27,10 @@ import { Button } from "@calcom/ui/components/button";
import { FormCard, FormCardBody } from "@calcom/ui/components/card";
import type { MultiSelectCheckboxesOptionType as Option } from "@calcom/ui/components/form";
import { Icon } from "@calcom/ui/components/icon";
import { useHasPaidPlan, useHasActiveTeamPlan } from "@calcom/web/modules/billing/hooks/useHasPaidPlan";
import {
useHasPaidPlan,
useHasActiveTeamPlan,
} from "@calcom/web/modules/billing/hooks/useHasPaidPlan";
import { AddActionDialog } from "./AddActionDialog";
import WorkflowStepContainer from "./WorkflowStepContainer";
@@ -70,20 +77,28 @@ export default function WorkflowDetailsPage(props: Props) {
const eventTypeId = searchParams?.get("eventTypeId");
// Get base action options and transform them for form triggers
const { data: baseActionOptions } = trpc.viewer.workflows.getWorkflowActionOptions.useQuery();
const { data: baseActionOptions } =
trpc.viewer.workflows.getWorkflowActionOptions.useQuery();
const transformedActionOptions = baseActionOptions
? baseActionOptions
.filter((option) => {
const isFormWorkflowWithInvalidSteps =
isFormTrigger(form.getValues("trigger")) &&
!ALLOWED_FORM_WORKFLOW_ACTIONS.some((action) => action === option.value);
!ALLOWED_FORM_WORKFLOW_ACTIONS.some(
(action) => action === option.value
);
const isSelectAllCalAiAction = isCalAIAction(option.value) && form.watch("selectAll");
const isSelectAllCalAiAction =
isCalAIAction(option.value) && form.watch("selectAll");
const isOrgCalAiAction = isCalAIAction(option.value) && isOrg;
if (isFormWorkflowWithInvalidSteps || isSelectAllCalAiAction || isOrgCalAiAction) {
if (
isFormWorkflowWithInvalidSteps ||
isSelectAllCalAiAction ||
isOrgCalAiAction
) {
return false;
}
return true;
@@ -100,7 +115,8 @@ export default function WorkflowDetailsPage(props: Props) {
}
}
const needsTeamsUpgrade = isFormTrigger(form.getValues("trigger")) && !hasActiveTeamPlan;
const needsTeamsUpgrade =
isFormTrigger(form.getValues("trigger")) && !hasActiveTeamPlan;
return {
...option,
@@ -117,8 +133,13 @@ export default function WorkflowDetailsPage(props: Props) {
: [];
useEffect(() => {
const matchingOption = allOptions.find((option) => option.value === eventTypeId);
if (matchingOption && !selectedOptions.find((option) => option.value === eventTypeId)) {
const matchingOption = allOptions.find(
(option) => option.value === eventTypeId
);
if (
matchingOption &&
!selectedOptions.find((option) => option.value === eventTypeId)
) {
const newOptions = [...selectedOptions, matchingOption];
setSelectedOptions(newOptions);
form.setValue("activeOn", newOptions);
@@ -141,7 +162,9 @@ export default function WorkflowDetailsPage(props: Props) {
})[0].id - 1
: 0;
const timeFormat = getTimeFormatStringFromUserTimeFormat(props.user.timeFormat);
const timeFormat = getTimeFormatStringFromUserTimeFormat(
props.user.timeFormat
);
const template = isFormTrigger(form.getValues("trigger"))
? WorkflowTemplates.CUSTOM
@@ -174,7 +197,9 @@ export default function WorkflowDetailsPage(props: Props) {
template,
numberRequired: numberRequired || false,
sender: isSMSAction(action) ? sender || SENDER_ID : SENDER_ID,
senderName: !isSMSAction(action) ? senderName || SENDER_NAME : SENDER_NAME,
senderName: !isSMSAction(action)
? senderName || SENDER_NAME
: SENDER_NAME,
numberVerificationPending: false,
includeCalendarEvent: false,
verifiedAt: SCANNING_WORKFLOW_STEPS ? null : new Date(),
@@ -185,8 +210,10 @@ export default function WorkflowDetailsPage(props: Props) {
form.setValue("steps", steps);
};
const { outboundAgentQueries: agentQueriesTrpc, inboundAgentQueries: inboundAgentQueriesTrpc } =
useAgentsData(form);
const {
outboundAgentQueries: agentQueriesTrpc,
inboundAgentQueries: inboundAgentQueriesTrpc,
} = useAgentsData(form);
return (
<>
@@ -199,9 +226,12 @@ export default function WorkflowDetailsPage(props: Props) {
<div className="border-subtle text-subtle ml-1 rounded-lg border p-1">
<Icon name="zap" size="16" />
</div>
<div className="text-sm font-medium leading-none">{t("trigger")}</div>
<div className="text-sm font-medium leading-none">
{t("trigger")}
</div>
</div>
}>
}
>
<FormCardBody className="border-muted">
<WorkflowStepContainer
form={form}
@@ -228,7 +258,8 @@ export default function WorkflowDetailsPage(props: Props) {
const agentData = agentQueriesTrpc[index]?.data;
const isAgentLoading = agentQueriesTrpc[index]?.isPending;
const inboundAgentData = inboundAgentQueriesTrpc[index]?.data;
const isInboundAgentLoading = inboundAgentQueriesTrpc[index]?.isPending;
const isInboundAgentLoading =
inboundAgentQueriesTrpc[index]?.isPending;
return (
<div key={index}>
@@ -241,13 +272,15 @@ export default function WorkflowDetailsPage(props: Props) {
<div className="border-subtle text-subtle rounded-lg border p-1">
<Icon name="arrow-right" size="16" />
</div>
<div className="text-sm font-medium leading-none">{t("action")}</div>
<div className="text-sm font-medium leading-none">
{t("action")}
</div>
</div>
}
deleteField={
!permissions.readOnly
? {
color: "destructive",
color: "minimal",
check: () => true,
disabled: !permissions.canUpdate,
fn: () => {
@@ -260,11 +293,16 @@ export default function WorkflowDetailsPage(props: Props) {
} else {
const steps = form.getValues("steps");
const updatedSteps = steps
?.filter((currStep) => currStep.id !== step.id)
?.filter(
(currStep) => currStep.id !== step.id
)
.map((s) => {
const updatedStep = s;
if (step.stepNumber < updatedStep.stepNumber) {
updatedStep.stepNumber = updatedStep.stepNumber - 1;
if (
step.stepNumber < updatedStep.stepNumber
) {
updatedStep.stepNumber =
updatedStep.stepNumber - 1;
}
return updatedStep;
});
@@ -276,7 +314,8 @@ export default function WorkflowDetailsPage(props: Props) {
},
}
: null
}>
}
>
<FormCardBody className="border-muted">
<WorkflowStepContainer
form={form}
@@ -316,7 +355,8 @@ export default function WorkflowDetailsPage(props: Props) {
type="button"
onClick={() => setIsAddActionDialogOpen(true)}
color="secondary"
className="bg-default">
className="bg-default"
>
{t("add_action")}
</Button>
</>
File diff suppressed because it is too large. Load diff
@@ -462,7 +462,7 @@ function WorkflowPage({
<div className="group flex min-w-0 items-center gap-1">
<span
className="text-default hover:bg-cal-muted min-w-0 cursor-pointer truncate whitespace-nowrap rounded p-1 text-sm font-semibold leading-none sm:min-w-[100px]"
className="text-default hover:bg-cal-muted min-w-0 cursor-pointer truncate whitespace-nowrap rounded p-1 text-sm font-semibold leading-none"
onClick={() => setIsEditingName(true)}>
{watchedName ? watchedName : isPending ? t("loading") : t("untitled")}
</span>