From 93a5eef9c6a19012816b516dc57296815c02fa87 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 5 Aug 2024 14:36:15 -0500 Subject: [PATCH] Display the onboarding flow to new Nostr users --- src/actions/nostr.ts | 7 ++++++- src/features/onboarding/onboarding-wizard.tsx | 2 +- .../modals/nostr-signup-modal/steps/keygen-step.tsx | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/actions/nostr.ts b/src/actions/nostr.ts index 87d0d86f7..7f60eff5b 100644 --- a/src/actions/nostr.ts +++ b/src/actions/nostr.ts @@ -2,11 +2,12 @@ import { RootState, type AppDispatch } from 'soapbox/store'; import { authLoggedIn, verifyCredentials } from './auth'; import { obtainOAuthToken } from './oauth'; +import { startOnboarding } from './onboarding'; const NOSTR_PUBKEY_SET = 'NOSTR_PUBKEY_SET'; /** Log in with a Nostr pubkey. */ -function logInNostr(pubkey: string) { +function logInNostr(pubkey: string, onboard = false) { return async (dispatch: AppDispatch, getState: () => RootState) => { dispatch(setNostrPubkey(pubkey)); @@ -27,6 +28,10 @@ function logInNostr(pubkey: string) { secret, })); + if (onboard) { + dispatch(startOnboarding()); + } + const { access_token } = dispatch(authLoggedIn(token)); return await dispatch(verifyCredentials(access_token as string)); }; diff --git a/src/features/onboarding/onboarding-wizard.tsx b/src/features/onboarding/onboarding-wizard.tsx index 3c6e5c64c..43255894e 100644 --- a/src/features/onboarding/onboarding-wizard.tsx +++ b/src/features/onboarding/onboarding-wizard.tsx @@ -45,7 +45,7 @@ const OnboardingWizard = () => { , ]; - if (features.federating){ + if (features.federating && !features.nostr) { steps.push(); } diff --git a/src/features/ui/components/modals/nostr-signup-modal/steps/keygen-step.tsx b/src/features/ui/components/modals/nostr-signup-modal/steps/keygen-step.tsx index 83d604fa7..039265283 100644 --- a/src/features/ui/components/modals/nostr-signup-modal/steps/keygen-step.tsx +++ b/src/features/ui/components/modals/nostr-signup-modal/steps/keygen-step.tsx @@ -43,7 +43,7 @@ const KeygenStep: React.FC = ({ onClose }) => { const handleNext = async () => { const signer = NKeys.add(secretKey); const pubkey = await signer.getPublicKey(); - dispatch(logInNostr(pubkey)); + dispatch(logInNostr(pubkey, true)); onClose(); };