0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-20 21:32:31 -05:00

refactor(console): make the inline connector setup warning display only once (#2380)

This commit is contained in:
Xiao Yijun 2022-11-10 16:24:02 +08:00 committed by GitHub
parent 55ca9e5a92
commit 3137450ccf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View file

@ -5,7 +5,10 @@ import FormField from '@/components/FormField';
import type { SignInExperienceForm } from '../../types';
import SignInMethodEditBox from './components/SignInMethodEditBox';
import { signUpToSignInIdentifierMapping } from './constants';
import {
signUpIdentifierToRequiredConnectorMapping,
signUpToSignInIdentifierMapping,
} from './constants';
import * as styles from './index.module.scss';
const SignInForm = () => {
@ -41,6 +44,9 @@ const SignInForm = () => {
<SignInMethodEditBox
value={value}
requiredSignInIdentifiers={signUpToSignInIdentifierMapping[signUpIdentifier]}
ignoredWarningConnectors={
signUpIdentifierToRequiredConnectorMapping[signUpIdentifier]
}
isSignUpPasswordRequired={setupPasswordAtSignUp}
isSignUpVerificationRequired={setupVerificationAtSignUp}
onChange={onChange}

View file

@ -23,6 +23,7 @@ type Props = {
value: SignInMethod[];
onChange: (value: SignInMethod[]) => void;
requiredSignInIdentifiers: SignInIdentifier[];
ignoredWarningConnectors: ConnectorType[];
isSignUpPasswordRequired: boolean;
isSignUpVerificationRequired: boolean;
};
@ -31,6 +32,7 @@ const SignInMethodEditBox = ({
value,
onChange,
requiredSignInIdentifiers,
ignoredWarningConnectors,
isSignUpPasswordRequired,
isSignUpVerificationRequired,
}: Props) => {
@ -153,12 +155,11 @@ const SignInMethodEditBox = ({
))}
</DragDropProvider>
<ConnectorSetupWarning
requiredConnectors={value.reduce<ConnectorType[]>(
(connectors, { identifier: signInIdentifier }) => {
requiredConnectors={value
.reduce<ConnectorType[]>((connectors, { identifier: signInIdentifier }) => {
return [...connectors, ...signInIdentifierToRequiredConnectorMapping[signInIdentifier]];
},
[]
)}
}, [])
.filter((connector) => !ignoredWarningConnectors.includes(connector))}
/>
<AddButton
options={signInIdentifierOptions}