import { css } from '@emotion/css'; import { selectors } from '@grafana/e2e-selectors'; import { t } from '@grafana/i18n'; import { ToolbarButton, ButtonGroup } from '@grafana/ui'; import { useDispatch, useSelector } from 'app/types'; import { PanelModel } from '../../state/PanelModel'; import { getPanelPluginWithFallback } from '../../state/selectors'; import { updatePanelEditorUIState } from './state/actions'; import { toggleVizPicker } from './state/reducers'; type Props = { panel: PanelModel; }; export const VisualizationButton = ({ panel }: Props) => { const dispatch = useDispatch(); const plugin = useSelector(getPanelPluginWithFallback(panel.type)); const isPanelOptionsVisible = useSelector((state) => state.panelEditor.ui.isPanelOptionsVisible); const isVizPickerOpen = useSelector((state) => state.panelEditor.isVizPickerOpen); const onToggleOpen = () => { dispatch(toggleVizPicker(!isVizPickerOpen)); }; const onToggleOptionsPane = () => { dispatch(updatePanelEditorUIState({ isPanelOptionsVisible: !isPanelOptionsVisible })); }; if (!plugin) { return null; } return (