diff --git a/apps/backend/src/api/routes/integrations.controller.ts b/apps/backend/src/api/routes/integrations.controller.ts index 7f3c31b1..40cf9c58 100644 --- a/apps/backend/src/api/routes/integrations.controller.ts +++ b/apps/backend/src/api/routes/integrations.controller.ts @@ -195,7 +195,8 @@ export class IntegrationsController { async getIntegrationUrl( @Param('integration') integration: string, @Query('refresh') refresh: string, - @Query('externalUrl') externalUrl: string + @Query('externalUrl') externalUrl: string, + @Query('onboarding') onboarding: string ) { if ( !this._integrationManager @@ -227,6 +228,10 @@ export class IntegrationsController { await ioRedis.set(`refresh:${state}`, refresh, 'EX', 300); } + if (onboarding === 'true') { + await ioRedis.set(`onboarding:${state}`, 'true', 'EX', 300); + } + await ioRedis.set(`login:${state}`, codeVerifier, 'EX', 300); await ioRedis.set( `external:${state}`, @@ -409,6 +414,11 @@ export class IntegrationsController { await ioRedis.del(`refresh:${body.state}`); } + const onboarding = await ioRedis.get(`onboarding:${body.state}`); + if (onboarding) { + await ioRedis.del(`onboarding:${body.state}`); + } + const { error, accessToken, @@ -520,7 +530,10 @@ export class IntegrationsController { console.log(err); }); - return createUpdate; + return { + ...createUpdate, + onboarding: onboarding === 'true', + }; } @Post('/disable') diff --git a/apps/frontend/src/components/launches/add.provider.component.tsx b/apps/frontend/src/components/launches/add.provider.component.tsx index 264658f3..589063c6 100644 --- a/apps/frontend/src/components/launches/add.provider.component.tsx +++ b/apps/frontend/src/components/launches/add.provider.component.tsx @@ -1,14 +1,14 @@ 'use client'; import { useModals } from '@gitroom/frontend/components/layout/new-modal'; -import React, { FC, useCallback, useEffect, useMemo } from 'react'; +import React, { FC, useCallback, useMemo } from 'react'; import { useFetch } from '@gitroom/helpers/utils/custom.fetch'; import { Input } from '@gitroom/react/form/input'; import { FieldValues, FormProvider, useForm } from 'react-hook-form'; import { Button } from '@gitroom/react/form/button'; import { classValidatorResolver } from '@hookform/resolvers/class-validator'; import { ApiKeyDto } from '@gitroom/nestjs-libraries/dtos/integrations/api.key.dto'; -import { useRouter, useSearchParams } from 'next/navigation'; +import { useRouter } from 'next/navigation'; import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.title.component'; import { useVariables } from '@gitroom/react/helpers/variable.context'; import { useToaster } from '@gitroom/react/toaster/toaster'; @@ -35,16 +35,9 @@ export const AddProviderButton: FC<{ update?: () => void; }> = (props) => { const { update } = props; - const query = useSearchParams(); const add = useAddProvider(update); const t = useT(); - useEffect(() => { - if (query.get('onboarding')) { - add(); - } - }, []); - return ( + + + ); +}; + +const OnboardingStep2: FC<{ onBack: () => void; onFinish: () => void }> = ({ + onBack, + onFinish, +}) => { + const t = useT(); + + return ( +
+
+
+ {t('watch_tutorial_title', 'Learn How to Use Postiz')} +
+
+ {t( + 'watch_tutorial_description', + 'Watch this short video to learn how to get the most out of Postiz' + )} +
+
+ + {/* YouTube Video Embed */} +
+
+