fix: assignee dropdown, sign in button, and onboarding flicker fix (#1242)

This commit is contained in:
Anmol Singh Bhatia 2023-06-07 17:45:57 +05:30 committed by GitHub
parent 3d5fcbd4ce
commit 78c1a64690
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 116 additions and 112 deletions

View file

@ -21,6 +21,7 @@ export const EmailCodeForm = ({ onSuccess }: any) => {
const [codeResent, setCodeResent] = useState(false);
const [isCodeResending, setIsCodeResending] = useState(false);
const [errorResendingCode, setErrorResendingCode] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const { setToastAlert } = useToast();
const { timer: resendCodeTimer, setTimer: setResendCodeTimer } = useTimer();
@ -64,26 +65,19 @@ export const EmailCodeForm = ({ onSuccess }: any) => {
};
const handleSignin = async (formData: EmailCodeFormValues) => {
await authenticationService
.magicSignIn(formData)
.then(() => {
setToastAlert({
title: "Success",
type: "success",
message: "Successfully logged in!",
});
})
.catch((error) => {
setToastAlert({
title: "Oops!",
type: "error",
message: error?.response?.data?.error ?? "Enter the correct code to sign in",
});
setError("token" as keyof EmailCodeFormValues, {
type: "manual",
message: error.error,
});
setIsLoading(true);
await authenticationService.magicSignIn(formData).catch((error) => {
setIsLoading(false);
setToastAlert({
title: "Oops!",
type: "error",
message: error?.response?.data?.error ?? "Enter the correct code to sign in",
});
setError("token" as keyof EmailCodeFormValues, {
type: "manual",
message: error.error,
});
});
};
const emailOld = getValues("email");
@ -200,9 +194,9 @@ export const EmailCodeForm = ({ onSuccess }: any) => {
size="md"
onClick={handleSubmit(handleSignin)}
disabled={!isValid && isDirty}
loading={isSubmitting}
loading={isLoading}
>
{isSubmitting ? "Signing in..." : "Sign in"}
{isLoading ? "Signing in..." : "Sign in"}
</PrimaryButton>
) : (
<PrimaryButton

View file

@ -126,7 +126,7 @@ export const ViewAssigneeSelect: React.FC<Props> = ({
position={position}
disabled={isNotAllowed}
selfPositioned={selfPositioned}
dropdownWidth="w-full min-w-[8rem]"
dropdownWidth="w-full min-w-[12rem]"
/>
);
};