diff --git a/frontend/app/components/Dashboard/components/DashboardHeader/DashboardHeader.tsx b/frontend/app/components/Dashboard/components/DashboardHeader/DashboardHeader.tsx index 90ecd4761..5f312d124 100644 --- a/frontend/app/components/Dashboard/components/DashboardHeader/DashboardHeader.tsx +++ b/frontend/app/components/Dashboard/components/DashboardHeader/DashboardHeader.tsx @@ -1,9 +1,8 @@ import React from 'react'; -import { Tooltip } from 'react-tippy'; import Breadcrumb from 'Shared/Breadcrumb'; import { withSiteId } from 'App/routes'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { Button, PageTitle, confirm } from 'UI'; +import { Button, PageTitle, confirm, Tooltip } from 'UI'; import SelectDateRange from 'Shared/SelectDateRange'; import { useStore } from 'App/mstore'; import { useModal } from 'App/components/Modal'; @@ -20,7 +19,7 @@ interface IProps { } type Props = IProps & RouteComponentProps; - +const MAX_CARDS = 30 function DashboardHeader(props: Props) { const { siteId, dashboardId } = props; const { dashboardStore } = useStore(); @@ -30,6 +29,7 @@ function DashboardHeader(props: Props) { const period = dashboardStore.period; const dashboard: any = dashboardStore.selectedDashboard; + const canAddMore: boolean = dashboard?.widgets?.length <= MAX_CARDS; const onEdit = (isTitle: boolean) => { dashboardStore.initDashboard(dashboard); @@ -80,16 +80,19 @@ function DashboardHeader(props: Props) { />