diff --git a/frontend/app/components/Dashboard/components/DashboardMetricSelection/DashboardMetricSelection.tsx b/frontend/app/components/Dashboard/components/DashboardMetricSelection/DashboardMetricSelection.tsx index fcdf37429..a9858102c 100644 --- a/frontend/app/components/Dashboard/components/DashboardMetricSelection/DashboardMetricSelection.tsx +++ b/frontend/app/components/Dashboard/components/DashboardMetricSelection/DashboardMetricSelection.tsx @@ -3,6 +3,8 @@ import WidgetWrapper from '../WidgetWrapper'; import { useObserver } from 'mobx-react-lite'; import cn from 'classnames'; import { useStore } from 'App/mstore'; +import stl from 'App/components/Dashboard/components/WidgetWrapper/widgetWrapper.css'; +import ownStl from './dashboardMetricSelection.css'; function WidgetCategoryItem({ category, isSelected, onClick, selectedWidgetIds }) { const selectedCategoryWidgetsCount = useObserver(() => { @@ -24,7 +26,12 @@ function WidgetCategoryItem({ category, isSelected, onClick, selectedWidgetIds } ); } -function DashboardMetricSelection(props) { +interface IProps { + handleCreateNew?: () => void; + isDashboardExists?: boolean; +} + +function DashboardMetricSelection(props: IProps) { const { dashboardStore } = useStore(); let widgetCategories: any[] = useObserver(() => dashboardStore.widgetCategories); const [activeCategory, setActiveCategory] = React.useState(); @@ -67,8 +74,7 @@ function DashboardMetricSelection(props) { {activeCategory.widgets.length} -
- Past 7 days data +
diff --git a/frontend/app/components/Dashboard/components/DashboardMetricSelection/dashboardMetricSelection.css b/frontend/app/components/Dashboard/components/DashboardMetricSelection/dashboardMetricSelection.css new file mode 100644 index 000000000..d134a7512 --- /dev/null +++ b/frontend/app/components/Dashboard/components/DashboardMetricSelection/dashboardMetricSelection.css @@ -0,0 +1,11 @@ +.addNew { + text-align: center; + color: $teal; + cursor: pointer; + background-color: white; + + &:hover { + background-color: $active-blue; + transition: all 0.2s; + } +} diff --git a/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx b/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx index 5ffb1c1ca..b2f656475 100644 --- a/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx +++ b/frontend/app/components/Dashboard/components/DashboardModal/DashboardModal.tsx @@ -12,6 +12,7 @@ interface Props { history: any siteId?: string dashboardId?: string + onMetricAdd?: () => void; } function DashboardModal(props) { const { history, siteId, dashboardId } = props; @@ -34,6 +35,7 @@ function DashboardModal(props) { const handleCreateNew = () => { const path = withSiteId(dashboardMetricCreate(dashboardId), siteId); + props.onMetricAdd(); history.push(path); hideModal(); } @@ -52,7 +54,7 @@ function DashboardModal(props) {
- {isDashboardExists && } + Past 7 days data
{ !isDashboardExists && ( @@ -61,7 +63,7 @@ function DashboardModal(props) {

Create new dashboard by choosing from the range of predefined metrics that you care about. You can always add your custom metrics later.

)} - +