Fix: Hide connect data cta for certain widgets (#5690)
This commit is contained in:
parent
57903ec88c
commit
4ddc430411
|
|
@ -19,6 +19,7 @@ import {
|
|||
} from "actions/globalSearchActions";
|
||||
import AnalyticsUtil from "utils/AnalyticsUtil";
|
||||
import { getTypographyByKey } from "constants/DefaultTheme";
|
||||
import { WidgetTypes } from "constants/WidgetConstants";
|
||||
|
||||
const StyledDiv = styled.div`
|
||||
color: ${(props) => props.theme.colors.propertyPane.ctaTextColor};
|
||||
|
|
@ -48,6 +49,17 @@ const StyledDiv = styled.div`
|
|||
}
|
||||
`;
|
||||
|
||||
// Widgets where we do not want to show the CTA
|
||||
export const excludeList = [
|
||||
WidgetTypes.CONTAINER_WIDGET,
|
||||
WidgetTypes.TABS_WIDGET,
|
||||
WidgetTypes.FORM_WIDGET,
|
||||
WidgetTypes.MODAL_WIDGET,
|
||||
WidgetTypes.DIVIDER_WIDGET,
|
||||
WidgetTypes.FILE_PICKER_WIDGET,
|
||||
WidgetTypes.BUTTON_WIDGET,
|
||||
];
|
||||
|
||||
export const actionsExist = (state: AppState): boolean =>
|
||||
!!state.entities.actions.length;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, { Component, useCallback } from "react";
|
||||
import React, { Component, useCallback, useMemo } from "react";
|
||||
import { connect, useDispatch, useSelector } from "react-redux";
|
||||
import { AppState } from "reducers";
|
||||
import {
|
||||
|
|
@ -37,7 +37,7 @@ import { getProppanePreference } from "selectors/usersSelectors";
|
|||
import { PropertyPanePositionConfig } from "reducers/uiReducers/usersReducer";
|
||||
import { get } from "lodash";
|
||||
import { Layers } from "constants/Layers";
|
||||
import ConnectDataCTA, { actionsExist } from "./ConnectDataCTA";
|
||||
import ConnectDataCTA, { actionsExist, excludeList } from "./ConnectDataCTA";
|
||||
import PropertyPaneConnections from "./PropertyPaneConnections";
|
||||
|
||||
const PropertyPaneWrapper = styled(PaneWrapper)<{
|
||||
|
|
@ -105,6 +105,13 @@ function PropertyPaneView(
|
|||
const { hidePropertyPane, theme, ...panel } = props;
|
||||
const widgetProperties: any = useSelector(getWidgetPropsForPropertyPane);
|
||||
const doActionsExist = useSelector(actionsExist);
|
||||
const hideConnectDataCTA = useMemo(() => {
|
||||
if (widgetProperties) {
|
||||
return excludeList.includes(widgetProperties.type);
|
||||
}
|
||||
|
||||
return true;
|
||||
}, [widgetProperties?.type]);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const handleDelete = useCallback(() => {
|
||||
|
|
@ -170,7 +177,7 @@ function PropertyPaneView(
|
|||
widgetType={widgetProperties?.type}
|
||||
/>
|
||||
<PropertyPaneBodyWrapper>
|
||||
{!doActionsExist && <ConnectDataCTA />}
|
||||
{!doActionsExist && !hideConnectDataCTA && <ConnectDataCTA />}
|
||||
<PropertyControlsWrapper>
|
||||
<PropertyControlsGenerator
|
||||
id={widgetProperties.widgetId}
|
||||
|
|
|
|||
Loading…
Reference in New Issue