0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-23 20:33:16 -05:00

fix(console): only show enabled connectors in table (#1156)

This commit is contained in:
Wang Sijie 2022-06-20 16:28:29 +08:00 committed by GitHub
parent 3a6996bb4c
commit 4dbeb22fb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -23,7 +23,8 @@ type Props = {
const ConnectorName = ({ type, connectors, onClickSetup }: Props) => {
const { t } = useTranslation(undefined);
const connector = connectors[0];
const enabledConnectors = connectors.filter(({ enabled }) => enabled);
const connector = enabledConnectors[0];
if (!connector) {
return (
@ -48,9 +49,9 @@ const ConnectorName = ({ type, connectors, onClickSetup }: Props) => {
subtitle={
<>
{type !== ConnectorType.Social && connector.id}
{type === ConnectorType.Social && connectors.length > 1 && (
{type === ConnectorType.Social && enabledConnectors.length > 1 && (
<div className={styles.platforms}>
{connectors.map(
{enabledConnectors.map(
({ id, platform }) =>
platform && (
<div key={id} className={styles.platform}>

View file

@ -29,7 +29,7 @@ const Connectors = () => {
const emailConnector = useMemo(() => {
const emailConnectorGroup = data?.find(
(connector) => connector.enabled && connector.type === ConnectorType.Email
({ enabled, type }) => enabled && type === ConnectorType.Email
);
return emailConnectorGroup?.connectors[0];
@ -37,7 +37,7 @@ const Connectors = () => {
const smsConnector = useMemo(() => {
const smsConnectorGroup = data?.find(
(connector) => connector.enabled && connector.type === ConnectorType.SMS
({ enabled, type }) => enabled && type === ConnectorType.SMS
);
return smsConnectorGroup?.connectors[0];
@ -48,7 +48,7 @@ const Connectors = () => {
return;
}
return data?.filter((connector) => connector.type === ConnectorType.Social);
return data?.filter(({ enabled, type }) => enabled && type === ConnectorType.Social);
}, [data, isSocial]);
return (