import React from 'react'; import Icon from 'components/Icon'; import { Button, NavbarGroup, Classes, NavbarDivider, Intent, Alignment, } from '@blueprintjs/core'; import { useHistory } from 'react-router-dom'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import withDialogActions from 'containers/Dialog/withDialogActions'; import { If, Can, DashboardRowsHeightButton, DashboardActionViewsList, DashboardFilterButton, AdvancedFilterPopover, FormattedMessage as T, } from 'components'; import { ExpenseAction, AbilitySubject } from '../../../common/abilityOption'; import { useRefreshExpenses } from 'hooks/query/expenses'; import { useExpensesListContext } from './ExpensesListProvider'; import withExpensesActions from './withExpensesActions'; import withExpenses from './withExpenses'; import withSettingsActions from '../../Settings/withSettingsActions'; import withSettings from '../../Settings/withSettings'; import { compose } from 'utils'; /** * Expenses actions bar. */ function ExpensesActionsBar({ //#withExpensesActions setExpensesTableState, // #withExpenses expensesFilterConditions, // #withSettings expensesTableSize, // #withSettingsActions addSetting, }) { // History context. const history = useHistory(); // Expenses list context. const { expensesViews, fields } = useExpensesListContext(); // Expenses refresh action. const { refresh } = useRefreshExpenses(); // Handles the new expense buttn click. const onClickNewExpense = () => { history.push('/expenses/new'); }; // Handle delete button click. const handleBulkDelete = () => {}; // Handles the tab chaning. const handleTabChange = (view) => { setExpensesTableState({ viewSlug: view ? view.slug : null, }); }; // Handle click a refresh const handleRefreshBtnClick = () => { refresh(); }; // Handle table row size change. const handleTableRowSizeChange = (size) => { addSetting('expenses', 'tableSize', size); }; return (