diff --git a/frontend/src/component/onboarding/ConnectSDKDialog.tsx b/frontend/src/component/onboarding/ConnectSdkDialog.tsx similarity index 56% rename from frontend/src/component/onboarding/ConnectSDKDialog.tsx rename to frontend/src/component/onboarding/ConnectSdkDialog.tsx index 2979804761..53fa95cf82 100644 --- a/frontend/src/component/onboarding/ConnectSDKDialog.tsx +++ b/frontend/src/component/onboarding/ConnectSdkDialog.tsx @@ -6,7 +6,9 @@ import { useMediaQuery, useTheme, } from '@mui/material'; -import { GenrateApiKeyConcepts, GeneratApiKey } from './GenerateApiKey'; +import { GenrateApiKeyConcepts, GenerateApiKey } from './GenerateApiKey'; +import { useState } from 'react'; +import { SelectSdk } from './SelectSdk'; interface IConnectSDKDialogProps { open: boolean; @@ -53,7 +55,12 @@ const NextStepSectionSpacedContainer = styled('div')(({ theme }) => ({ padding: theme.spacing(3, 8, 3, 8), })); -export const ConnectSDKDialog = ({ +type OnboardingStage = + | { name: 'select-sdk' } + | { name: 'generate-api-key'; sdkType: 'CLIENT' | 'FRONTEND' } + | { name: 'test-connection' }; + +export const ConnectSdkDialog = ({ open, onClose, environments, @@ -61,23 +68,31 @@ export const ConnectSDKDialog = ({ }: IConnectSDKDialogProps) => { const theme = useTheme(); const isLargeScreen = useMediaQuery(theme.breakpoints.up('lg')); + const [stage, setStage] = useState({ name: 'select-sdk' }); return ( - - - - - - - + {stage.name === 'select-sdk' ? : null} + {stage.name === 'generate-api-key' ? ( + + ) : null} + + {stage.name === 'generate-api-key' ? ( + + + + + + + ) : null} {isLargeScreen ? : null} diff --git a/frontend/src/component/onboarding/GenerateApiKey.tsx b/frontend/src/component/onboarding/GenerateApiKey.tsx index cc7b1e1330..985a44b15e 100644 --- a/frontend/src/component/onboarding/GenerateApiKey.tsx +++ b/frontend/src/component/onboarding/GenerateApiKey.tsx @@ -260,15 +260,17 @@ export const GenrateApiKeyConcepts = () => ( ); -interface GeneratApiKeyProps { +interface GenerateApiKeyProps { project: string; environments: string[]; + sdkType: 'CLIENT' | 'FRONTEND'; } -export const GeneratApiKey = ({ +export const GenerateApiKey = ({ environments, project, -}: GeneratApiKeyProps) => { + sdkType, +}: GenerateApiKeyProps) => { const [environment, setEnvironment] = useState(''); useEffect(() => { @@ -291,7 +293,7 @@ export const GeneratApiKey = ({ await createToken( { environment, - type: 'CLIENT', + type: sdkType, projects: [project], username: `api-key-${project}-${environment}`, }, diff --git a/frontend/src/component/onboarding/SelectSdk.tsx b/frontend/src/component/onboarding/SelectSdk.tsx new file mode 100644 index 0000000000..3f18e14239 --- /dev/null +++ b/frontend/src/component/onboarding/SelectSdk.tsx @@ -0,0 +1,27 @@ +import { Box, styled, Typography } from '@mui/material'; + +const SpacedContainer = styled('div')(({ theme }) => ({ + padding: theme.spacing(5, 8, 3, 8), + display: 'flex', + flexDirection: 'column', + gap: theme.spacing(3), +})); + +const SectionHeader = styled('div')(({ theme }) => ({ + fontWeight: theme.fontWeight.bold, + marginBottom: theme.spacing(1), + fontSize: theme.fontSizes.bodySize, +})); + +export const SelectSdk = () => { + return ( + + Connect an SDK to Unleash + + Select SDK + + + ); +}; + +export const SelectSdkConcepts = () => {}; diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx index 183d150412..c073b91202 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx @@ -42,7 +42,7 @@ import { AvatarCell } from './AvatarCell'; import { ProjectOnboarding } from './ProjectOnboarding/ProjectOnboarding'; import { useUiFlag } from 'hooks/useUiFlag'; import { styled } from '@mui/material'; -import { ConnectSDKDialog } from '../../../onboarding/ConnectSDKDialog'; +import { ConnectSdkDialog } from '../../../onboarding/ConnectSdkDialog'; interface IPaginatedProjectFeatureTogglesProps { environments: string[]; @@ -491,7 +491,7 @@ export const ProjectFeatureToggles = ({ {featureToggleModals} - {}} project={projectId}