/* eslint-disable jsx-a11y/img-redundant-alt */ import './DashboardEmptyState.styles.scss'; import { PlusOutlined } from '@ant-design/icons'; import { Button, Typography } from 'antd'; import logEvent from 'api/common/logEvent'; import SettingsDrawer from 'container/NewDashboard/DashboardDescription/SettingsDrawer'; import useComponentPermission from 'hooks/useComponentPermission'; import { useAppContext } from 'providers/App/App'; import { useDashboard } from 'providers/Dashboard/Dashboard'; import { useCallback } from 'react'; import { ROLES, USER_ROLES } from 'types/roles'; import { ComponentTypes } from 'utils/permission'; export default function DashboardEmptyState(): JSX.Element { const { selectedDashboard, isDashboardLocked, handleToggleDashboardSlider, setSelectedRowWidgetId, } = useDashboard(); const { user } = useAppContext(); let permissions: ComponentTypes[] = ['add_panel']; if (isDashboardLocked) { permissions = ['add_panel_locked_dashboard']; } const userRole: ROLES | null = selectedDashboard?.createdBy === user?.email ? (USER_ROLES.AUTHOR as ROLES) : user.role; const [addPanelPermission] = useComponentPermission(permissions, userRole); const onEmptyWidgetHandler = useCallback(() => { setSelectedRowWidgetId(null); handleToggleDashboardSlider(true); logEvent('Dashboard Detail: Add new panel clicked', { dashboardId: selectedDashboard?.id, dashboardName: selectedDashboard?.data.title, numberOfPanels: selectedDashboard?.data.widgets?.length, }); // eslint-disable-next-line react-hooks/exhaustive-deps }, [handleToggleDashboardSlider]); return (
header-image Welcome to your new dashboard Follow the steps to populate it with data and share with your teammates
header-image Configure your new dashboard
Give it a name, add description, tags and variables
header-image Add panels
Add panels to visualize your data
{!isDashboardLocked && addPanelPermission && ( )}
); }