From 2a83aec795341f5939641f0daa4acc6c9d8366d9 Mon Sep 17 00:00:00 2001 From: letiescanciano <45267095+letiescanciano@users.noreply.github.com> Date: Wed, 4 Jan 2023 15:59:51 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=9F=C2=A0=F0=9F=A7=B9=20Remove=20=20Component=20(#20943)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing code related to this experiment as it didn't have any impact --- .../DestinationForm.module.scss | 5 -- .../DestinationForm/DestinationForm.tsx | 40 +++++------- .../hooks/services/Experiment/experiments.ts | 1 - airbyte-webapp/src/locales/en.json | 2 - .../StartWithDestination.tsx | 36 ----------- .../StartWithDestinationCard.module.scss | 15 ----- .../StartWithDestinationCard.test.tsx | 34 ----------- .../StartWithDestinationCard.tsx | 42 ------------- .../StartWithDestinationCard.test.tsx.snap | 61 ------------------- .../StartWithDestination/index.stories.tsx | 21 ------- .../components/StartWithDestination/index.ts | 1 - .../views/Connector/ConnectorForm/index.tsx | 1 - 12 files changed, 15 insertions(+), 244 deletions(-) delete mode 100644 airbyte-webapp/src/components/destination/DestinationForm/DestinationForm.module.scss delete mode 100644 airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestination.tsx delete mode 100644 airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.module.scss delete mode 100644 airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.test.tsx delete mode 100644 airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.tsx delete mode 100644 airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/__snapshots__/StartWithDestinationCard.test.tsx.snap delete mode 100644 airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/index.stories.tsx delete mode 100644 airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/index.ts diff --git a/airbyte-webapp/src/components/destination/DestinationForm/DestinationForm.module.scss b/airbyte-webapp/src/components/destination/DestinationForm/DestinationForm.module.scss deleted file mode 100644 index 273d64b51e27..000000000000 --- a/airbyte-webapp/src/components/destination/DestinationForm/DestinationForm.module.scss +++ /dev/null @@ -1,5 +0,0 @@ -@use "scss/variables" as vars; - -.startWithDestinationContainer { - margin-top: vars.$spacing-xl; -} diff --git a/airbyte-webapp/src/components/destination/DestinationForm/DestinationForm.tsx b/airbyte-webapp/src/components/destination/DestinationForm/DestinationForm.tsx index c789172cabcc..acd71a4ee246 100644 --- a/airbyte-webapp/src/components/destination/DestinationForm/DestinationForm.tsx +++ b/airbyte-webapp/src/components/destination/DestinationForm/DestinationForm.tsx @@ -10,9 +10,7 @@ import { useGetDestinationDefinitionSpecificationAsync } from "services/connecto import { ConnectorIds } from "utils/connectors"; import { FormError } from "utils/errorStatusMessage"; import { ConnectorCard } from "views/Connector/ConnectorCard"; -import { ConnectorCardValues, FrequentlyUsedConnectors, StartWithDestination } from "views/Connector/ConnectorForm"; - -import styles from "./DestinationForm.module.scss"; +import { ConnectorCardValues, FrequentlyUsedConnectors } from "views/Connector/ConnectorForm"; interface DestinationFormProps { onSubmit: (values: { @@ -69,29 +67,21 @@ export const DestinationForm: React.FC = ({ onSubmit, dest connectorIds={frequentlyUsedDestinationIds} /> ); - const startWithDestinationComponent = !isLoading && !destinationDefinitionId && ( -
- -
- ); return ( - <> - } - description={} - isLoading={isLoading} - fetchingConnectorError={destinationDefinitionError instanceof Error ? destinationDefinitionError : null} - availableConnectorDefinitions={destinationDefinitions} - onConnectorDefinitionSelect={onDropDownSelect} - selectedConnectorDefinitionSpecification={destinationDefinitionSpecification} - selectedConnectorDefinitionId={destinationDefinitionId} - onSubmit={onSubmitForm} - jobInfo={LogsRequestError.extractJobInfo(error)} - additionalSelectorComponent={frequentlyUsedDestinationsComponent} - /> - {startWithDestinationComponent} - + } + description={} + isLoading={isLoading} + fetchingConnectorError={destinationDefinitionError instanceof Error ? destinationDefinitionError : null} + availableConnectorDefinitions={destinationDefinitions} + onConnectorDefinitionSelect={onDropDownSelect} + selectedConnectorDefinitionSpecification={destinationDefinitionSpecification} + selectedConnectorDefinitionId={destinationDefinitionId} + onSubmit={onSubmitForm} + jobInfo={LogsRequestError.extractJobInfo(error)} + additionalSelectorComponent={frequentlyUsedDestinationsComponent} + /> ); }; diff --git a/airbyte-webapp/src/hooks/services/Experiment/experiments.ts b/airbyte-webapp/src/hooks/services/Experiment/experiments.ts index b80406ae654a..0ff0aa80a7d2 100644 --- a/airbyte-webapp/src/hooks/services/Experiment/experiments.ts +++ b/airbyte-webapp/src/hooks/services/Experiment/experiments.ts @@ -11,7 +11,6 @@ export interface Experiments { "connector.inviteUsersHint.linkToUsersPage": boolean; "connector.orderOverwrite": Record; "connector.frequentlyUsedDestinationIds": string[]; - "connector.startWithDestinationId": string; "connector.form.useDatepicker": boolean; "authPage.rightSideUrl": string | undefined; "authPage.hideSelfHostedCTA": boolean; diff --git a/airbyte-webapp/src/locales/en.json b/airbyte-webapp/src/locales/en.json index e6e0014514db..cf71a4058128 100644 --- a/airbyte-webapp/src/locales/en.json +++ b/airbyte-webapp/src/locales/en.json @@ -329,8 +329,6 @@ "destinations.newDestinationTitle": "New destination", "destinations.destinationSetUp": "Set up the destination", "destinations.frequentlyUsed": "Most frequently used destinations", - "destinations.dontHaveYourOwnDestination": "Don’t have your own destination yet?", - "destinations.startWith": "Start with {name}", "connection.stream.syncMode": "{syncMode} - {destinationSyncMode}", diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestination.tsx b/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestination.tsx deleted file mode 100644 index 2921a49a0fe4..000000000000 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestination.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import React, { useMemo } from "react"; - -import { ConnectorDefinition } from "core/domain/connector"; -import { isDestinationDefinition } from "core/domain/connector/destination"; -import { useExperiment } from "hooks/services/Experiment"; -import { DestinationDefinitionReadWithLatestTag } from "services/connector/DestinationDefinitionService"; - -import { DestinationConnectorCard } from "../../types"; -import { StartWithDestinationCard } from "./StartWithDestinationCard"; - -interface StartWithDestinationProps { - onDestinationSelect: (id: string) => void; - availableServices: ConnectorDefinition[]; -} - -export const StartWithDestination: React.FC = ({ - onDestinationSelect, - availableServices, -}) => { - const startWithDestinationId = useExperiment("connector.startWithDestinationId", ""); - - const startWithDestination = useMemo(() => { - const destination = availableServices.find( - (service): service is DestinationDefinitionReadWithLatestTag => - isDestinationDefinition(service) && service.destinationDefinitionId === startWithDestinationId - ); - if (!destination) { - return undefined; - } - const { destinationDefinitionId, name, icon, releaseStage } = destination; - - return { destinationDefinitionId, name, icon, releaseStage }; - }, [availableServices, startWithDestinationId]); - - return ; -}; diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.module.scss b/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.module.scss deleted file mode 100644 index 6c1c18e7ddee..000000000000 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.module.scss +++ /dev/null @@ -1,15 +0,0 @@ -@use "scss/colors"; -@use "scss/variables" as vars; - -.button { - cursor: pointer; - border: none; - padding: 0; - margin: 0; - width: 100%; - border-radius: vars.$border-radius-lg; -} - -.connectorCardWrapper { - padding: vars.$spacing-xl 35px; -} diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.test.tsx b/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.test.tsx deleted file mode 100644 index cdce735c7407..000000000000 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.test.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { fireEvent, render, waitFor } from "@testing-library/react"; -import { IntlProvider } from "react-intl"; - -import en from "locales/en.json"; -import { ConnectorIds } from "utils/connectors"; - -import { mockData } from "../../../../../test-utils/mock-data/mockStartWithDestination"; -import { StartWithDestinationCard, StartWithDestinationProps } from "./StartWithDestinationCard"; - -const renderStartWithDestination = (props: StartWithDestinationProps) => - render( - - - - ); - -describe("", () => { - it("should renders without crash with provided props", () => { - const component = renderStartWithDestination({ destination: mockData, onDestinationSelect: jest.fn() }); - - expect(component).toMatchSnapshot(); - }); - - it("should call provided handler with right params", async () => { - const handler = jest.fn(); - const { getByText } = renderStartWithDestination({ destination: mockData, onDestinationSelect: handler }); - - fireEvent.click(getByText("Start with MongoDB")); - await waitFor(() => { - expect(handler).toHaveBeenCalledTimes(1); - expect(handler).toHaveBeenCalledWith(ConnectorIds.Destinations.MongoDb); - }); - }); -}); diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.tsx b/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.tsx deleted file mode 100644 index fa48d10a703d..000000000000 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/StartWithDestinationCard.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React from "react"; -import { useIntl } from "react-intl"; - -import { ConnectorCard } from "components"; -import { Card } from "components/ui/Card"; - -import { DestinationConnectorCard } from "../../types"; -import styles from "./StartWithDestinationCard.module.scss"; - -export interface StartWithDestinationProps { - destination: DestinationConnectorCard | undefined; - onDestinationSelect: (id: string) => void; -} - -export const StartWithDestinationCard: React.FC = ({ destination, onDestinationSelect }) => { - const { formatMessage } = useIntl(); - - if (!destination) { - return null; - } - const { icon, releaseStage, name, destinationDefinitionId } = destination; - - const connectorCardClickHandler = () => { - onDestinationSelect(destinationDefinitionId); - }; - - return ( - - ); -}; diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/__snapshots__/StartWithDestinationCard.test.tsx.snap b/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/__snapshots__/StartWithDestinationCard.test.tsx.snap deleted file mode 100644 index 747127951891..000000000000 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/__snapshots__/StartWithDestinationCard.test.tsx.snap +++ /dev/null @@ -1,61 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should renders without crash with provided props 1`] = ` - -
- -
- -`; diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/index.stories.tsx b/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/index.stories.tsx deleted file mode 100644 index 7b4bb0167638..000000000000 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/index.stories.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { ComponentMeta, ComponentStory } from "@storybook/react"; - -import { mockData } from "../../../../../test-utils/mock-data/mockStartWithDestination"; -import { StartWithDestinationCard } from "./StartWithDestinationCard"; - -export default { - title: "Views/StartWithDestination", - component: StartWithDestinationCard, - args: { - destination: mockData, - onDestinationSelect: () => { - return undefined; - }, - }, -} as ComponentMeta; - -export const Template: ComponentStory = (args) => ( -
- -
-); diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/index.ts b/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/index.ts deleted file mode 100644 index 1db176b3b1a6..000000000000 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/components/StartWithDestination/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { StartWithDestination } from "./StartWithDestination"; diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/index.tsx b/airbyte-webapp/src/views/Connector/ConnectorForm/index.tsx index 38f44049f637..683fe9636173 100644 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/index.tsx +++ b/airbyte-webapp/src/views/Connector/ConnectorForm/index.tsx @@ -1,5 +1,4 @@ export * from "./types"; export * from "./ConnectorForm"; -export { StartWithDestination } from "./components/StartWithDestination"; export { FrequentlyUsedConnectors } from "./components/FrequentlyUsedConnectors";