From 4768181bf77261eb84a1c4cb903fa0a22765d837 Mon Sep 17 00:00:00 2001 From: Wang Sijie Date: Mon, 30 May 2022 16:28:04 +0800 Subject: [PATCH] fix(console,core): only show enabled connectors in sign in methods (#988) --- .../components/ConnectorsTransfer.module.scss | 4 ---- .../SignInExperience/components/ConnectorsTransfer.tsx | 9 +++------ packages/core/src/routes/sign-in-settings.ts | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.module.scss b/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.module.scss index 4d155f8e5..53a32946d 100644 --- a/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.module.scss +++ b/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.module.scss @@ -1,9 +1,5 @@ @use '@/scss/underscore' as _; -.disabled { - color: var(--color-disabled); -} - .title { display: flex; align-items: center; diff --git a/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.tsx b/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.tsx index 21252fc07..4dfdfcf47 100644 --- a/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.tsx +++ b/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.tsx @@ -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: (
{target}
- + {connectors.length > 1 && connectors .filter(({ enabled }) => enabled) diff --git a/packages/core/src/routes/sign-in-settings.ts b/packages/core/src/routes/sign-in-settings.ts index cdfc22579..3c2af8998 100644 --- a/packages/core/src/routes/sign-in-settings.ts +++ b/packages/core/src/routes/sign-in-settings.ts @@ -15,7 +15,7 @@ export default function signInSettingsRoutes(router: Array >((previous, connectorTarget) => { const connectors = connectorInstances.filter( - ({ metadata: { target } }) => target === connectorTarget + ({ metadata: { target }, connector: { enabled } }) => target === connectorTarget && enabled ); return [