From 26b771064d3318f91be84d1a4725471f133d582c Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Sat, 3 Sep 2022 00:30:41 +0530 Subject: [PATCH] V2.0 - Routing Forms and Shell 2.0 everywhere (#3902) * Add duplicate form support * Fix duplication logic * Change to feathericons everywhere and other fixes * Dont allow routes for fallback route * Fix banner * Fix Empty Screen * Text area + embded window fixes * Semi fix avatar * Fix all TS issues * Fix tests * Troubleshoot container + Active on count * Support routing using query params * Improve mobile * NITS * Fix padding on input * Support multiselect in router endpoint * Fix the issue where app goes in embed mode after viewing embed once * Fix icons * Add router url tests * Add Responses download and form toggling tests * Add required validation test * Change Icons everywhere * App typeform app * Improvements in cli * Starting to move event types settings to tabs * Begin migration to single page form * Single page tabs * Limits Page * Advanced tab * Add RHF to dependancies * Add typeform how-to-use page * Add typeform how-to-use page and screenshots * Most of advanced tab * Solved RHF mismtach * Build fixes * RHF conditionals fixes * Improved legibility * Fix TS error * Add missing image * Update CliApp.tsx * Major refactor/organisation into optional V2 UI * Portal EditLocationModal * Fix dialoug form * Update imports * Auto Animate + custom inputs WIP * Custom Inputs * WIP Apps * Fixing stories imports * Stripe app * Remove duplicate dialog * Remove duplicate dialog * Major locations cleanup, 10s of bug fixes and app-store improvements * Fix missing pieces * More fixes * Fix embed URL * Fix app toggles + number of active apps * Fix container padding on disabledBorder prop * Removes strict * more fixes * EventType Team page WIP * Fix embed * Use new Shell * NIT * Add Darkmode gray color * V2 Shell WIP * Fix headings on shell V2 * Fix mobile layout with V2 shell * V2 create event type button * Checked Team Select * Hidden to happen on save - not on toggle * Team Attendee Select animation * Get form-edit page working * Get route-builder page working * Fix scheduling type and remove multi select label * Fix overflow on teams url * Get UI as per designs for form-edit * Make route-builder upto date with design * Add no responses banner * Update forms list as per designs * Button shouldnt decide where it would be positioned, users of it might have different requirements * A single select box in a row(when no other select boxes are present) wasnt taking the correct width in comparison to when it had other select boxes * Small missing pieces * Revert console * Revert api * Fixes * Fix Embed TS errors * Fix TS errors * Fix Eslint errors * Fix TS errors for UI * Fix ESLINT error * Fix TS errors * Add missing import * Fix CLI * Add a default placeholder * Remove hardcoded daily:integrations * Fix message for payment page * Revert api and console to main * Update README * Fix TS errors * Fix Lint warnings * Fix Tests * Streamline actions and make them easy to manage * A much more simplified approach to implementing actions * Fix embed * Fix most TS errors * Fix more TS errors * Reduce TS errors to zero * Fix tests * Fix UI * Fix UI * Self review fixes * TS failures caught merge issues * Security hardening * Use V2 Shell everywhere * Add missing file * Problems created by new shell fixed * Fix Shell * Fix Routing Form Card up and down positons * Fix Embed and other design fixes * Fix dropdown old event-types * Fix type errors * Fix allowed chek * Fix dropdown not closing on clicking EMbed button * Fix dropdown not closing on embed button * Fix event-type button group layout * Add label for switch * Fix dropdown in mobile mode * Remove useless comments * Login with pro for tests * Remove bg gray till App-Store pages are revamped Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Co-authored-by: Peer Richelsen Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: zomars --- .github/workflows/e2e-app-store.yml | 5 +- apps/web/components/App.tsx | 2 +- apps/web/components/Embed.tsx | 11 +- .../v2/eventtype/EventTypeSingleLayout.tsx | 2 +- apps/web/lib/app-providers.tsx | 2 +- apps/web/middleware.ts | 7 +- apps/web/pages/_app.tsx | 3 +- apps/web/pages/_document.tsx | 2 +- apps/web/pages/apps/[slug]/[...pages].tsx | 42 +- apps/web/pages/event-types/index.tsx | 9 +- apps/web/pages/v2/event-types/index.tsx | 6 +- apps/web/playwright/fixtures/users.ts | 134 +++- apps/web/playwright/lib/fixtures.ts | 2 +- apps/web/styles/globals.css | 4 - .../routing_forms/api/responses/[formId].ts | 10 + .../routing_forms/components/FormActions.tsx | 391 ++++++++++ .../components/RoutingNavBar.tsx | 6 +- .../routing_forms/components/RoutingShell.tsx | 25 - .../ee/routing_forms/components/SideBar.tsx | 122 --- .../routing_forms/components/SingleForm.tsx | 270 +++++++ .../react-awesome-query-builder/styles.css | 9 +- .../react-awesome-query-builder/widgets.tsx | 17 +- .../ee/routing_forms/lib/isAllowed.ts | 25 + .../pages/form-edit/[...appPages].tsx | 436 +++++------ .../pages/forms/[...appPages].tsx | 467 ++++-------- .../pages/route-builder/[...appPages].tsx | 179 ++--- .../playwright/tests/basic.e2e.ts | 191 +++-- .../app-store/ee/routing_forms/trpc-router.ts | 17 +- packages/app-store/utils.ts | 6 + packages/ui/Shell.tsx | 696 +----------------- packages/ui/v2/core/Button.tsx | 7 +- packages/ui/v2/core/Divider.tsx | 6 + packages/ui/v2/core/EmptyScreen.tsx | 6 +- packages/ui/v2/core/List.tsx | 115 +++ packages/ui/v2/core/Shell.tsx | 94 ++- packages/ui/v2/core/Tooltip.tsx | 2 +- packages/ui/v2/core/banner.tsx | 26 +- .../ui/v2/core/form/BooleanToggleGroup.tsx | 84 +++ packages/ui/v2/core/form/FormCard.tsx | 61 ++ packages/ui/v2/core/form/Select.tsx | 109 ++- packages/ui/v2/core/form/fields.tsx | 18 +- packages/ui/v2/core/form/index.ts | 3 +- .../navigation/tabs/HorizontalTabItem.tsx | 4 +- packages/ui/v2/core/notifications.tsx | 2 +- 44 files changed, 1912 insertions(+), 1723 deletions(-) create mode 100644 packages/app-store/ee/routing_forms/components/FormActions.tsx delete mode 100644 packages/app-store/ee/routing_forms/components/RoutingShell.tsx delete mode 100644 packages/app-store/ee/routing_forms/components/SideBar.tsx create mode 100644 packages/app-store/ee/routing_forms/components/SingleForm.tsx create mode 100644 packages/app-store/ee/routing_forms/lib/isAllowed.ts create mode 100644 packages/ui/v2/core/Divider.tsx create mode 100644 packages/ui/v2/core/List.tsx create mode 100644 packages/ui/v2/core/form/BooleanToggleGroup.tsx create mode 100644 packages/ui/v2/core/form/FormCard.tsx diff --git a/.github/workflows/e2e-app-store.yml b/.github/workflows/e2e-app-store.yml index 75dca65ec1..fd9e2bd1ba 100644 --- a/.github/workflows/e2e-app-store.yml +++ b/.github/workflows/e2e-app-store.yml @@ -95,5 +95,6 @@ jobs: if: ${{ always() }} uses: actions/upload-artifact@v2 with: - name: test-results-core - path: packages/app-store/**/playwright/results + name: test-results + path: test-results + diff --git a/apps/web/components/App.tsx b/apps/web/components/App.tsx index 961397c62b..2e9ff41c42 100644 --- a/apps/web/components/App.tsx +++ b/apps/web/components/App.tsx @@ -80,7 +80,7 @@ const Component = ({ return (
-
+
{t("browse_apps")} diff --git a/apps/web/components/Embed.tsx b/apps/web/components/Embed.tsx index 07352d3119..306038599a 100644 --- a/apps/web/components/Embed.tsx +++ b/apps/web/components/Embed.tsx @@ -6,10 +6,10 @@ import { components, ControlProps } from "react-select"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import showToast from "@calcom/lib/notification"; -import { Button, Switch } from "@calcom/ui"; import { Dialog, DialogClose, DialogContent } from "@calcom/ui/Dialog"; import { Icon } from "@calcom/ui/Icon"; import { InputLeading, Label, TextArea, TextField } from "@calcom/ui/form/fields"; +import { Button, Switch } from "@calcom/ui/v2"; import { EMBED_LIB_URL, WEBAPP_URL } from "@lib/config/constants"; @@ -1128,7 +1128,7 @@ export const EmbedDialog = () => { type EmbedButtonProps = { embedUrl: string; children?: React.ReactNode; - className: string; + className?: string; as?: T; }; @@ -1140,7 +1140,7 @@ export const EmbedButton = ({ ...props }: EmbedButtonProps & React.ComponentPropsWithoutRef) => { const router = useRouter(); - className = classNames(className, "hidden lg:flex"); + className = classNames(className, "hidden lg:inline-flex"); const openEmbedModal = () => { const query = { ...router.query, @@ -1164,7 +1164,10 @@ export const EmbedButton = ({ className={className} data-test-embed-url={embedUrl} data-testid="embed" - onClick={() => openEmbedModal()}> + type="button" + onClick={() => { + openEmbedModal(); + }}> {children} ); diff --git a/apps/web/components/v2/eventtype/EventTypeSingleLayout.tsx b/apps/web/components/v2/eventtype/EventTypeSingleLayout.tsx index 1859b2d93f..f068878e34 100644 --- a/apps/web/components/v2/eventtype/EventTypeSingleLayout.tsx +++ b/apps/web/components/v2/eventtype/EventTypeSingleLayout.tsx @@ -167,7 +167,7 @@ function EventTypeSingleLayout({ />
{/* TODO: Figure out why combined isnt working - works in storybook */} -