Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪟 🎨 Remove feedback modal from UI #16548

Merged
merged 10 commits into from
Sep 14, 2022
1 change: 0 additions & 1 deletion airbyte-webapp/src/core/analytics/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const enum Action {
DELETE = "Delete",
REQUEST = "Request",
SKIP = "Skip",
FEEDBACK = "Feedback",
PREFERENCES = "Preferences",
NO_MATCHING_CONNECTOR = "NoMatchingConnector",
SELECTION_OPENED = "SelectionOpened",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import casesConfig from "config/casesConfig.json";
import { useCurrentWorkspace } from "hooks/services/useWorkspace";

interface Context {
feedbackPassed?: boolean;
passFeedback: () => void;
visibleUseCases?: string[];
useCaseLinks: Record<string, string>;
skipCase: (skipId: string) => void;
Expand All @@ -16,22 +14,18 @@ export const OnboardingServiceContext = React.createContext<Context | null>(null

export const OnboardingServiceProvider: React.FC = ({ children }) => {
const workspace = useCurrentWorkspace();
const [feedbackPassed, setFeedbackPassed] = useLocalStorage<boolean>(`${workspace.workspaceId}/passFeedback`, false);
const [skippedUseCases, setSkippedUseCases] = useLocalStorage<string[]>(
`${workspace.workspaceId}/skippedUseCases`,
[]
);

const ctx = useMemo<Context>(
() => ({
feedbackPassed,
passFeedback: () => setFeedbackPassed(true),
visibleUseCases: Object.keys(casesConfig).filter((useCase) => !skippedUseCases?.includes(useCase)),
useCaseLinks: casesConfig,
skipCase: (skipId: string) => setSkippedUseCases([...(skippedUseCases ?? []), skipId]),
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[feedbackPassed, skippedUseCases]
[setSkippedUseCases, skippedUseCases]
);

return <OnboardingServiceContext.Provider value={ctx}>{children}</OnboardingServiceContext.Provider>;
Expand Down
21 changes: 0 additions & 21 deletions airbyte-webapp/src/hooks/services/useWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useMutation } from "react-query";

import { Action, Namespace } from "core/analytics";
import { NotificationService } from "core/domain/notification/NotificationService";
import { DestinationRead, SourceRead } from "core/request/AirbyteClient";
import { useAnalyticsService } from "hooks/services/Analytics";
import { useInitService } from "services/useInitService";
import { useCurrentWorkspace, useUpdateWorkspace } from "services/workspaces/WorkspacesService";
Expand Down Expand Up @@ -45,25 +44,6 @@ const useWorkspace = () => {
});
};

const sendFeedback = async ({
feedback,
source,
destination,
}: {
feedback: string;
source: SourceRead;
destination: DestinationRead;
}) => {
analyticsService.track(Namespace.ONBOARDING, Action.FEEDBACK, {
actionDescription: "Onboarding Feedback",
feedback,
connector_source_definition: source?.sourceName,
connector_source_definition_id: source?.sourceDefinitionId,
connector_destination_definition: destination?.destinationName,
connector_destination_definition_id: destination?.destinationDefinitionId,
});
};

const setInitialSetupConfig = async (data: {
email: string;
anonymousDataCollection: boolean;
Expand Down Expand Up @@ -139,7 +119,6 @@ const useWorkspace = () => {
updatePreferences,
updateWebhook,
testWebhook: tryWebhookUrl.mutateAsync,
sendFeedback,
};
};

Expand Down
35 changes: 8 additions & 27 deletions airbyte-webapp/src/pages/OnboardingPage/components/FinalStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import { useConfig } from "config";
import Status from "core/statuses";
import { useOnboardingService } from "hooks/services/Onboarding/OnboardingService";
import { useConnectionList, useGetConnection, useSyncConnection } from "hooks/services/useConnectionHook";
import useWorkspace from "hooks/services/useWorkspace";
import SyncCompletedModal from "views/Feedback/SyncCompletedModal";

import { FirstSuccessfulSync } from "./FirstSuccessfulSync";
import HighlightedText from "./HighlightedText";
import ProgressBlock from "./ProgressBlock";
import UseCaseBlock from "./UseCaseBlock";
Expand All @@ -33,35 +32,19 @@ const Videos = styled.div`

const FinalStep: React.FC = () => {
const config = useConfig();
const { sendFeedback } = useWorkspace();
const { feedbackPassed, passFeedback, visibleUseCases, useCaseLinks, skipCase } = useOnboardingService();
const { visibleUseCases, useCaseLinks, skipCase } = useOnboardingService();
const { mutateAsync: syncConnection } = useSyncConnection();
const { connections } = useConnectionList();
const connection = useGetConnection(connections[0].connectionId, {
refetchInterval: 2500,
});
const [isOpen, setIsOpen] = useState(false);
const [isFirstSyncSuccessful, setIsFirstSyncSuccessful] = useState(false);

useEffect(() => {
if (connection.latestSyncJobStatus === Status.SUCCEEDED && !feedbackPassed) {
setIsOpen(true);
if (connection.latestSyncJobStatus === Status.SUCCEEDED) {
setIsFirstSyncSuccessful(true);
}
}, [connection.latestSyncJobStatus, feedbackPassed]);

const onSkipFeedback = () => {
passFeedback();
setIsOpen(false);
};

const onSendFeedback = (feedback: string) => {
sendFeedback({
feedback,
source: connection.source,
destination: connection.destination,
});
passFeedback();
setIsOpen(false);
};
}, [connection.latestSyncJobStatus]);

const onSync = () => syncConnection(connections[0]);

Expand All @@ -81,8 +64,8 @@ const FinalStep: React.FC = () => {
img="/videoCover.png"
/>
</Videos>
{!feedbackPassed && <ProgressBlock connection={connection} onSync={onSync} />}

<ProgressBlock connection={connection} onSync={onSync} />
{isFirstSyncSuccessful && <FirstSuccessfulSync />}
<Title bold>
<FormattedMessage
id="onboarding.useCases"
Expand All @@ -95,8 +78,6 @@ const FinalStep: React.FC = () => {
{visibleUseCases?.map((item, key) => (
<UseCaseBlock key={item} count={key + 1} href={useCaseLinks[item]} onSkip={skipCase} id={item} />
))}

{isOpen ? <SyncCompletedModal onClose={onSkipFeedback} onPassFeedback={onSendFeedback} /> : null}
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@use "../../../../scss/colors";
@use "../../../../scss/variables";

.container {
width: 100%;
padding: 50px 78px 40px;
background: colors.$dark-blue-900 url("stars-background.svg");
border-radius: variables.$border-radius-md;
position: relative;
}

.rocket {
position: absolute;
width: 180px;
transform: matrix(0.99, 0.12, -0.12, 0.99, 0, 0) rotate(-4.78deg);
top: -54px;
left: calc(50% - 261px / 2 + 24px);
transition: 0.8s;
}

.completedSyncText {
color: colors.$white;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";
import { FormattedMessage } from "react-intl";

import { Text } from "components/base/Text";

import styles from "./FirstSuccessfulSync.module.scss";

export const FirstSuccessfulSync: React.FC = () => {
return (
<div className={styles.container} data-testid="firstSuccessfulSync">
<Text as="h3" size="md" centered className={styles.completedSyncText}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small semantic HTML nitpick: this is not really a header for anything, so I think we should not make this a h3 element but just a regular element. This is currently not possible with the Text component, so I'm happy moving this to another PR so we can merge this. cc @edmundito not sure if this is something we should maybe address in the component, that we can use "heading like" styles also for texts that are semantically not headings like in this case?

<FormattedMessage id="onboarding.syncCompleted" />
</Text>
<img className={styles.rocket} src="/rocket.png" alt="" />
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./FirstSuccessfulSync";

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.