0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-31 22:51:25 -05:00

fix(console,core): only show enabled connectors in sign in methods (#988)

This commit is contained in:
Wang Sijie 2022-05-30 16:28:04 +08:00 committed by GitHub
parent b9131e9765
commit 4768181bf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 11 deletions

View file

@ -1,9 +1,5 @@
@use '@/scss/underscore' as _;
.disabled {
color: var(--color-disabled);
}
.title {
display: flex;
align-items: center;

View file

@ -1,5 +1,4 @@
import { ConnectorType } from '@logto/schemas';
import { conditionalString } from '@silverhand/essentials';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';
@ -33,17 +32,15 @@ const ConnectorsTransfer = ({ value, onChange }: Props) => {
const datasource = data
? data
.filter(({ type }) => type === ConnectorType.Social)
.map(({ target, name, enabled, connectors, logo }) => ({
.filter(({ enabled }) => enabled)
.map(({ target, name, connectors, logo }) => ({
value: target,
title: (
<div className={styles.title}>
<div className={styles.logo}>
<img src={logo} alt={target} />
</div>
<UnnamedTrans
resource={name}
className={conditionalString(!enabled && styles.disabled)}
/>
<UnnamedTrans resource={name} />
{connectors.length > 1 &&
connectors
.filter(({ enabled }) => enabled)

View file

@ -15,7 +15,7 @@ export default function signInSettingsRoutes<T extends AnonymousRouter>(router:
Array<ConnectorMetadata & { id: string }>
>((previous, connectorTarget) => {
const connectors = connectorInstances.filter(
({ metadata: { target } }) => target === connectorTarget
({ metadata: { target }, connector: { enabled } }) => target === connectorTarget && enabled
);
return [