From 48ddd255d6c7c18acbbe22d417944a10ceba775b Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Wed, 4 Sep 2024 13:19:08 +0300 Subject: [PATCH] feat: connect welcome to sdk dialog (#8078) Now welcome screen is connected to sdk dialog. --- .../ProjectFeatureToggles.tsx | 16 ++++++++++++---- .../ProjectOnboarding/ProjectOnboarding.tsx | 11 +++++++++-- .../ProjectOnboarding/WelcomeToProject.test.tsx | 14 ++++++++++++-- .../ProjectOnboarding/WelcomeToProject.tsx | 10 ++++++++-- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx index 1827870a41..42d7ef2bdd 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx @@ -1,4 +1,4 @@ -import { useCallback, useMemo } from 'react'; +import { useCallback, useMemo, useState } from 'react'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { PageContent } from 'component/common/PageContent/PageContent'; import { useRequiredPathParam } from 'hooks/useRequiredPathParam'; @@ -67,6 +67,7 @@ export const ProjectFeatureToggles = ({ const onboardingUIEnabled = useUiFlag('onboardingUI'); const projectId = useRequiredPathParam('projectId'); const { project } = useProjectOverview(projectId); + const [connectSdkOpen, setConnectSdkOpen] = useState(false); const { features, @@ -402,7 +403,12 @@ export const ProjectFeatureToggles = ({ onboardingUIEnabled && project.onboardingStatus.status !== 'onboarded' } - show={} + show={ + + } /> {}} + open={connectSdkOpen} + onClose={() => { + setConnectSdkOpen(false); + }} project={projectId} environments={environments} /> diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/ProjectOnboarding.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/ProjectOnboarding.tsx index 1f73a70f54..c46a1f9fdb 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/ProjectOnboarding.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/ProjectOnboarding.tsx @@ -3,6 +3,7 @@ import { WelcomeToProject } from './WelcomeToProject'; interface IProjectOnboardingProps { projectId: string; + setConnectSdkOpen: (open: boolean) => void; } const Container = styled('div')(({ theme }) => ({ @@ -18,10 +19,16 @@ const SdkExample = styled('div')(({ theme }) => ({ borderRadius: theme.shape.borderRadiusLarge, })); -export const ProjectOnboarding = ({ projectId }: IProjectOnboardingProps) => { +export const ProjectOnboarding = ({ + projectId, + setConnectSdkOpen, +}: IProjectOnboardingProps) => { return ( - + View SDK example ); diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/WelcomeToProject.test.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/WelcomeToProject.test.tsx index 95671e26f5..b9f34b659d 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/WelcomeToProject.test.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/WelcomeToProject.test.tsx @@ -17,7 +17,12 @@ test('Project can start onboarding', async () => { } + element={ + {}} + /> + } /> , { @@ -39,7 +44,12 @@ test('Project can connect SDK', async () => { } + element={ + {}} + /> + } /> , { diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/WelcomeToProject.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/WelcomeToProject.tsx index 55014d43e5..3254e8a578 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/WelcomeToProject.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOnboarding/WelcomeToProject.tsx @@ -12,6 +12,7 @@ import useFeatureTypes from 'hooks/api/getters/useFeatureTypes/useFeatureTypes'; interface IWelcomeToProjectProps { projectId: string; + setConnectSdkOpen: (open: boolean) => void; } interface IExistingFlagsProps { @@ -81,7 +82,10 @@ const StyledLink = styled(Link)({ justifyContent: 'center', }); -export const WelcomeToProject = ({ projectId }: IWelcomeToProjectProps) => { +export const WelcomeToProject = ({ + projectId, + setConnectSdkOpen, +}: IWelcomeToProjectProps) => { const { project } = useProjectOverview(projectId); const isFirstFlagCreated = project.onboardingStatus.status === 'first-flag-created'; @@ -117,7 +121,9 @@ export const WelcomeToProject = ({ projectId }: IWelcomeToProjectProps) => { We have not detected any connected SDKs on this project. {}} + onClick={() => { + setConnectSdkOpen(true); + }} maxWidth='200px' projectId={projectId} Icon={Add}