Files
bigcapital/packages/webapp/src/containers/WarehouseTransfers/WarehouseTransfersLanding/WarehouseTransfersList.tsx
2024-07-25 19:17:54 +02:00

52 lines
1.6 KiB
TypeScript

// @ts-nocheck
import React from 'react';
import { DashboardPageContent } from '@/components';
import WarehouseTransfersActionsBar from './WarehouseTransfersActionsBar';
import WarehouseTransfersDataTable from './WarehouseTransfersDataTable';
import withWarehouseTransfers from './withWarehouseTransfers';
import withWarehouseTransfersActions from './withWarehouseTransfersActions';
import { WarehouseTransfersListProvider } from './WarehouseTransfersListProvider';
import { transformTableStateToQuery, compose } from '@/utils';
function WarehouseTransfersList({
// #withWarehouseTransfers
warehouseTransferTableState,
warehouseTransferTableStateChanged,
// #withWarehouseTransfersActions
resetWarehouseTransferTableState,
}) {
// Resets the warehouse transfer table state once the page unmount.
React.useEffect(
() => () => {
resetWarehouseTransferTableState();
},
[resetWarehouseTransferTableState],
);
return (
<WarehouseTransfersListProvider
query={transformTableStateToQuery(warehouseTransferTableState)}
tableStateChanged={warehouseTransferTableStateChanged}
>
<WarehouseTransfersActionsBar />
<DashboardPageContent>
<WarehouseTransfersDataTable />
</DashboardPageContent>
</WarehouseTransfersListProvider>
);
}
export default compose(
withWarehouseTransfersActions,
withWarehouseTransfers(
({ warehouseTransferTableState, warehouseTransferTableStateChanged }) => ({
warehouseTransferTableState,
warehouseTransferTableStateChanged,
}),
),
)(WarehouseTransfersList);