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:
parent
55ca9e5a92
commit
3137450ccf
2 changed files with 13 additions and 6 deletions
|
@ -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}
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Add table
Reference in a new issue