import React, { useCallback, useMemo, useState, useEffect } from 'react'; import Icon from 'components/Icon'; import DialogConnect from 'connectors/Dialog.connector'; import DataTable from 'components/DataTable'; import { Button, Popover, Menu, MenuItem, Position,Intent } from '@blueprintjs/core'; import { FormattedMessage as T, useIntl } from 'react-intl'; import LoadingIndicator from 'components/LoadingIndicator'; import withExchangeRatesActions from 'containers/ExchangeRates/withExchangeRatesActions'; import withExchangeRates from 'containers/ExchangeRates/withExchangeRates'; import { compose } from 'utils'; function ExchangeRateTable({ // #withExchangeRates exchangeRatesList, exchangeRatesLoading, // #withDialog. openDialog, // own properties loading, onFetchData, onDeleteExchangeRate, onEditExchangeRate, onSelectedRowsChange, }) { const [initialMount, setInitialMount] = useState(false); const { formatMessage } = useIntl(); const handelEditExchangeRate = (exchange_rate) => () => { openDialog('exchangeRate-form', { action: 'edit', id: exchange_rate.id }); onEditExchangeRate(exchange_rate.id); }; const handleDeleteExchangeRate = (exchange_rate) => () => { onDeleteExchangeRate(exchange_rate); }; const actionMenuList = useCallback( (ExchangeRate) => ( } onClick={handelEditExchangeRate(ExchangeRate)} /> } intent={Intent.DANGER} onClick={handleDeleteExchangeRate(ExchangeRate)} /> ), [handelEditExchangeRate, handleDeleteExchangeRate], ); const columns = useMemo( () => [ { id: 'date', Header: formatMessage({ id: 'date' }), // accessor: 'date', width: 150, }, { id: 'currency_code', Header: formatMessage({ id: 'currency_code' }), accessor: 'currency_code', className: 'currency_code', width: 150, }, { id: 'exchange_rate', Header: formatMessage({ id: 'exchange_rate' }), accessor: 'exchange_rate', className: 'exchange_rate', width: 150, }, { id: 'actions', Header: '', Cell: ({ cell }) => (