chore: added routing support link (#18369)

* Added routing form support link

* small change

* Type fix

---------

Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
Peer RichelsenandJoe Au-Yeung authored and GitHub committed 2024-12-24 17:19:37 +00:00
1 parent 9036080fcf
commit ae38027d76
1 file changed
+19 -1
@@ -8,10 +8,12 @@ import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequir
import AddMembersWithSwitch from "@calcom/features/eventtypes/components/AddMembersWithSwitch";
import { ShellMain } from "@calcom/features/shell/Shell";
import cn from "@calcom/lib/classNames";
import { IS_CALCOM } from "@calcom/lib/constants";
import useApp from "@calcom/lib/hooks/useApp";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc, TRPCClientError } from "@calcom/trpc/react";
import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import type { Brand } from "@calcom/types/utils";
import {
@@ -676,6 +678,8 @@ export const TestFormDialog = ({
function SingleForm({ form, appUrl, Page, enrichedWithUserProfileForm }: SingleFormComponentProps) {
const utils = trpc.useUtils();
const { t } = useLocale();
const { data: user } = useMeQuery();
const [isTestPreviewOpen, setIsTestPreviewOpen] = useState(false);
const [skipFirstUpdate, setSkipFirstUpdate] = useState(true);
const hookForm = useFormContext<RoutingFormWithResponseCount>();
@@ -898,13 +902,27 @@ function SingleForm({ form, appUrl, Page, enrichedWithUserProfileForm }: SingleF
</div>
) : null}
<div className="mt-6">
<div className="mt-6 flex gap-2">
<Button
color="secondary"
data-testid="test-preview"
onClick={() => setIsTestPreviewOpen(true)}>
{t("test_preview")}
</Button>
{IS_CALCOM && (
<Tooltip content={t("contact_our_support_team")} side="right">
<Button
target="_blank"
color="minimal"
href={`https://i.cal.com/support/routing-support-session?email=${encodeURIComponent(
user?.email ?? ""
)}&name=${encodeURIComponent(user?.name ?? "")}&form=${encodeURIComponent(
form.id
)}`}>
{t("need_help")}
</Button>
</Tooltip>
)}
</div>
{form.routes?.every(isFallbackRoute) && (
<Alert