Skip to content

Commit 02111d7

Browse files
authored
promote: staging to production
2 parents 49f19c2 + c3aa1cb commit 02111d7

File tree

14 files changed

+236
-214
lines changed

14 files changed

+236
-214
lines changed

apiserver/runtime.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.11.3
1+
python-3.11.4

apps/app/components/account/email-code-form.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type EmailCodeFormValues = {
1616
token?: string;
1717
};
1818

19-
export const EmailCodeForm = ({ onSuccess }: any) => {
19+
export const EmailCodeForm = ({ handleSignIn }: any) => {
2020
const [codeSent, setCodeSent] = useState(false);
2121
const [codeResent, setCodeResent] = useState(false);
2222
const [isCodeResending, setIsCodeResending] = useState(false);
@@ -66,18 +66,23 @@ export const EmailCodeForm = ({ onSuccess }: any) => {
6666

6767
const handleSignin = async (formData: EmailCodeFormValues) => {
6868
setIsLoading(true);
69-
await authenticationService.magicSignIn(formData).catch((error) => {
70-
setIsLoading(false);
71-
setToastAlert({
72-
title: "Oops!",
73-
type: "error",
74-
message: error?.response?.data?.error ?? "Enter the correct code to sign in",
75-
});
76-
setError("token" as keyof EmailCodeFormValues, {
77-
type: "manual",
78-
message: error.error,
69+
await authenticationService
70+
.magicSignIn(formData)
71+
.then((response) => {
72+
handleSignIn(response);
73+
})
74+
.catch((error) => {
75+
setIsLoading(false);
76+
setToastAlert({
77+
title: "Oops!",
78+
type: "error",
79+
message: error?.response?.data?.error ?? "Enter the correct code to sign in",
80+
});
81+
setError("token" as keyof EmailCodeFormValues, {
82+
type: "manual",
83+
message: error?.error,
84+
});
7985
});
80-
});
8186
};
8287

8388
const emailOld = getValues("email");

apps/app/components/account/github-login-button.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ export const GithubLoginButton: FC<GithubLoginButtonProps> = (props) => {
1919
} = useRouter();
2020
// states
2121
const [loginCallBackURL, setLoginCallBackURL] = useState(undefined);
22+
const [gitCode, setGitCode] = useState<null | string>(null);
2223

2324
useEffect(() => {
24-
if (code) {
25+
if (code && !gitCode) {
26+
setGitCode(code.toString());
2527
handleSignIn(code.toString());
2628
}
27-
}, [code, handleSignIn]);
29+
}, [code, gitCode, handleSignIn]);
2830

2931
useEffect(() => {
3032
const origin =
@@ -33,12 +35,12 @@ export const GithubLoginButton: FC<GithubLoginButtonProps> = (props) => {
3335
}, []);
3436

3537
return (
36-
<div className="w-full px-1">
38+
<div className="w-full flex justify-center items-center px-[3px]">
3739
<Link
3840
href={`https://github.com/login/oauth/authorize?client_id=${NEXT_PUBLIC_GITHUB_ID}&redirect_uri=${loginCallBackURL}&scope=read:user,user:email`}
3941
>
40-
<button className="flex w-full items-center justify-center gap-3 rounded-md border border-brand-base p-2 text-sm font-medium text-brand-secondary duration-300 hover:bg-brand-surface-2">
41-
<Image src={githubImage} height={22} width={22} color="#000" alt="GitHub Logo" />
42+
<button className="flex w-full items-center justify-center gap-3 rounded border border-brand-base p-2 text-sm font-medium text-brand-secondary duration-300 hover:bg-brand-surface-2">
43+
<Image src={githubImage} height={20} width={20} color="#000" alt="GitHub Logo" />
4244
<span>Sign In with Github</span>
4345
</button>
4446
</Link>

apps/app/components/account/google-login.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ export const GoogleLoginButton: FC<IGoogleLoginButton> = (props) => {
4747
return (
4848
<>
4949
<Script src="https://accounts.google.com/gsi/client" async defer onLoad={loadScript} />
50-
<div className="overflow-hidden rounded" id="googleSignInButton" ref={googleSignInButton} />
50+
<div
51+
className="overflow-hidden rounded w-full flex justify-center items-center"
52+
id="googleSignInButton"
53+
ref={googleSignInButton}
54+
/>
5155
</>
5256
);
5357
};

apps/app/components/onboarding/invite-members.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ICurrentUserResponse, IUser } from "types";
77
import { MultiInput, PrimaryButton, SecondaryButton } from "components/ui";
88

99
type Props = {
10-
setStep: React.Dispatch<React.SetStateAction<number>>;
10+
setStep: React.Dispatch<React.SetStateAction<number | null>>;
1111
workspace: any;
1212
user: ICurrentUserResponse | undefined;
1313
};

apps/app/components/onboarding/user-details.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const defaultValues: Partial<IUser> = {
2121

2222
type Props = {
2323
user?: IUser;
24-
setStep: React.Dispatch<React.SetStateAction<number>>;
24+
setStep: React.Dispatch<React.SetStateAction<number | null>>;
2525
setUserRole: React.Dispatch<React.SetStateAction<string | null>>;
2626
};
2727

apps/app/components/onboarding/workspace.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { PrimaryButton } from "components/ui";
1717
import { getFirstCharacters, truncateText } from "helpers/string.helper";
1818

1919
type Props = {
20-
setStep: React.Dispatch<React.SetStateAction<number>>;
20+
setStep: React.Dispatch<React.SetStateAction<number | null>>;
2121
setWorkspace: React.Dispatch<React.SetStateAction<any>>;
2222
user: ICurrentUserResponse | undefined;
2323
};

apps/app/components/workspace/create-workspace-form.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { mutate } from "swr";
66
import { Controller, useForm } from "react-hook-form";
77
// services
88
import workspaceService from "services/workspace.service";
9+
import userService from "services/user.service";
910
// hooks
1011
import useToast from "hooks/use-toast";
1112
// ui
@@ -77,7 +78,7 @@ export const CreateWorkspaceForm: React.FC<Props> = ({
7778
message: "Workspace created successfully.",
7879
});
7980
mutate<IWorkspace[]>(USER_WORKSPACES, (prevData) => [res, ...(prevData ?? [])]);
80-
onSubmit(res);
81+
updateLastWorkspaceIdUnderUSer(res);
8182
})
8283
.catch((err) => {
8384
console.error(err);
@@ -93,6 +94,18 @@ export const CreateWorkspaceForm: React.FC<Props> = ({
9394
});
9495
};
9596

97+
// update last_workspace_id
98+
const updateLastWorkspaceIdUnderUSer = (workspace: any) => {
99+
userService
100+
.updateUser({ last_workspace_id: workspace.id })
101+
.then((res) => {
102+
onSubmit(workspace);
103+
})
104+
.catch((err) => {
105+
console.log(err);
106+
});
107+
};
108+
96109
useEffect(
97110
() => () => {
98111
// when the component unmounts set the default values to whatever user typed in

apps/app/hooks/use-user-auth.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const useUserAuth = (routeAuth: "sign-in" | "onboarding" | "admin" | null = "adm
2424
mutate,
2525
} = useSWR<ICurrentUserResponse>(CURRENT_USER, () => userService.currentUser(), {
2626
refreshInterval: 0,
27+
shouldRetryOnError: false,
2728
});
2829

2930
useEffect(() => {

apps/app/pages/[workspaceSlug]/analytics.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@ const Analytics = () => {
6969
useEffect(() => {
7070
if (!workspaceSlug) return;
7171

72-
trackEventServices.trackAnalyticsEvent(
73-
{ workspaceSlug: workspaceSlug?.toString() },
74-
"WORKSPACE_SCOPE_AND_DEMAND_ANALYTICS",
75-
user
76-
);
77-
}, [workspaceSlug]);
72+
if (user && workspaceSlug)
73+
trackEventServices.trackAnalyticsEvent(
74+
{ workspaceSlug: workspaceSlug?.toString() },
75+
"WORKSPACE_SCOPE_AND_DEMAND_ANALYTICS",
76+
user
77+
);
78+
}, [user, workspaceSlug]);
7879

7980
return (
8081
<WorkspaceAuthorizationLayout

0 commit comments

Comments
 (0)