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:
parent
3a6996bb4c
commit
4dbeb22fb6
2 changed files with 7 additions and 6 deletions
|
@ -23,7 +23,8 @@ type Props = {
|
||||||
|
|
||||||
const ConnectorName = ({ type, connectors, onClickSetup }: Props) => {
|
const ConnectorName = ({ type, connectors, onClickSetup }: Props) => {
|
||||||
const { t } = useTranslation(undefined);
|
const { t } = useTranslation(undefined);
|
||||||
const connector = connectors[0];
|
const enabledConnectors = connectors.filter(({ enabled }) => enabled);
|
||||||
|
const connector = enabledConnectors[0];
|
||||||
|
|
||||||
if (!connector) {
|
if (!connector) {
|
||||||
return (
|
return (
|
||||||
|
@ -48,9 +49,9 @@ const ConnectorName = ({ type, connectors, onClickSetup }: Props) => {
|
||||||
subtitle={
|
subtitle={
|
||||||
<>
|
<>
|
||||||
{type !== ConnectorType.Social && connector.id}
|
{type !== ConnectorType.Social && connector.id}
|
||||||
{type === ConnectorType.Social && connectors.length > 1 && (
|
{type === ConnectorType.Social && enabledConnectors.length > 1 && (
|
||||||
<div className={styles.platforms}>
|
<div className={styles.platforms}>
|
||||||
{connectors.map(
|
{enabledConnectors.map(
|
||||||
({ id, platform }) =>
|
({ id, platform }) =>
|
||||||
platform && (
|
platform && (
|
||||||
<div key={id} className={styles.platform}>
|
<div key={id} className={styles.platform}>
|
||||||
|
|
|
@ -29,7 +29,7 @@ const Connectors = () => {
|
||||||
|
|
||||||
const emailConnector = useMemo(() => {
|
const emailConnector = useMemo(() => {
|
||||||
const emailConnectorGroup = data?.find(
|
const emailConnectorGroup = data?.find(
|
||||||
(connector) => connector.enabled && connector.type === ConnectorType.Email
|
({ enabled, type }) => enabled && type === ConnectorType.Email
|
||||||
);
|
);
|
||||||
|
|
||||||
return emailConnectorGroup?.connectors[0];
|
return emailConnectorGroup?.connectors[0];
|
||||||
|
@ -37,7 +37,7 @@ const Connectors = () => {
|
||||||
|
|
||||||
const smsConnector = useMemo(() => {
|
const smsConnector = useMemo(() => {
|
||||||
const smsConnectorGroup = data?.find(
|
const smsConnectorGroup = data?.find(
|
||||||
(connector) => connector.enabled && connector.type === ConnectorType.SMS
|
({ enabled, type }) => enabled && type === ConnectorType.SMS
|
||||||
);
|
);
|
||||||
|
|
||||||
return smsConnectorGroup?.connectors[0];
|
return smsConnectorGroup?.connectors[0];
|
||||||
|
@ -48,7 +48,7 @@ const Connectors = () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data?.filter((connector) => connector.type === ConnectorType.Social);
|
return data?.filter(({ enabled, type }) => enabled && type === ConnectorType.Social);
|
||||||
}, [data, isSocial]);
|
}, [data, isSocial]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue