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

6814 / skip onboarding button #6890

Merged
merged 3 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 28 additions & 9 deletions airbyte-webapp/src/pages/OnboardingPage/OnboardingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Suspense, useEffect, useState } from "react";
import styled from "styled-components";
import { useResource } from "rest-hooks";

import { Button } from "components";
import HeadTitle from "components/HeadTitle";
import useSource, { useSourceList } from "hooks/services/useSourceHook";
import useDestination, {
Expand All @@ -28,6 +29,7 @@ import LoadingPage from "components/LoadingPage";
import useWorkspace from "hooks/services/useWorkspace";
import useRouterHook from "hooks/useRouter";
import { Routes } from "pages/routes";
import { FormattedMessage } from "react-intl";

const Content = styled.div<{ big?: boolean; medium?: boolean }>`
width: 100%;
Expand All @@ -41,6 +43,17 @@ const Content = styled.div<{ big?: boolean; medium?: boolean }>`
position: relative;
z-index: 2;
`;

const Footer = styled.div`
width: 100%;
height: 100px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
padding: 40px 20px 0;
`;

const ScreenContent = styled.div`
width: 100%;
position: relative;
Expand Down Expand Up @@ -96,6 +109,11 @@ const OnboardingPage: React.FC = () => {
const getDestinationDefinitionById = (id: string) =>
destinationDefinitions.find((item) => item.destinationDefinitionId === id);

const handleFinishOnboarding = () => {
finishOnboarding();
push(Routes.Connections);
};

const renderStep = () => {
if (currentStep === StepType.INSTRUCTION) {
const onStart = () => setCurrentStep(StepType.CREATE_SOURCE);
Expand Down Expand Up @@ -204,17 +222,9 @@ const OnboardingPage: React.FC = () => {
}

const onSync = () => syncConnection(connections[0]);
const onCloseOnboarding = () => {
finishOnboarding();
push(Routes.Connections);
};

return (
<FinalStep
connectionId={connections[0].connectionId}
onSync={onSync}
onFinishOnboarding={onCloseOnboarding}
/>
<FinalStep connectionId={connections[0].connectionId} onSync={onSync} />
);
};

Expand All @@ -235,6 +245,15 @@ const OnboardingPage: React.FC = () => {
<StepsCounter steps={steps} currentStep={currentStep} />

<Suspense fallback={<LoadingPage />}>{renderStep()}</Suspense>
<Footer>
<Button secondary onClick={() => handleFinishOnboarding()}>
{currentStep === StepType.FINAl ? (
<FormattedMessage id="onboarding.closeOnboarding" />
) : (
<FormattedMessage id="onboarding.skipOnboarding" />
)}
</Button>
</Footer>
</Content>
</ScreenContent>
);
Expand Down
17 changes: 2 additions & 15 deletions airbyte-webapp/src/pages/OnboardingPage/components/FinalStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useResource, useSubscription } from "rest-hooks";
import VideoItem from "./VideoItem";
import ProgressBlock from "./ProgressBlock";
import HighlightedText from "./HighlightedText";
import { H1, Button } from "components/base";
import { H1 } from "components/base";
import UseCaseBlock from "./UseCaseBlock";
import ConnectionResource from "core/resources/Connection";
import SyncCompletedModal from "views/Feedback/SyncCompletedModal";
Expand All @@ -17,7 +17,6 @@ import useWorkspace from "hooks/services/useWorkspace";
type FinalStepProps = {
connectionId: string;
onSync: () => void;
onFinishOnboarding: () => void;
};

const Title = styled(H1)`
Expand All @@ -35,15 +34,7 @@ const Videos = styled.div`
padding: 0 27px;
`;

const CloseButton = styled(Button)`
margin-top: 30px;
`;

const FinalStep: React.FC<FinalStepProps> = ({
connectionId,
onSync,
onFinishOnboarding,
}) => {
const FinalStep: React.FC<FinalStepProps> = ({ connectionId, onSync }) => {
const { sendFeedback } = useWorkspace();
const {
feedbackPassed,
Expand Down Expand Up @@ -119,10 +110,6 @@ const FinalStep: React.FC<FinalStepProps> = ({
/>
))}

<CloseButton secondary onClick={onFinishOnboarding}>
<FormattedMessage id="onboarding.closeOnboarding" />
</CloseButton>

{isOpen ? (
<SyncCompletedModal
onClose={() => setIsOpen(false)}
Expand Down