import React from 'react'; import intl from 'react-intl-universal'; import { useHistory } from 'react-router-dom'; import { Button, NavbarGroup, Classes, NavbarDivider, Intent, } from '@blueprintjs/core'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import { useContactDetailDrawerContext } from './ContactDetailDrawerProvider'; import withAlertsActions from 'containers/Alert/withAlertActions'; import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { Icon, FormattedMessage as T } from 'components'; import { safeCallback, compose } from 'utils'; function ContactDetailActionsBar({ // #withAlertsActions openAlert, // #withDrawerActions closeDrawer, }) { const { contact, contactId } = useContactDetailDrawerContext(); const history = useHistory(); // Handle edit contact. const onEditContact = () => { return contactId ? (history.push(`/${contact?.contact_service}s/${contactId}/edit`), closeDrawer('contact-detail-drawer')) : null; }; // Handle delete contact. const onDeleteContact = () => { return contactId ? (openAlert(`${contact?.contact_service}-delete`, { contactId }), closeDrawer('contact-detail-drawer')) : null; }; return (