diff --git a/client/src/components/Dashboard/DashboardTopbar.js b/client/src/components/Dashboard/DashboardTopbar.js index 1bb520f25..2722c92ba 100644 --- a/client/src/components/Dashboard/DashboardTopbar.js +++ b/client/src/components/Dashboard/DashboardTopbar.js @@ -11,9 +11,9 @@ import { FormattedMessage as T } from 'react-intl'; import DashboardTopbarUser from 'components/Dashboard/TopbarUser'; import DashboardBreadcrumbs from 'components/Dashboard/DashboardBreadcrumbs'; -import SearchConnect from 'connectors/Search.connect'; import Icon from 'components/Icon'; +import withSearch from 'containers/GeneralSearch/withSearch' import withDashboardActions from 'containers/Dashboard/withDashboardActions'; import withDashboard from 'containers/Dashboard/withDashboard'; @@ -120,7 +120,7 @@ function DashboardTopbar({ } export default compose( - SearchConnect, + withSearch, withDashboard(({ pageTitle, pageSubtitle, editViewId }) => ({ pageTitle, pageSubtitle, editViewId })), diff --git a/client/src/connectors/Accounts.connector.js b/client/src/connectors/Accounts.connector.js deleted file mode 100644 index 6d2e6802c..000000000 --- a/client/src/connectors/Accounts.connector.js +++ /dev/null @@ -1,60 +0,0 @@ -import { connect } from 'react-redux'; -import t from 'store/types'; -import { - fetchAccountTypes, - fetchAccountsList, - deleteAccount, - inactiveAccount, - fetchAccountsTable, - submitAccount, - fetchAccount, - deleteBulkAccounts, -} from 'store/accounts/accounts.actions'; -import { - getAccountsItems, -} from 'store/accounts/accounts.selectors'; -import { - getResourceViews, -} from 'store/customViews/customViews.selectors'; -import { - getItemById -} from 'store/selectors'; - -const mapStateToProps = (state, props) => ({ - views: getResourceViews(state, 'accounts'), - accounts: getAccountsItems(state, state.accounts.currentViewId), - accountsTypes: state.accounts.accountsTypes, - - tableQuery: state.accounts.tableQuery, - accountsLoading: state.accounts.loading, - accountErrors: state.accounts.errors, - - getAccountById: (id) => getItemById(state.accounts.items, id), -}); - -const mapActionsToProps = (dispatch) => ({ - requestFetchAccounts: (query) => dispatch(fetchAccountsList({ query })), - requestFetchAccountTypes: () => dispatch(fetchAccountTypes()), - requestSubmitAccount: ({ form }) => dispatch(submitAccount({ form })), - requestDeleteAccount: (id) => dispatch(deleteAccount({ id })), - requestInactiveAccount: (id) => dispatch(inactiveAccount({ id })), - requestFetchAccount: (id) => dispatch(fetchAccount({ id })), - requestFetchAccountsTable: (query = {}) => dispatch(fetchAccountsTable({ query: { ...query } })), - requestDeleteBulkAccounts: (ids) => dispatch(deleteBulkAccounts({ ids })), - - changeCurrentView: (id) => dispatch({ - type: t.ACCOUNTS_SET_CURRENT_VIEW, - currentViewId: parseInt(id, 10), - }), - setAccountsTableQuery: (key, value) => dispatch({ - type: 'ACCOUNTS_TABLE_QUERY_SET', key, value, - }), - addAccountsTableQueries: (queries) => dispatch({ - type: 'ACCOUNTS_TABLE_QUERIES_ADD', queries, - }), - setSelectedRowsAccounts: (ids) => dispatch({ - type: t.ACCOUNTS_SELECTED_ROWS_SET, payload: { ids }, - }), -}); - -export default connect(mapStateToProps, mapActionsToProps); \ No newline at end of file diff --git a/client/src/connectors/Dashboard.connector.js b/client/src/connectors/Dashboard.connector.js deleted file mode 100644 index 2be19910d..000000000 --- a/client/src/connectors/Dashboard.connector.js +++ /dev/null @@ -1,34 +0,0 @@ -import { connect } from 'react-redux'; -import t from 'store/types'; - -const mapActionsToProps = (dispatch) => ({ - changePageTitle: (pageTitle) => - dispatch({ - type: t.CHANGE_DASHBOARD_PAGE_TITLE, - pageTitle, - }), - - changePageSubtitle: (pageSubtitle) => - dispatch({ - type: t.ALTER_DASHBOARD_PAGE_SUBTITLE, - pageSubtitle, - }), - - setTopbarEditView: (id) => - dispatch({ - type: t.SET_TOPBAR_EDIT_VIEW, - id, - }), - - setDashboardRequestLoading: () => - dispatch({ - type: t.SET_DASHBOARD_REQUEST_LOADING, - }), - - setDashboardRequestCompleted: () => - dispatch({ - type: t.SET_DASHBOARD_REQUEST_COMPLETED, - }), -}); - -export default connect(null, mapActionsToProps); diff --git a/client/src/connectors/ExpenseForm.connector.js b/client/src/connectors/ExpenseForm.connector.js deleted file mode 100644 index 8ada0b39b..000000000 --- a/client/src/connectors/ExpenseForm.connector.js +++ /dev/null @@ -1,37 +0,0 @@ -import {connect} from 'react-redux'; -import { - fetchExpense, - submitExpense, - editExpense, - deleteExpense, -} from 'store/expenses/expenses.actions'; -import { - fetchAccountsList, -} from 'store/accounts/accounts.actions'; -import { - fetchCurrencies, -} from 'store/currencies/currencies.actions'; -import t from 'store/types'; - -export const mapStateToProps = (state, props) => { - return { - expenseDetails: {}, - accounts: state.accounts.accounts, - currencies: state.currencies.registered, - }; -}; - -export const mapDispatchToProps = (dispatch) => ({ - changePageTitle: pageTitle => dispatch({ - type: t.CHANGE_DASHBOARD_PAGE_TITLE, - pageTitle, - }), - fetchCurrencies: () => dispatch(fetchCurrencies()), - fetchExpense: (id) => dispatch(fetchExpense({ id })), - submitExpense: (form) => dispatch(submitExpense({ form })), - editExpense: (id, form) => dispatch(editExpense({ id, form })), - fetchAccounts: () => dispatch(fetchAccountsList()), - deleteExpense: (id) => dispatch(deleteExpense({ id })), -}); - -export default connect(mapStateToProps, mapDispatchToProps); \ No newline at end of file diff --git a/client/src/connectors/ExpensesList.connector.js b/client/src/connectors/ExpensesList.connector.js deleted file mode 100644 index 4bfc69b63..000000000 --- a/client/src/connectors/ExpensesList.connector.js +++ /dev/null @@ -1,23 +0,0 @@ -import {connect} from 'react-redux'; -import { - fetchExpensesList, - deleteExpense, -} from 'store/expenses/expenses.actions'; -import t from 'store/types'; - -export const mapStateToProps = (state, props) => { - return { - expenses: state.expenses.list, - }; -}; - -export const mapDispatchToProps = (dispatch) => ({ - changePageTitle: pageTitle => dispatch({ - type: t.CHANGE_DASHBOARD_PAGE_TITLE, - pageTitle, - }), - fetchExpenses: (id) => dispatch(fetchExpensesList({ id })), - deleteExpense: (id) => dispatch(deleteExpense({ id })), -}); - -export default connect(mapStateToProps, mapDispatchToProps); \ No newline at end of file diff --git a/client/src/connectors/GeneralLedgerSheet.connect.js b/client/src/connectors/GeneralLedgerSheet.connect.js deleted file mode 100644 index b2dce1895..000000000 --- a/client/src/connectors/GeneralLedgerSheet.connect.js +++ /dev/null @@ -1,20 +0,0 @@ -import {connect} from 'react-redux'; -import { - fetchGeneralLedger, -} from 'store/financialStatement/financialStatements.actions'; -import { - getFinancialSheetIndexByQuery, - getFinancialSheet, -} from 'store/financialStatement/financialStatements.selectors'; - -export const mapStateToProps = (state, props) => ({ - getGeneralLedgerSheetIndex: (query) => getFinancialSheetIndexByQuery(state.financialStatements.generalLedger.sheets, query), - getGeneralLedgerSheet: (index) => getFinancialSheet(state.financialStatements.generalLedger.sheets, index), - generalLedgerSheetLoading: state.financialStatements.generalLedger.loading, -}); - -export const mapDispatchToProps = (dispatch) => ({ - fetchGeneralLedger: (query = {}) => dispatch(fetchGeneralLedger({ query })), -}); - -export default connect(mapStateToProps, mapDispatchToProps); \ No newline at end of file diff --git a/client/src/connectors/ItemFormDialog.connect.js b/client/src/connectors/ItemFormDialog.connect.js deleted file mode 100644 index 14cf851bf..000000000 --- a/client/src/connectors/ItemFormDialog.connect.js +++ /dev/null @@ -1,24 +0,0 @@ -//FIXME: FIX Later Need More Work - -import { connect } from 'react-redux'; -import { - submitItemCategory, - submitCategory, - fetchCategory -} from 'store/itemCategories/itemsCategory.actions'; - -export const mapStateToProps = (state, props) => { - return { - category: state.category, - name: 'item-form', - payload: { action: 'new', id: null } - }; -}; - -export const mapDispatchToProps = dispatch => ({ - submitItemCategory: form => dispatch(submitItemCategory({ form })), - submitCategory: form => dispatch(submitCategory({ form })), - fetchCategory: () => dispatch(fetchCategory()) -}); - -export default connect(mapStateToProps, mapDispatchToProps); diff --git a/client/src/connectors/Items.connect.js b/client/src/connectors/Items.connect.js deleted file mode 100644 index 3a483f39f..000000000 --- a/client/src/connectors/Items.connect.js +++ /dev/null @@ -1,53 +0,0 @@ - - -import {connect} from 'react-redux'; -import { - fetchItems, - deleteItem, - submitItem, -} from 'store/items/items.actions'; -import { - getResourceViews, - getViewPages, -} from 'store/customViews/customViews.selectors' -import { - getCurrentPageResults -} from 'store/selectors'; -import t from 'store/types'; - -export const mapStateToProps = (state, props) => { - const viewPages = getViewPages(state.items.views, state.items.currentViewId); - - return { - views: getResourceViews(state, 'items'), - currentPageItems: getCurrentPageResults( - state.items.items, - viewPages, - state.items.currentPage, - ), - bulkSelected: state.items.bulkActions, - itemsTableLoading: state.items.loading, - }; -}; - -export const mapDispatchToProps = (dispatch) => ({ - requestFetchItems: (query) => dispatch(fetchItems({ query })), - requestDeleteItem: (id) => dispatch(deleteItem({ id })), - requestSubmitItem: (form) => dispatch(submitItem({ form })), - addBulkActionItem: (id) => dispatch({ - type: t.ITEM_BULK_ACTION_ADD, itemId: id - }), - removeBulkActionItem: (id) => dispatch({ - type: t.ITEM_BULK_ACTION_REMOVE, itemId: id, - }), - - setItemsTableQuery: (key, value) => dispatch({ - type: t.ITEMS_TABLE_QUERY_SET, key, value, - }), - addItemsTableQueries: (queries) => - dispatch({ - type: t.ITEMS_TABLE_QUERIES_ADD, queries, - }), -}); - -export default connect(mapStateToProps, mapDispatchToProps); diff --git a/client/src/connectors/ItemsCategory.connect.js b/client/src/connectors/ItemsCategory.connect.js deleted file mode 100644 index d56e1fb1a..000000000 --- a/client/src/connectors/ItemsCategory.connect.js +++ /dev/null @@ -1,32 +0,0 @@ -import { connect } from 'react-redux'; -import { - fetchItemCategories, - submitItemCategory, - deleteItemCategory, - editItemCategory, -} from 'store/itemCategories/itemsCategory.actions'; -import { getDialogPayload } from 'store/dashboard/dashboard.reducer'; -import { getCategoryId } from 'store/itemCategories/itemsCategory.reducer'; - -export const mapStateToProps = (state, props) => { - const dialogPayload = getDialogPayload(state, 'item-form'); - - return { - categories: Object.values(state.itemCategories.categories), - name: 'item-form', - payload: { action: 'new', id: null }, - editItemCategory: - dialogPayload && dialogPayload.action === 'edit' - ? state.itemCategories.categories[dialogPayload.id] - : {}, - getCategoryId: (id) => getCategoryId(state, id), - }; -}; -export const mapDispatchToProps = (dispatch) => ({ - requestSubmitItemCategory: (form) => dispatch(submitItemCategory({ form })), - requestFetchItemCategories: () => dispatch(fetchItemCategories()), - requestDeleteItemCategory: (id) => dispatch(deleteItemCategory(id)), - requestEditItemCategory: (id, form) => dispatch(editItemCategory(id, form)), -}); - -export default connect(mapStateToProps, mapDispatchToProps); diff --git a/client/src/connectors/Media.connect.js b/client/src/connectors/Media.connect.js deleted file mode 100644 index aa8430f2e..000000000 --- a/client/src/connectors/Media.connect.js +++ /dev/null @@ -1,16 +0,0 @@ -import {connect} from 'react-redux'; -import { - submitMedia, - deleteMedia, -} from 'store/media/media.actions'; - -export const mapStateToProps = (state, props) => ({ - -}); - -export const mapDispatchToProps = (dispatch) => ({ - requestSubmitMedia: (form, config) => dispatch(submitMedia({ form, config })), - requestDeleteMedia: (ids) => dispatch(deleteMedia({ ids })), -}); - -export default connect(mapStateToProps, mapDispatchToProps); \ No newline at end of file diff --git a/client/src/connectors/Resource.connector.js b/client/src/connectors/Resource.connector.js deleted file mode 100644 index b6fb00d56..000000000 --- a/client/src/connectors/Resource.connector.js +++ /dev/null @@ -1,28 +0,0 @@ -import {connect} from 'react-redux'; -import { - fetchResourceColumns, - fetchResourceFields, -} from 'store/resources/resources.actions'; -import { - getResourceColumns, - getResourceFields, - getResourceColumn, - getResourceField, - getResourceMetadata, -} from 'store/resources/resources.reducer'; - -export const mapStateToProps = (state, props) => ({ - // getResourceColumns: (resourceSlug) => getResourceColumns(state, resourceSlug), - // getResourceFields: (resourceSlug) => getResourceFields(state, resourceSlug), - // getResourceMetadata: (resourceSlug) => getResourceMetadata(state, resourceSlug), - - // getResourceColumn: (columnId) => getResourceColumn(state, columnId), - // getResourceField: (fieldId) => getResourceField(state, fieldId), -}); - -export const mapDispatchToProps = (dispatch) => ({ - requestFetchResourceFields: (resourceSlug) => dispatch(fetchResourceFields({ resourceSlug })), - requestFetchResourceColumns: (resourceSlug) => dispatch(fetchResourceColumns({ resourceSlug })), -}); - -export default connect(mapStateToProps, mapDispatchToProps); \ No newline at end of file diff --git a/client/src/connectors/Settings.connect.js b/client/src/connectors/Settings.connect.js deleted file mode 100644 index b4b1d35b8..000000000 --- a/client/src/connectors/Settings.connect.js +++ /dev/null @@ -1,19 +0,0 @@ -import { connect } from 'react-redux'; -import { - FetchOptions, - submitOptions, -} from 'store/settings/settings.actions'; - - -export const mapStateToProps = (state, props) => { - return { - organizationSettings: state.settings.data.organization, - }; -}; - -export const mapDispatchToProps = (dispatch) => ({ - requestSubmitOptions: (form) => dispatch(submitOptions({ form })), - requestFetchOptions: () => dispatch(FetchOptions({})), -}); - -export default connect(mapStateToProps, mapDispatchToProps); diff --git a/client/src/connectors/TrialBalanceSheet.connect.js b/client/src/connectors/TrialBalanceSheet.connect.js deleted file mode 100644 index a37049ad6..000000000 --- a/client/src/connectors/TrialBalanceSheet.connect.js +++ /dev/null @@ -1,24 +0,0 @@ -import {connect} from 'react-redux'; -import { - fetchTrialBalanceSheet -} from 'store/financialStatement/financialStatements.actions'; -import { - getFinancialSheetIndexByQuery, - getFinancialSheetAccounts, - getFinancialSheetQuery, -} from 'store/financialStatement/financialStatements.selectors'; - - -export const mapStateToProps = (state, props) => ({ - getTrialBalanceSheetIndex: (query) => getFinancialSheetIndexByQuery(state.financialStatements.trialBalance.sheets, query), - getTrialBalanceAccounts: (sheetIndex) => getFinancialSheetAccounts(state.financialStatements.trialBalance.sheets, sheetIndex), - getTrialBalanceQuery: (sheetIndex) => getFinancialSheetQuery(state.financialStatements.trialBalance.sheets, sheetIndex), - - trialBalanceSheetLoading: state.financialStatements.trialBalance.loading, -}); - -export const mapDispatchToProps = (dispatch) => ({ - fetchTrialBalanceSheet: (query = {}) => dispatch(fetchTrialBalanceSheet({ query })), -}); - -export default connect(mapStateToProps, mapDispatchToProps); \ No newline at end of file diff --git a/client/src/connectors/UserFormDialog.connector.js b/client/src/connectors/UserFormDialog.connector.js deleted file mode 100644 index ddd66652f..000000000 --- a/client/src/connectors/UserFormDialog.connector.js +++ /dev/null @@ -1,30 +0,0 @@ -import { connect } from 'react-redux'; -import { submitInvite, editUser, fetchUser } from 'store/users/users.actions'; -import { getUserDetails } from 'store/users/users.reducer'; -import { getDialogPayload } from 'store/dashboard/dashboard.reducer'; -import t from 'store/types'; - -export const mapStateToProps = (state, props) => { - const dialogPayload = getDialogPayload(state, 'user-form'); - - return { - name: 'user-form', - payload: { action: 'new', id: null }, - userDetails: - dialogPayload.action === 'edit' - ? getUserDetails(state, dialogPayload.user.id) - : {}, - }; -}; - -export const mapDispatchToProps = (dispatch) => ({ - openDialog: (name, payload) => - dispatch({ type: t.OPEN_DIALOG, name, payload }), - closeDialog: (name, payload) => - dispatch({ type: t.CLOSE_DIALOG, name, payload }), - requestSubmitInvite: (form) => dispatch(submitInvite({ form })), - requestEditUser: (id, form) => dispatch(editUser({ form, id })), - requestFetchUser: (id) => dispatch(fetchUser({ id })), -}); - -export default connect(mapStateToProps, mapDispatchToProps); diff --git a/client/src/connectors/UsersList.connector.js b/client/src/connectors/UsersList.connector.js deleted file mode 100644 index 3811999a2..000000000 --- a/client/src/connectors/UsersList.connector.js +++ /dev/null @@ -1,44 +0,0 @@ -import { connect } from 'react-redux'; -import { - fetchUsers, - fetchUser, - deleteUser, - inactiveUser, - editUser, -} from 'store/users/users.actions'; -import t from 'store/types'; -import { getUserDetails } from 'store/users/users.reducer'; -import { getDialogPayload } from 'store/dashboard/dashboard.reducer'; - -export const mapStateToProps = (state, props) => { - const dialogPayload = getDialogPayload(state, 'userList-form'); - - return { - name: 'userList-form', - payload: { action: 'new', id: null }, - userDetails: - dialogPayload.action === 'edit' - ? getUserDetails(state, dialogPayload.user.id) - : {}, - editUser: - dialogPayload && dialogPayload.action === 'edit' - ? state.users.list.results[dialogPayload.user.id] - : {}, - usersList: state.users.list.results, - }; -}; - -export const mapDispatchToProps = (dispatch) => ({ - openDialog: (name, payload) => - dispatch({ type: t.OPEN_DIALOG, name, payload }), - closeDialog: (name, payload) => - dispatch({ type: t.CLOSE_DIALOG, name, payload }), - - requestFetchUsers: () => dispatch(fetchUsers({})), - requestFetchUser: (id) => dispatch(fetchUser({ id })), - requestDeleteUser: (id) => dispatch(deleteUser({ id })), - requestInactiveUser: (id) => dispatch(inactiveUser({ id })), - requestEditUser: (id, form) => dispatch(editUser({ form, id })), -}); - -export default connect(mapStateToProps, mapDispatchToProps); diff --git a/client/src/containers/Accounting/MakeJournalEntriesForm.js b/client/src/containers/Accounting/MakeJournalEntriesForm.js index 62d917bba..df4359e1d 100644 --- a/client/src/containers/Accounting/MakeJournalEntriesForm.js +++ b/client/src/containers/Accounting/MakeJournalEntriesForm.js @@ -23,7 +23,7 @@ import withDashboardActions from 'containers/Dashboard/withDashboardActions'; import AppToaster from 'components/AppToaster'; import Dragzone from 'components/Dragzone'; -import MediaConnect from 'connectors/Media.connect'; +import withMediaActions from 'containers/Media/withMediaActions'; import useMedia from 'hooks/useMedia'; import { compose } from 'utils'; @@ -321,5 +321,5 @@ export default compose( withManualJournalDetail, withAccountsActions, withDashboardActions, - MediaConnect, + withMediaActions, )(MakeJournalEntriesForm); diff --git a/client/src/containers/Accounting/ManualJournalActionsBar.js b/client/src/containers/Accounting/ManualJournalActionsBar.js index 030f6e9da..91ebae9eb 100644 --- a/client/src/containers/Accounting/ManualJournalActionsBar.js +++ b/client/src/containers/Accounting/ManualJournalActionsBar.js @@ -16,10 +16,10 @@ import classNames from 'classnames'; import { useRouteMatch, useHistory } from 'react-router-dom'; import { FormattedMessage as T } from 'react-intl'; - import FilterDropdown from 'components/FilterDropdown'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; -import DialogConnect from 'connectors/Dialog.connector'; +import withDialogActions from 'containers/Dialog/withDialogActions'; + import { If } from 'components'; import withResourceDetail from 'containers/Resources/withResourceDetails'; @@ -137,7 +137,7 @@ function ManualJournalActionsBar({ } export default compose( - DialogConnect, + withDialogActions, withResourceDetail(({ resourceFields }) => ({ resourceFields, })), diff --git a/client/src/containers/Accounting/ManualJournalsDataTable.js b/client/src/containers/Accounting/ManualJournalsDataTable.js index 600e1f323..40a0ca25c 100644 --- a/client/src/containers/Accounting/ManualJournalsDataTable.js +++ b/client/src/containers/Accounting/ManualJournalsDataTable.js @@ -13,23 +13,22 @@ import { } from '@blueprintjs/core'; import { useParams } from 'react-router-dom'; import { FormattedMessage as T, useIntl } from 'react-intl'; +import moment from 'moment'; import Icon from 'components/Icon'; import { compose } from 'utils'; -import moment from 'moment'; +import { useUpdateEffect } from 'hooks'; import LoadingIndicator from 'components/LoadingIndicator'; -import DialogConnect from 'connectors/Dialog.connector'; - -import { useUpdateEffect } from 'hooks'; +import { If, Money } from 'components'; import DataTable from 'components/DataTable'; +import withDialogActions from 'containers/Dialog/withDialogActions'; import withDashboardActions from 'containers/Dashboard/withDashboardActions'; import withViewDetails from 'containers/Views/withViewDetails'; import withManualJournals from 'containers/Accounting/withManualJournals'; import withManualJournalsActions from 'containers/Accounting/withManualJournalsActions'; -import { If, Money } from 'components'; function ManualJournalsDataTable({ loading, @@ -272,7 +271,7 @@ function ManualJournalsDataTable({ } export default compose( - DialogConnect, + withDialogActions, withDashboardActions, withManualJournalsActions, withManualJournals(({ manualJournals, manualJournalsLoading }) => ({ diff --git a/client/src/containers/Accounts/AccountsActionsBar.js b/client/src/containers/Accounts/AccountsActionsBar.js index 0efd7819e..4bca5a518 100644 --- a/client/src/containers/Accounts/AccountsActionsBar.js +++ b/client/src/containers/Accounts/AccountsActionsBar.js @@ -19,16 +19,14 @@ import { FormattedMessage as T } from 'react-intl'; import { If } from 'components'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; -import DialogConnect from 'connectors/Dialog.connector'; - import FilterDropdown from 'components/FilterDropdown'; +import withDialogActions from 'containers/Dialog/withDialogActions'; import withResourceDetail from 'containers/Resources/withResourceDetails'; import withAccountsTableActions from 'containers/Accounts/withAccountsTableActions'; import withAccounts from 'containers/Accounts/withAccounts'; -import {compose} from 'utils'; - +import { compose } from 'utils'; function AccountsActionsBar({ openDialog, @@ -45,28 +43,31 @@ function AccountsActionsBar({ onBulkDelete, onBulkArchive, onBulkActivate, - onBulkInactive + onBulkInactive, }) { const history = useHistory(); const [filterCount, setFilterCount] = useState(0); - const onClickNewAccount = () => { openDialog('account-form', {}); }; + const onClickNewAccount = () => { + openDialog('account-form', {}); + }; const onClickViewItem = (view) => { - history.push(view - ? `/accounts/${view.id}/custom_view` : '/accounts'); + history.push(view ? `/accounts/${view.id}/custom_view` : '/accounts'); }; const viewsMenuItems = accountsViews.map((view) => { - return ( onClickViewItem(view)} text={view.name} />); + return onClickViewItem(view)} text={view.name} />; }); - const hasSelectedRows = useMemo(() => selectedRows.length > 0, [selectedRows]); - + const hasSelectedRows = useMemo(() => selectedRows.length > 0, [ + selectedRows, + ]); + const filterDropdown = FilterDropdown({ fields: resourceFields, onFilterChange: (filterConditions) => { setFilterCount(filterConditions.length || 0); addAccountsTableQueries({ - filter_roles: filterConditions || '', + filter_roles: filterConditions || '', }); onFilterChanged && onFilterChanged(filterConditions); }, @@ -77,19 +78,16 @@ function AccountsActionsBar({ // }, [onBulkArchive, selectedRows]); const handleBulkDelete = useCallback(() => { - onBulkDelete && onBulkDelete(selectedRows.map(r => r.id)); + onBulkDelete && onBulkDelete(selectedRows.map((r) => r.id)); }, [onBulkDelete, selectedRows]); - const handelBulkActivate =useCallback(()=>{ + const handelBulkActivate = useCallback(() => { + onBulkActivate && onBulkActivate(selectedRows.map((r) => r.id)); + }, [onBulkActivate, selectedRows]); - onBulkActivate && onBulkActivate(selectedRows.map(r=>r.id)) - },[onBulkActivate,selectedRows]) - -const handelBulkInactive =useCallback(()=>{ - -onBulkInactive && onBulkInactive(selectedRows.map(r=>r.id)) - -},[onBulkInactive,selectedRows]) + const handelBulkInactive = useCallback(() => { + onBulkInactive && onBulkInactive(selectedRows.map((r) => r.id)); + }, [onBulkInactive, selectedRows]); return ( @@ -112,16 +110,16 @@ onBulkInactive && onBulkInactive(selectedRows.map(r=>r.id))