@antscorp/antsomi-ui 1.3.5-beta.577 → 1.3.5-beta.578
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,10 +10,10 @@ import { CreateButton, HomeMenuWrapper, ModalWrapper } from './styled';
|
|
|
10
10
|
// Hooks
|
|
11
11
|
import { useHomeMenu } from './useHomeMenu';
|
|
12
12
|
export const HomeMenu = memo(props => {
|
|
13
|
-
const { children, removedDashboardId, isDashboardRemoving, isRecommendation, setRemovedDashboardId, onCreateNewReport, onMenuClick, onRemoveDashboard, } = useHomeMenu(props);
|
|
13
|
+
const { children, removedDashboardId, isDashboardRemoving, isRecommendation, showCreateButton, setRemovedDashboardId, onCreateNewReport, onMenuClick, onRemoveDashboard, } = useHomeMenu(props);
|
|
14
14
|
return (React.createElement(React.Fragment, null,
|
|
15
15
|
React.createElement(HomeMenuWrapper, { gap: 10, vertical: true },
|
|
16
|
-
!isRecommendation && (React.createElement(CreateButton, { type: "primary", onClick: onCreateNewReport },
|
|
16
|
+
!isRecommendation && showCreateButton && (React.createElement(CreateButton, { type: "primary", onClick: onCreateNewReport },
|
|
17
17
|
React.createElement(Flex, { gap: 10, align: "center" },
|
|
18
18
|
React.createElement(Icon, { type: "icon-ants-plus-slim", style: { fontSize: 14 } }),
|
|
19
19
|
React.createElement("span", null, "Create")))),
|
|
@@ -5,6 +5,7 @@ export declare const useHomeMenu: (props: HomeMenuProps) => {
|
|
|
5
5
|
removedDashboardId: string;
|
|
6
6
|
isDashboardRemoving: boolean;
|
|
7
7
|
isRecommendation: boolean | undefined;
|
|
8
|
+
showCreateButton: boolean;
|
|
8
9
|
setRemovedDashboardId: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
9
10
|
onCreateNewReport: import("react").MouseEventHandler<HTMLElement>;
|
|
10
11
|
onOptionCallback: (args: {
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
import { useCallback, useMemo, useState } from 'react';
|
|
12
12
|
// Constants
|
|
13
13
|
import { CONFIG_OPTIONS } from './constants';
|
|
14
|
-
import { HOME_REPORT_ROUTES, HOME_ROUTE } from '../../constants';
|
|
14
|
+
import { HOME_MENU_ITEMS, HOME_REPORT_ROUTES, HOME_ROUTE } from '../../constants';
|
|
15
15
|
import { API_RESPONSE_CODE, CDP_API, CDP_ROUTE } from '@antscorp/antsomi-ui/es/constants';
|
|
16
16
|
// Utils
|
|
17
17
|
import { getGeneratePath, getMenuItem } from '../../utils';
|
|
@@ -36,6 +36,7 @@ export const useHomeMenu = (props) => {
|
|
|
36
36
|
const onClickCreateDashboard = useLayoutStore(store => store.state.leftMenu.onClickCreateDashboard);
|
|
37
37
|
const [removedDashboardId, setRemovedDashboardId] = useState('');
|
|
38
38
|
const urlParams = useMemo(() => new URLSearchParams(search), [search]);
|
|
39
|
+
const showCreateButton = useMemo(() => !!(appMenuChildren === null || appMenuChildren === void 0 ? void 0 : appMenuChildren.find(item => item.menu_item_code === HOME_MENU_ITEMS.DASHBOARD)), [appMenuChildren]);
|
|
39
40
|
const { mutateAsync: removeDashboard, isLoading: isDashboardRemoving } = useRemoveDashboard();
|
|
40
41
|
const onOptionCallback = useCallback((args) => {
|
|
41
42
|
const { optionKey, menuItemKey } = args;
|
|
@@ -126,6 +127,7 @@ export const useHomeMenu = (props) => {
|
|
|
126
127
|
removedDashboardId,
|
|
127
128
|
isDashboardRemoving,
|
|
128
129
|
isRecommendation,
|
|
130
|
+
showCreateButton,
|
|
129
131
|
setRemovedDashboardId,
|
|
130
132
|
onCreateNewReport,
|
|
131
133
|
onOptionCallback,
|