From 0656b6d67d398e67253e2992d48273f3ebe314c1 Mon Sep 17 00:00:00 2001 From: Wang Sijie Date: Mon, 30 May 2022 19:50:26 +0800 Subject: [PATCH] fix(console): show enabled platforms in detail tab (#989) --- .../ConnectorTabs/index.module.scss | 6 ---- .../components/ConnectorTabs/index.tsx | 35 +++++++++---------- packages/phrases/src/locales/en.ts | 1 - packages/phrases/src/locales/zh-cn.ts | 1 - 4 files changed, 16 insertions(+), 27 deletions(-) diff --git a/packages/console/src/pages/ConnectorDetails/components/ConnectorTabs/index.module.scss b/packages/console/src/pages/ConnectorDetails/components/ConnectorTabs/index.module.scss index 72808b64f..b9f3a2632 100644 --- a/packages/console/src/pages/ConnectorDetails/components/ConnectorTabs/index.module.scss +++ b/packages/console/src/pages/ConnectorDetails/components/ConnectorTabs/index.module.scss @@ -31,11 +31,5 @@ margin-right: _.unit(1); color: var(--color-text-link); } - - .notSet { - color: var(--color-caption); - font: var(--font-body-medium); - margin-left: _.unit(2); - } } } diff --git a/packages/console/src/pages/ConnectorDetails/components/ConnectorTabs/index.tsx b/packages/console/src/pages/ConnectorDetails/components/ConnectorTabs/index.tsx index d4c413b55..ee4975ea6 100644 --- a/packages/console/src/pages/ConnectorDetails/components/ConnectorTabs/index.tsx +++ b/packages/console/src/pages/ConnectorDetails/components/ConnectorTabs/index.tsx @@ -1,7 +1,6 @@ import { ConnectorDTO } from '@logto/schemas'; import classNames from 'classnames'; import React from 'react'; -import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; import useSWR from 'swr'; @@ -16,7 +15,6 @@ type Props = { const ConnectorTabs = ({ target, connectorId }: Props) => { const { data } = useSWR(`/api/connectors?target=${target}`); - const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); if (!data) { return null; @@ -24,23 +22,22 @@ const ConnectorTabs = ({ target, connectorId }: Props) => { return (
- {data.map((connector) => ( - - {connector.platform && ( -
- -
- )} - {connector.platform} - {!connector.enabled && ( -
{t('connector_details.not_set')}
- )} - - ))} + {data + .filter(({ enabled }) => enabled) + .map((connector) => ( + + {connector.platform && ( +
+ +
+ )} + {connector.platform} + + ))}
); }; diff --git a/packages/phrases/src/locales/en.ts b/packages/phrases/src/locales/en.ts index 6e4b26b80..4f3f14099 100644 --- a/packages/phrases/src/locales/en.ts +++ b/packages/phrases/src/locales/en.ts @@ -283,7 +283,6 @@ const translation = { options_change_sms: 'Change SMS connector', more_options: 'MORE OPTIONS', connector_deleted: 'The connector has been deleted.', - not_set: '(Not set)', type_email: 'Email connector', type_sms: 'SMS connector', type_social: 'Social connector', diff --git a/packages/phrases/src/locales/zh-cn.ts b/packages/phrases/src/locales/zh-cn.ts index 898c8fdce..008d27697 100644 --- a/packages/phrases/src/locales/zh-cn.ts +++ b/packages/phrases/src/locales/zh-cn.ts @@ -281,7 +281,6 @@ const translation = { options_change_sms: '更换短信服务商', more_options: '更多选项', connector_deleted: '成功删除连接器。', - not_set: '(未设置)', type_email: '邮件连接器', type_sms: '短信连接器', type_social: '社交连接器',