diff --git a/packages/console/src/pages/Connectors/components/ConnectorName/index.tsx b/packages/console/src/pages/Connectors/components/ConnectorName/index.tsx index 09b54b9d3..a2cd0d7c8 100644 --- a/packages/console/src/pages/Connectors/components/ConnectorName/index.tsx +++ b/packages/console/src/pages/Connectors/components/ConnectorName/index.tsx @@ -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 && (
- {connectors.map( + {enabledConnectors.map( ({ id, platform }) => platform && (
diff --git a/packages/console/src/pages/Connectors/index.tsx b/packages/console/src/pages/Connectors/index.tsx index 33fad582c..2daa8e26b 100644 --- a/packages/console/src/pages/Connectors/index.tsx +++ b/packages/console/src/pages/Connectors/index.tsx @@ -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 (