diff --git a/client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js b/client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js new file mode 100644 index 000000000..e67562ccf --- /dev/null +++ b/client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js @@ -0,0 +1,77 @@ +import React from 'react'; +import { useHistory } from 'react-router-dom'; + +import { + Button, + NavbarGroup, + Classes, + NavbarDivider, + Intent, +} from '@blueprintjs/core'; +import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; + +import { useBillDrawerContext } from './BillDrawerProvider'; + +import withDialogActions from 'containers/Dialog/withDialogActions'; +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 BillDetailActionsBar({ + // #withDialogActions + openDialog, + + // #withAlertsActions + openAlert, + + // #withDrawerActions + closeDrawer, +}) { + const history = useHistory(); + + const { billId } = useBillDrawerContext(); + + // Handle edit bill. + const onEditBill = () => { + return billId + ? (history.push(`/bills/${billId}/edit`), closeDrawer('bill-drawer')) + : null; + }; + + // Handle delete bill. + const onDeleteBill = () => { + return billId + ? (openAlert('bill-delete', { billId }), closeDrawer('bill-drawer')) + : null; + }; + + return ( + + +