Skip to content

Commit

Permalink
chore(sso): hide sso signin button
Browse files Browse the repository at this point in the history
  • Loading branch information
AMoreaux committed Oct 10, 2024
1 parent b9c4c19 commit b9a915e
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useMemo, useState } from 'react';
import { Controller } from 'react-hook-form';
import { useRecoilState, useRecoilValue } from 'recoil';
import { Key } from 'ts-key-enum';
import { IconGoogle, IconKey, IconMicrosoft } from 'twenty-ui';
import { IconGoogle, IconMicrosoft } from 'twenty-ui';

import { FooterNote } from '@/auth/sign-in-up/components/FooterNote';
import { HorizontalSeparator } from '@/auth/sign-in-up/components/HorizontalSeparator';
Expand Down Expand Up @@ -61,18 +61,18 @@ export const SignInUpForm = () => {
signInUpMode,
continueWithCredentials,
continueWithEmail,
continueWithSSO,
// continueWithSSO,
submitCredentials,
submitSSOEmail,
} = useSignInUp(form);

const toggleSSOMode = () => {
if (signInUpStep === SignInUpStep.EmailSSO) {
continueWithEmail();
} else {
continueWithSSO();
}
};
// const toggleSSOMode = () => {
// if (signInUpStep === SignInUpStep.EmailSSO) {
// continueWithEmail();
// } else {
// continueWithSSO();
// }
// };

const handleKeyDown = async (
event: React.KeyboardEvent<HTMLInputElement>,
Expand Down Expand Up @@ -160,16 +160,16 @@ export const SignInUpForm = () => {
<HorizontalSeparator visible={false} />
</>
)}
<MainButton
Icon={() => <IconKey size={theme.icon.size.md} />}
title={
signInUpStep === SignInUpStep.EmailSSO
? 'Continue with email'
: 'Single sign-on (SSO)'
}
onClick={toggleSSOMode}
fullWidth
/>
{/*<MainButton*/}
{/* Icon={() => <IconKey size={theme.icon.size.md} />}*/}
{/* title={*/}
{/* signInUpStep === SignInUpStep.EmailSSO*/}
{/* ? 'Continue with email'*/}
{/* : 'Single sign-on (SSO)'*/}
{/* }*/}
{/* onClick={toggleSSOMode}*/}
{/* fullWidth*/}
{/*/>*/}
<HorizontalSeparator visible={true} />

{authProviders.password &&
Expand Down Expand Up @@ -277,60 +277,60 @@ export const SignInUpForm = () => {
/>
</StyledForm>
)}
{/*<StyledForm*/}
{/* onSubmit={(event) => {*/}
{/* event.preventDefault();*/}
{/* }}*/}
{/*>*/}
{/* {signInUpStep === SignInUpStep.EmailSSO && (*/}
{/* <>*/}
{/* <StyledFullWidthMotionDiv*/}
{/* initial={{ opacity: 0, height: 0 }}*/}
{/* animate={{ opacity: 1, height: 'auto' }}*/}
{/* transition={{*/}
{/* type: 'spring',*/}
{/* stiffness: 800,*/}
{/* damping: 35,*/}
{/* }}*/}
{/* >*/}
{/* <Controller*/}
{/* name="email"*/}
{/* control={form.control}*/}
{/* render={({*/}
{/* field: { onChange, onBlur, value },*/}
{/* fieldState: { error },*/}
{/* }) => (*/}
{/* <StyledInputContainer>*/}
{/* <TextInput*/}
{/* autoFocus*/}
{/* value={value}*/}
{/* placeholder="Email"*/}
{/* onBlur={onBlur}*/}
{/* onChange={onChange}*/}
{/* error={showErrors ? error?.message : undefined}*/}
{/* fullWidth*/}
{/* disableHotkeys*/}
{/* onKeyDown={handleKeyDown}*/}
{/* />*/}
{/* </StyledInputContainer>*/}
{/* )}*/}
{/* />*/}
{/* </StyledFullWidthMotionDiv>*/}
{/* <MainButton*/}
{/* variant="secondary"*/}
{/* title={buttonTitle}*/}
{/* type="submit"*/}
{/* onClick={async () => {*/}
{/* setShowErrors(true);*/}
{/* submitSSOEmail(form.getValues('email'));*/}
{/* }}*/}
{/* Icon={() => form.formState.isSubmitting && <Loader />}*/}
{/* disabled={isSubmitButtonDisabled}*/}
{/* fullWidth*/}
{/* />*/}
{/* </>*/}
{/* )}*/}
{/*</StyledForm>*/}
<StyledForm
onSubmit={(event) => {
event.preventDefault();
}}
>
{signInUpStep === SignInUpStep.EmailSSO && (
<>
<StyledFullWidthMotionDiv
initial={{ opacity: 0, height: 0 }}
animate={{ opacity: 1, height: 'auto' }}
transition={{
type: 'spring',
stiffness: 800,
damping: 35,
}}
>
<Controller
name="email"
control={form.control}
render={({
field: { onChange, onBlur, value },
fieldState: { error },
}) => (
<StyledInputContainer>
<TextInput
autoFocus
value={value}
placeholder="Email"
onBlur={onBlur}
onChange={onChange}
error={showErrors ? error?.message : undefined}
fullWidth
disableHotkeys
onKeyDown={handleKeyDown}
/>
</StyledInputContainer>
)}
/>
</StyledFullWidthMotionDiv>
<MainButton
variant="secondary"
title={buttonTitle}
type="submit"
onClick={async () => {
setShowErrors(true);
submitSSOEmail(form.getValues('email'));
}}
Icon={() => form.formState.isSubmitting && <Loader />}
disabled={isSubmitButtonDisabled}
fullWidth
/>
</>
)}
</StyledForm>
</StyledContentContainer>
{signInUpStep === SignInUpStep.Password && (
<ActionLink onClick={handleResetPassword(form.getValues('email'))}>
Expand Down
11 changes: 6 additions & 5 deletions packages/twenty-front/src/pages/auth/SignInUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { AnimatedEaseIn } from '@/ui/utilities/animation/components/AnimatedEase
import { isDefined } from '~/utils/isDefined';
import { SignInUpStep } from '@/auth/states/signInUpStepState';
import { IconLockCustom } from '@ui/display/icon/components/IconLock';
import { SSOWorkspaceSelection } from './SSOWorkspaceSelection';

export const SignInUp = () => {
const { form } = useSignInUpForm();
Expand Down Expand Up @@ -47,11 +48,11 @@ export const SignInUp = () => {
)}
</AnimatedEaseIn>
<Title animate>{title}</Title>
{/*{signInUpStep === SignInUpStep.SSOWorkspaceSelection ? (*/}
{/* <SSOWorkspaceSelection />*/}
{/*) : (*/}
<SignInUpForm />
{/*)}*/}
{signInUpStep === SignInUpStep.SSOWorkspaceSelection ? (
<SSOWorkspaceSelection />
) : (
<SignInUpForm />
)}
</>
);
};

0 comments on commit b9a915e

Please sign in to comment.