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

refactor(console): connector setup warning (#2249)

This commit is contained in:
Xiao Yijun 2022-10-26 12:02:35 +08:00 committed by GitHub
parent b6a9d1a07e
commit 83e074a3c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 21 deletions

View file

@ -76,11 +76,9 @@ const SignUpForm = () => {
/>
)}
/>
{signUpIdentifier !== SignUpIdentifier.None && (
<ConnectorSetupWarning
requiredConnectors={signUpIdentifierToRequiredConnectorMapping[signUpIdentifier]}
/>
)}
<ConnectorSetupWarning
requiredConnectors={signUpIdentifierToRequiredConnectorMapping[signUpIdentifier]}
/>
</FormField>
{signUpIdentifier !== SignUpIdentifier.None && (
<FormField

View file

@ -18,9 +18,7 @@ const ConnectorSetupWarning = ({ requiredConnectors }: Props) => {
return null;
}
const missingConnectors = (
requiredConnectors.length === 0 ? [ConnectorType.Social] : requiredConnectors
).filter(
const missingConnectors = requiredConnectors.filter(
(connectorType) => !connectors.some(({ type, enabled }) => type === connectorType && enabled)
);

View file

@ -124,19 +124,14 @@ const SignInMethodEditBox = ({
</DraggableItem>
))}
</DragDropProvider>
{requiredSignInIdentifiers.length > 0 && (
<ConnectorSetupWarning
requiredConnectors={requiredSignInIdentifiers.reduce<ConnectorType[]>(
(connectors, signInIdentifier) => {
return [
...connectors,
...signInIdentifierToRequiredConnectorMapping[signInIdentifier],
];
},
[]
)}
/>
)}
<ConnectorSetupWarning
requiredConnectors={value.reduce<ConnectorType[]>(
(connectors, { identifier: signInIdentifier }) => {
return [...connectors, ...signInIdentifierToRequiredConnectorMapping[signInIdentifier]];
},
[]
)}
/>
<AddSignInMethodButton options={signInIdentifierOptions} onSelected={addSignInMethod} />
</div>
);