From 18389f459d668be13ac85a411cc8b0e4b599b142 Mon Sep 17 00:00:00 2001 From: Peer Richelsen Date: Fri, 15 Jul 2022 13:46:05 +0200 Subject: [PATCH] minor improvements to routing forms (#3380) * minor improvements to routing forms * UX improvements and text changes Co-authored-by: Hariom Balhara Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/web/components/ui/form/Select.tsx | 2 +- apps/web/next.config.js | 4 ++ .../routing_forms/api/responses/[formId].ts | 4 +- .../components/RoutingNavBar.tsx | 2 +- .../routing_forms/components/RoutingShell.tsx | 8 ---- .../ee/routing_forms/components/SideBar.tsx | 2 +- .../pages/form-edit/[...appPages].tsx | 23 ++++++------ .../pages/forms/[...appPages].tsx | 37 +++++++++++-------- .../pages/route-builder/[...appPages].tsx | 4 +- .../pages/routing-link/[...appPages].tsx | 3 ++ .../playwright/tests/basic.test.ts | 14 +++---- .../app-store/ee/routing_forms/trpc-router.ts | 22 ++++++++++- packages/ui/EmptyScreen.tsx | 5 ++- packages/ui/form/Select.tsx | 2 +- yarn.lock | 7 ++++ 15 files changed, 86 insertions(+), 53 deletions(-) diff --git a/apps/web/components/ui/form/Select.tsx b/apps/web/components/ui/form/Select.tsx index 3615501798..d2a0b6a19b 100644 --- a/apps/web/components/ui/form/Select.tsx +++ b/apps/web/components/ui/form/Select.tsx @@ -55,7 +55,7 @@ function Select< IndicatorSeparator: () => null, Input: InputComponent, }} - className={classNames("text-sm shadow-sm", className)} + className={classNames("text-sm", className)} {...props} /> ); diff --git a/apps/web/next.config.js b/apps/web/next.config.js index 688cd7060d..9d16c1fc8b 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -93,6 +93,10 @@ const nextConfig = { source: "/team/:teamname/avatar.png", destination: "/api/user/avatar?teamname=:teamname", }, + { + source: "/forms/:formId", + destination: "/apps/routing_forms/routing-link/:formId", + }, /* TODO: have these files being served from another deployment or CDN { source: "/embed/embed.js", destination: process.env.NEXT_PUBLIC_EMBED_LIB_URL?, diff --git a/packages/app-store/ee/routing_forms/api/responses/[formId].ts b/packages/app-store/ee/routing_forms/api/responses/[formId].ts index 77ff63cf0b..9abd79c39b 100644 --- a/packages/app-store/ee/routing_forms/api/responses/[formId].ts +++ b/packages/app-store/ee/routing_forms/api/responses/[formId].ts @@ -22,7 +22,7 @@ async function* getResponses(formId: string) { responses.length ) { const csv: string[] = []; - // Because attributes can be added or removed at any time we can't have fixed columns. + // Because fields can be added or removed at any time we can't have fixed columns. // Because there can be huge amount of data we can't keep all that in memory to identify columns from all the data at once. // TODO: So, for now add the field label in front of it. It certainly needs improvement. // TODO: Email CSV when we need to scale it. @@ -38,7 +38,7 @@ async function* getResponses(formId: string) { } else { serializedValue = escapeCsvText(value); } - csvLineColumns.push(`"Attribute Label :=> Value"`); + csvLineColumns.push(`"Field Label :=> Value"`); csvLineColumns.push(`"${label} :=> ${serializedValue}"`); } csv.push(csvLineColumns.join(",")); diff --git a/packages/app-store/ee/routing_forms/components/RoutingNavBar.tsx b/packages/app-store/ee/routing_forms/components/RoutingNavBar.tsx index 7eb792ecd4..0cd701cc83 100644 --- a/packages/app-store/ee/routing_forms/components/RoutingNavBar.tsx +++ b/packages/app-store/ee/routing_forms/components/RoutingNavBar.tsx @@ -11,7 +11,7 @@ export default function RoutingNavBar({ }) { const tabs = [ { - name: "Form", + name: "Fields", href: `${appUrl}/form-edit/${form?.id}`, }, { diff --git a/packages/app-store/ee/routing_forms/components/RoutingShell.tsx b/packages/app-store/ee/routing_forms/components/RoutingShell.tsx index 7fb75bab72..afd551c52c 100644 --- a/packages/app-store/ee/routing_forms/components/RoutingShell.tsx +++ b/packages/app-store/ee/routing_forms/components/RoutingShell.tsx @@ -1,7 +1,5 @@ import { ReactNode } from "react"; -import { Alert } from "@calcom/ui/Alert"; - import Shell from "@components/Shell"; import RoutingNavBar from "../components/RoutingNavBar"; @@ -16,12 +14,6 @@ const RoutingShell: React.FC<{ return (
- {!form.routes?.length ? ( - - ) : null} - {!form.fields.length ? ( - - ) : null}
{children} diff --git a/packages/app-store/ee/routing_forms/components/SideBar.tsx b/packages/app-store/ee/routing_forms/components/SideBar.tsx index a0f763500c..c5520157c1 100644 --- a/packages/app-store/ee/routing_forms/components/SideBar.tsx +++ b/packages/app-store/ee/routing_forms/components/SideBar.tsx @@ -53,7 +53,7 @@ export default function SideBar({ onCheckedChange={(isChecked) => { mutation.mutate({ ...form, disabled: !isChecked }); }} - label={!form.disabled ? t("Disable Form") : t("Enable Form")} + label={t("Enable Form")} />
diff --git a/packages/app-store/ee/routing_forms/pages/form-edit/[...appPages].tsx b/packages/app-store/ee/routing_forms/pages/form-edit/[...appPages].tsx index 631525452d..5f4e1ac110 100644 --- a/packages/app-store/ee/routing_forms/pages/form-edit/[...appPages].tsx +++ b/packages/app-store/ee/routing_forms/pages/form-edit/[...appPages].tsx @@ -74,7 +74,7 @@ function Field({ }) { return (
{moveUp.check() ? ( ) : null} -
+
@@ -124,7 +124,7 @@ function Field({ const defaultValue = FieldTypes.find((fieldType) => fieldType.value === value); return (