mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
refactoring: migrating to react-query to manage service-side state.
This commit is contained in:
@@ -4,24 +4,23 @@ import { useIntl } from 'react-intl';
|
||||
|
||||
import FinancialSheet from 'components/FinancialSheet';
|
||||
import DataTable from 'components/DataTable';
|
||||
import Money from 'components/Money';
|
||||
import { useJournalSheetContext } from './JournalProvider';
|
||||
|
||||
import withJournal from './withJournal';
|
||||
|
||||
import { compose, defaultExpanderReducer, getForceWidth } from 'utils';
|
||||
|
||||
function JournalSheetTable({
|
||||
// #withJournal
|
||||
journalSheetTableRows,
|
||||
journalSheetLoading,
|
||||
journalSheetQuery,
|
||||
import { defaultExpanderReducer, getForceWidth } from 'utils';
|
||||
|
||||
export default function JournalSheetTable({
|
||||
// #ownProps
|
||||
onFetchData,
|
||||
companyName,
|
||||
}) {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
// Journal sheet context.
|
||||
const {
|
||||
journalSheet: { tableRows, query },
|
||||
isLoading
|
||||
} = useJournalSheetContext();
|
||||
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
@@ -101,17 +100,17 @@ function JournalSheetTable({
|
||||
<FinancialSheet
|
||||
companyName={companyName}
|
||||
sheetType={formatMessage({ id: 'journal_sheet' })}
|
||||
fromDate={journalSheetQuery.from_date}
|
||||
toDate={journalSheetQuery.to_date}
|
||||
fromDate={query.from_date}
|
||||
toDate={query.to_date}
|
||||
name="journal"
|
||||
loading={journalSheetLoading}
|
||||
loading={isLoading}
|
||||
// minimal={true}
|
||||
fullWidth={true}
|
||||
>
|
||||
<DataTable
|
||||
className="bigcapital-datatable--financial-report"
|
||||
columns={columns}
|
||||
data={journalSheetTableRows}
|
||||
data={tableRows}
|
||||
rowClassNames={rowClassNames}
|
||||
onFetchData={handleFetchData}
|
||||
noResults={formatMessage({
|
||||
@@ -122,14 +121,4 @@ function JournalSheetTable({
|
||||
/>
|
||||
</FinancialSheet>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withJournal(
|
||||
({ journalSheetTableRows, journalSheetLoading, journalSheetQuery }) => ({
|
||||
journalSheetTableRows,
|
||||
journalSheetLoading,
|
||||
journalSheetQuery,
|
||||
}),
|
||||
),
|
||||
)(JournalSheetTable);
|
||||
}
|
||||
Reference in New Issue
Block a user