import React from 'react'; import { useHistory } from 'react-router-dom'; import classNames from 'classnames'; import { Popover, NavbarGroup, NavbarDivider, PopoverInteractionKind, Position, Button, Classes, Intent, } from '@blueprintjs/core'; import { FormattedMessage as T, useIntl } from 'react-intl'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import Icon from 'components/Icon'; import { If, DashboardActionViewsList } from 'components'; import { useItemsListContext } from './ItemsListProvider'; import withItems from 'containers/Items/withItems'; import withItemsActions from './withItemsActions'; import withAlertActions from 'containers/Alert/withAlertActions'; import { compose } from 'utils'; /** * Items actions bar. */ function ItemsActionsBar({ // #withItems itemsSelectedRows, // #withItemActions addItemsTableQueries, // #withAlertActions openAlert, }) { // Items list context. const { itemsViews } = useItemsListContext(); const { formatMessage } = useIntl(); // History context. const history = useHistory(); // Handle `new item` button click. const onClickNewItem = () => { history.push('/items/new'); }; // Handle tab changing. const handleTabChange = (viewId) => { addItemsTableQueries({ customViewId: viewId.id || null, }); }; // Handle cancel/confirm items bulk. const handleBulkDelete = () => { openAlert('items-bulk-delete', { itemsIds: itemsSelectedRows }); }; return (