diff --git a/source/frontend/src/features/acquisition/hooks/useAcquisitionFileExport.ts b/source/frontend/src/features/acquisition/hooks/useAcquisitionFileExport.ts index f067827d55..8176609db5 100644 --- a/source/frontend/src/features/acquisition/hooks/useAcquisitionFileExport.ts +++ b/source/frontend/src/features/acquisition/hooks/useAcquisitionFileExport.ts @@ -3,15 +3,16 @@ import fileDownload from 'js-file-download'; import { useCallback } from 'react'; import { useDispatch } from 'react-redux'; import { hideLoading, showLoading } from 'react-redux-loading-bar'; -import { toast } from 'react-toastify'; import { IPaginateAcquisition, useApiAcquisitionFile, } from '@/hooks/pims-api/useApiAcquisitionFile'; +import { useModalContext } from '@/hooks/useModalContext'; import { logError, logRequest, logSuccess } from '@/store/slices/network/networkSlice'; export const useAcquisitionFileExport = () => { + const { setModalContent, setDisplayModal } = useModalContext(); const { exportAcquisitionFiles: apiExportAcquisitionFiles } = useApiAcquisitionFile(); const dispatch = useDispatch(); @@ -27,9 +28,13 @@ export const useAcquisitionFileExport = () => { try { const { data, status } = await apiExportAcquisitionFiles(filter); if (status === 204) { - toast.warn( - "We were unable to retrieve any data for your request. If you've applied any filters or search criteria, ensure they are set correctly. Broadening your criteria may yield results.", - ); + setModalContent({ + variant: 'warning', + title: 'Warning', + message: 'There is no data for the input parameters you entered.', + okButtonText: 'Close', + }); + setDisplayModal(true); } else { dispatch(logSuccess({ name: requestId, status })); fileDownload(data, fileName); @@ -48,7 +53,7 @@ export const useAcquisitionFileExport = () => { } } }, - [dispatch, apiExportAcquisitionFiles], + [dispatch, apiExportAcquisitionFiles, setModalContent, setDisplayModal], ); return { exportAcquisitionFiles }; diff --git a/source/frontend/src/features/disposition/hooks/useDispositionFileExport.ts b/source/frontend/src/features/disposition/hooks/useDispositionFileExport.ts index 5278ced113..c631c2a511 100644 --- a/source/frontend/src/features/disposition/hooks/useDispositionFileExport.ts +++ b/source/frontend/src/features/disposition/hooks/useDispositionFileExport.ts @@ -3,15 +3,16 @@ import fileDownload from 'js-file-download'; import { useCallback } from 'react'; import { useDispatch } from 'react-redux'; import { hideLoading, showLoading } from 'react-redux-loading-bar'; -import { toast } from 'react-toastify'; import { IPaginateDisposition, useApiDispositionFile, } from '@/hooks/pims-api/useApiDispositionFile'; +import { useModalContext } from '@/hooks/useModalContext'; import { logError, logRequest, logSuccess } from '@/store/slices/network/networkSlice'; export const useDispositionFileExport = () => { + const { setModalContent, setDisplayModal } = useModalContext(); const { exportDispositionFiles: apiExportDispositionFiles } = useApiDispositionFile(); const dispatch = useDispatch(); @@ -27,9 +28,13 @@ export const useDispositionFileExport = () => { try { const { data, status } = await apiExportDispositionFiles(filter); if (status === 204) { - toast.warn( - "We were unable to retrieve any data for your request. If you've applied any filters or search criteria, ensure they are set correctly. Broadening your criteria may yield results.", - ); + setModalContent({ + variant: 'warning', + title: 'Warning', + message: 'There is no data for the input parameters you entered.', + okButtonText: 'Close', + }); + setDisplayModal(true); } else { dispatch(logSuccess({ name: requestId, status })); fileDownload(data, fileName); @@ -48,7 +53,7 @@ export const useDispositionFileExport = () => { } } }, - [dispatch, apiExportDispositionFiles], + [dispatch, apiExportDispositionFiles, setModalContent, setDisplayModal], ); return { exportDispositionFiles }; diff --git a/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/propertyOperation/OperationContainer.test.tsx b/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/propertyOperation/OperationContainer.test.tsx index 23e7825e3e..b69f74ed6a 100644 --- a/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/propertyOperation/OperationContainer.test.tsx +++ b/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/propertyOperation/OperationContainer.test.tsx @@ -46,10 +46,12 @@ describe('OperationContainer component', () => { renderOptions: RenderOptions & Partial = { propertyId: 1 }, ) => { const { propertyId, ...rest } = renderOptions; - const component = render( - , - { ...rest, store: storeState, claims: [Claims.PROPERTY_VIEW], history }, - ); + const component = render(, { + ...rest, + store: storeState, + claims: [Claims.PROPERTY_VIEW], + history, + }); return { ...component }; }; diff --git a/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/propertyOperation/OperationView.test.tsx b/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/propertyOperation/OperationView.test.tsx index 3dc960ae53..861463385a 100644 --- a/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/propertyOperation/OperationView.test.tsx +++ b/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/propertyOperation/OperationView.test.tsx @@ -11,9 +11,7 @@ const history = createMemoryHistory(); const store = { [lookupCodesSlice.name]: { lookupCodes: mockLookups } }; describe('Subdivision detail view', () => { - const setup = ( - renderOptions: RenderOptions & { props?: Partial } = {}, - ) => { + const setup = (renderOptions: RenderOptions & { props?: Partial } = {}) => { const props = renderOptions.props; const component = render(