diff --git a/packages/connector-alipay/src/constant.ts b/packages/connector-alipay/src/constant.ts index 020f2a97b..0d64202c5 100644 --- a/packages/connector-alipay/src/constant.ts +++ b/packages/connector-alipay/src/constant.ts @@ -27,8 +27,8 @@ export const defaultMetadata: ConnectorMetadata = { type: ConnectorType.Social, platform: ConnectorPlatform.Web, name: { - en: 'Sign In with Alipay', - 'zh-CN': '支付宝登录', + en: 'Alipay', + 'zh-CN': '支付宝', }, logo: './logo.png', description: { diff --git a/packages/connector-facebook/src/constant.ts b/packages/connector-facebook/src/constant.ts index 447560e5e..49f48489a 100644 --- a/packages/connector-facebook/src/constant.ts +++ b/packages/connector-facebook/src/constant.ts @@ -29,8 +29,8 @@ export const defaultMetadata: ConnectorMetadata = { type: ConnectorType.Social, platform: ConnectorPlatform.Web, name: { - en: 'Sign In with Facebook', - 'zh-CN': 'Facebook 登录', + en: 'Facebook', + 'zh-CN': 'Facebook', }, logo: './logo.png', description: { diff --git a/packages/connector-github/src/constant.ts b/packages/connector-github/src/constant.ts index f258cb43c..90c45567a 100644 --- a/packages/connector-github/src/constant.ts +++ b/packages/connector-github/src/constant.ts @@ -20,10 +20,10 @@ export const defaultMetadata: ConnectorMetadata = { type: ConnectorType.Social, platform: ConnectorPlatform.Web, name: { - en: 'Sign In with GitHub', - 'zh-CN': 'GitHub登录', + en: 'GitHub', + 'zh-CN': 'GitHub', }, - logo: 'https://user-images.githubusercontent.com/5717882/156983224-7ea0296b-38fa-419d-9515-67e8a9612e09.png', + logo: 'https://user-images.githubusercontent.com/5717882/169224449-687a1680-85ec-4482-bf04-4132b6476246.svg', description: { en: 'Sign In with GitHub', 'zh-CN': 'GitHub登录', diff --git a/packages/connector-google/src/constant.ts b/packages/connector-google/src/constant.ts index 065147262..08f5fc261 100644 --- a/packages/connector-google/src/constant.ts +++ b/packages/connector-google/src/constant.ts @@ -20,8 +20,8 @@ export const defaultMetadata: ConnectorMetadata = { type: ConnectorType.Social, platform: ConnectorPlatform.Web, name: { - en: 'Sign In with Google', - 'zh-CN': 'Google登录', + en: 'Google', + 'zh-CN': 'Google', }, logo: './logo.png', description: { diff --git a/packages/connector-wechat-native/src/constant.ts b/packages/connector-wechat-native/src/constant.ts index d079e52a5..8bef5dcbb 100644 --- a/packages/connector-wechat-native/src/constant.ts +++ b/packages/connector-wechat-native/src/constant.ts @@ -20,8 +20,8 @@ export const defaultMetadata: ConnectorMetadata = { type: ConnectorType.Social, platform: ConnectorPlatform.Native, name: { - en: 'Sign In with WeChat', - 'zh-CN': '微信登录', + en: 'WeChat', + 'zh-CN': '微信', }, logo: './logo.png', description: { diff --git a/packages/connector-wechat/src/constant.ts b/packages/connector-wechat/src/constant.ts index 9b412b702..c4c0fe817 100644 --- a/packages/connector-wechat/src/constant.ts +++ b/packages/connector-wechat/src/constant.ts @@ -20,8 +20,8 @@ export const defaultMetadata: ConnectorMetadata = { type: ConnectorType.Social, platform: ConnectorPlatform.Web, name: { - en: 'Sign In with WeChat', - 'zh-CN': '微信登录', + en: 'WeChat', + 'zh-CN': '微信', }, logo: './logo.png', description: { diff --git a/packages/console/src/hooks/use-connector-groups.ts b/packages/console/src/hooks/use-connector-groups.ts index 053f504c9..6a941ddc2 100644 --- a/packages/console/src/hooks/use-connector-groups.ts +++ b/packages/console/src/hooks/use-connector-groups.ts @@ -24,6 +24,7 @@ const useConnectorGroups = () => { name: item.metadata.name, logo: item.metadata.logo, target: item.metadata.target, + type: item.metadata.type, enabled: item.enabled, connectors: [item], }, diff --git a/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.module.scss b/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.module.scss index a9d1fdb83..4d155f8e5 100644 --- a/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.module.scss +++ b/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.module.scss @@ -1,3 +1,29 @@ +@use '@/scss/underscore' as _; + .disabled { color: var(--color-disabled); } + +.title { + display: flex; + align-items: center; + + .logo { + margin-right: _.unit(2); + width: 20px; + height: 20px; + + img { + width: 20px; + height: 20px; + } + } + + .icon { + width: 16px; + height: 16px; + object-fit: cover; + margin-left: _.unit(1); + color: var(--color-icon); + } +} diff --git a/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.tsx b/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.tsx index 77d02c147..8f417d434 100644 --- a/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.tsx +++ b/packages/console/src/pages/SignInExperience/components/ConnectorsTransfer.tsx @@ -1,3 +1,4 @@ +import { ConnectorPlatform, ConnectorType } from '@logto/schemas'; import { conditionalString } from '@silverhand/essentials'; import React from 'react'; import { useTranslation } from 'react-i18next'; @@ -7,6 +8,9 @@ import Alert from '@/components/Alert'; import Transfer from '@/components/Transfer'; import UnnamedTrans from '@/components/UnnamedTrans'; import useConnectorGroups from '@/hooks/use-connector-groups'; +import Native from '@/icons/Native'; +import Universal from '@/icons/Universal'; +import Web from '@/icons/Web'; import * as styles from './ConnectorsTransfer.module.scss'; @@ -29,15 +33,32 @@ const ConnectorsTransfer = ({ value, onChange }: Props) => { } const datasource = data - ? data.map(({ target, name, enabled }) => ({ - value: target, - title: ( - - ), - })) + ? data + .filter(({ type }) => type === ConnectorType.Social) + .map(({ target, name, enabled, connectors, logo }) => ({ + value: target, + title: ( +
+
+ {target} +
+ + {connectors.length > 1 && + connectors + .filter(({ enabled }) => enabled) + .map(({ platform }) => ( +
+ {platform === ConnectorPlatform.Web && } + {platform === ConnectorPlatform.Native && } + {platform === ConnectorPlatform.Universal && } +
+ ))} +
+ ), + })) : []; return ( diff --git a/packages/console/src/types/connector.ts b/packages/console/src/types/connector.ts index 2851a7cec..68a08a7d1 100644 --- a/packages/console/src/types/connector.ts +++ b/packages/console/src/types/connector.ts @@ -1,6 +1,6 @@ import { ConnectorDTO } from '@logto/schemas'; -export type ConnectorGroup = Pick & { +export type ConnectorGroup = Pick & { enabled: boolean; connectors: ConnectorDTO[]; };