From 183d00109fa81fa0167c6c9d73c6e1ddbd125f9f Mon Sep 17 00:00:00 2001 From: r41ph Date: Wed, 23 Oct 2024 11:27:34 +0100 Subject: [PATCH] feat: APP-360 redirect to project buy after google login (#2494) --- .../src/components/organisms/ListProject/ListProject.tsx | 2 +- .../organisms/LoginButton/hooks/useSocialProviders.ts | 4 ++-- .../src/components/organisms/LoginFlow/LoginFlow.tsx | 6 +++--- web-marketplace/src/lib/i18n/locales/en.po | 2 +- web-marketplace/src/lib/i18n/locales/es.po | 2 +- web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx | 3 ++- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/web-marketplace/src/components/organisms/ListProject/ListProject.tsx b/web-marketplace/src/components/organisms/ListProject/ListProject.tsx index 985b4c4501..7578ea2ee7 100644 --- a/web-marketplace/src/components/organisms/ListProject/ListProject.tsx +++ b/web-marketplace/src/components/organisms/ListProject/ListProject.tsx @@ -70,12 +70,12 @@ const ListProject = () => { )} ); diff --git a/web-marketplace/src/components/organisms/LoginButton/hooks/useSocialProviders.ts b/web-marketplace/src/components/organisms/LoginButton/hooks/useSocialProviders.ts index 9dfaf703c4..d4f2232e8f 100644 --- a/web-marketplace/src/components/organisms/LoginButton/hooks/useSocialProviders.ts +++ b/web-marketplace/src/components/organisms/LoginButton/hooks/useSocialProviders.ts @@ -2,7 +2,7 @@ import { apiUri } from 'lib/apiUri'; import { GoogleLoginEvent } from 'lib/tracker/types'; import { useTracker } from 'lib/tracker/useTracker'; -export const useSocialProviders = (createProject: boolean = false) => { +export const useSocialProviders = (redirectRoute?: string) => { const { track } = useTracker(); return [ { @@ -14,7 +14,7 @@ export const useSocialProviders = (createProject: boolean = false) => { date: new Date().toUTCString(), }); window.location.href = `${apiUri}/marketplace/v1/auth/google${ - createProject ? '?route=project-pages/draft/basic-info' : '' + redirectRoute ? `?route=${redirectRoute}` : '' }`; }, }, diff --git a/web-marketplace/src/components/organisms/LoginFlow/LoginFlow.tsx b/web-marketplace/src/components/organisms/LoginFlow/LoginFlow.tsx index 16c600fab6..9692832b36 100644 --- a/web-marketplace/src/components/organisms/LoginFlow/LoginFlow.tsx +++ b/web-marketplace/src/components/organisms/LoginFlow/LoginFlow.tsx @@ -30,9 +30,9 @@ type Props = { wallets: LoginProvider[]; modalState: LoginModalState; qrCodeUri?: string; - createProject?: boolean; isConnectingRef?: React.MutableRefObject; onlyWallets?: boolean; + redirectRoute?: string; }; const LoginFlow = ({ @@ -40,9 +40,9 @@ const LoginFlow = ({ onModalClose, wallets, modalState, - createProject, isConnectingRef, onlyWallets, + redirectRoute, }: Props) => { const { _ } = useLingui(); const { @@ -59,7 +59,7 @@ const LoginFlow = ({ isWaitingForSigningAtom, ); const { loginDisabled } = useWallet(); - const socialProviders = useSocialProviders(createProject); + const socialProviders = useSocialProviders(redirectRoute); return ( <> diff --git a/web-marketplace/src/lib/i18n/locales/en.po b/web-marketplace/src/lib/i18n/locales/en.po index fc61558393..f921fd1036 100644 --- a/web-marketplace/src/lib/i18n/locales/en.po +++ b/web-marketplace/src/lib/i18n/locales/en.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"POT-Creation-Date: 2024-10-22 09:37+0100\n" +"POT-Creation-Date: 2024-10-22 10:14+0100\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/web-marketplace/src/lib/i18n/locales/es.po b/web-marketplace/src/lib/i18n/locales/es.po index 4934e23a06..4c59248825 100644 --- a/web-marketplace/src/lib/i18n/locales/es.po +++ b/web-marketplace/src/lib/i18n/locales/es.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"POT-Creation-Date: 2024-10-22 09:37+0100\n" +"POT-Creation-Date: 2024-10-22 10:14+0100\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx b/web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx index eef9807eb7..2b2f7a597e 100644 --- a/web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx +++ b/web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useMemo, useState } from 'react'; +import { useCallback, useEffect, useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; import { Elements } from '@stripe/react-stripe-js'; import { loadStripe, Stripe, StripeElements } from '@stripe/stripe-js'; @@ -328,6 +328,7 @@ export const BuyCreditsForm = ({ onModalClose={onModalClose} wallets={walletsUiConfig} modalState={modalState} + redirectRoute={`${projectHref.replace(/^\//, '')}/buy`} /> );