diff --git a/client/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerActionBar.js b/client/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerActionBar.js new file mode 100644 index 000000000..d7b899899 --- /dev/null +++ b/client/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerActionBar.js @@ -0,0 +1,70 @@ +import React from 'react'; +import { useHistory } from 'react-router-dom'; +import Icon from 'components/Icon'; +import { Button, Classes, NavbarGroup, Intent } from '@blueprintjs/core'; +import { FormattedMessage as T } from 'react-intl'; +import { safeCallback } from 'utils'; + +import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; +import withAlertsActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; + +import { compose } from 'utils'; + +/** + * Expense drawer action bar. + */ +function ExpenseDrawerActionBar({ + // #ownProps + expense, + + // #withAlertsDialog + openAlert, + + // #withDrawerActions + closeDrawer, +}) { + const history = useHistory(); + + // Handle the expense edit action. + const onEditExpense = () => { + if (expense) { + history.push(`/expenses/${expense.id}/edit`); + closeDrawer('expense-drawer'); + } + }; + + // Handle the expense delete action. + const onDeleteExpense = () => { + if (expense) { + openAlert('expense-delete', { expenseId: expense.id }); + closeDrawer('expense-drawer'); + } + }; + + return ( + + +