Skip to content

Commit

Permalink
feat: APP-360 redirect to project buy after google login (#2494)
Browse files Browse the repository at this point in the history
  • Loading branch information
r41ph authored Oct 23, 2024
1 parent 082e8aa commit 183d001
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ const ListProject = () => {
</Body>
)}
<LoginFlow
createProject
isConnectingRef={isConnectingRef}
isModalOpen={isModalOpen}
onModalClose={onModalClose}
wallets={checkIsMobile() ? [] : [walletsUiConfig[0]]}
modalState={modalState}
redirectRoute="project-pages/draft/basic-info"
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
{
Expand All @@ -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}` : ''
}`;
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ type Props = {
wallets: LoginProvider[];
modalState: LoginModalState;
qrCodeUri?: string;
createProject?: boolean;
isConnectingRef?: React.MutableRefObject<boolean>;
onlyWallets?: boolean;
redirectRoute?: string;
};

const LoginFlow = ({
isModalOpen,
onModalClose,
wallets,
modalState,
createProject,
isConnectingRef,
onlyWallets,
redirectRoute,
}: Props) => {
const { _ } = useLingui();
const {
Expand All @@ -59,7 +59,7 @@ const LoginFlow = ({
isWaitingForSigningAtom,
);
const { loginDisabled } = useWallet();
const socialProviders = useSocialProviders(createProject);
const socialProviders = useSocialProviders(redirectRoute);

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion web-marketplace/src/lib/i18n/locales/en.po
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion web-marketplace/src/lib/i18n/locales/es.po
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 2 additions & 1 deletion web-marketplace/src/pages/BuyCredits/BuyCredits.Form.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -328,6 +328,7 @@ export const BuyCreditsForm = ({
onModalClose={onModalClose}
wallets={walletsUiConfig}
modalState={modalState}
redirectRoute={`${projectHref.replace(/^\//, '')}/buy`}
/>
</div>
);
Expand Down

0 comments on commit 183d001

Please sign in to comment.