import React, { useCallback, useMemo } from 'react'; import { Intent, Button, Popover, Menu, MenuItem, Position, } from '@blueprintjs/core'; import { withRouter } from 'react-router'; import { useIntl } from 'react-intl'; import { compose, saveInvoke } from 'utils'; import { DataTable, Icon } from 'components'; import withDashboardActions from 'containers/Dashboard/withDashboardActions'; import withCurrencies from 'containers/Currencies/withCurrencies'; import withDialogActions from 'containers/Dialog/withDialogActions'; function CurrenciesDataTable({ // #withCurrencies currenciesList, currenciesLoading, // #ownProps onFetchData, onDeleteCurrency, // #withDialog. openDialog, }) { const { formatMessage } = useIntl(); const handleEditCurrency = useCallback( (currency) => { openDialog('currency-form', { action: 'edit', currencyCode: currency.currency_code, }); }, [openDialog], ); const actionMenuList = useCallback( (currency) => (
), [handleEditCurrency, onDeleteCurrency, formatMessage], ); const onRowContextMenu = useCallback( (cell) => { return actionMenuList(cell.row.original); }, [actionMenuList], ); const columns = useMemo( () => [ { Header: formatMessage({ id: 'currency_name' }), accessor: 'currency_name', width: 150, }, { Header: formatMessage({ id: 'currency_code' }), accessor: 'currency_code', className: 'currency_code', width: 120, }, { Header: 'Currency sign', width: 120, }, { id: 'actions', Header: '', Cell: ({ cell }) => (