import React, { FC, useState } from 'react'; import { connect, ConnectedProps } from 'react-redux'; import Page from '../../core/components/Page/Page'; import { GrafanaRouteComponentProps } from '../../core/navigation/types'; import { getNavModel } from '../../core/selectors/navModel'; import { StoreState } from '../../types'; import { LibraryPanelsSearch } from './components/LibraryPanelsSearch/LibraryPanelsSearch'; import { OpenLibraryPanelModal } from './components/OpenLibraryPanelModal/OpenLibraryPanelModal'; import { LibraryElementDTO } from './types'; const mapStateToProps = (state: StoreState) => ({ navModel: getNavModel(state.navIndex, 'library-panels'), }); const connector = connect(mapStateToProps, undefined); interface OwnProps extends GrafanaRouteComponentProps {} type Props = OwnProps & ConnectedProps; export const LibraryPanelsPage: FC = ({ navModel }) => { const [selected, setSelected] = useState(undefined); return ( {selected ? setSelected(undefined)} libraryPanel={selected} /> : null} ); }; export default connect(mapStateToProps)(LibraryPanelsPage);