From 3824fa42291b4e507d4582eb21961f0dc9573f3b Mon Sep 17 00:00:00 2001 From: Omri Levy <61207713+Omri-Levy@users.noreply.github.com> Date: Tue, 13 Aug 2024 12:15:42 +0300 Subject: [PATCH 1/2] fix(*): added a wait step for workflows service db (#2639) --- pnpm-lock.yaml | 32 +++++++++++-------------- services/workflows-service/package.json | 5 ++-- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 62ec2ab8da..24b81c795b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2841,6 +2841,9 @@ importers: typescript: specifier: 4.9.3 version: 4.9.3 + wait-on: + specifier: ^7.0.1 + version: 7.2.0 websites/docs: dependencies: @@ -9006,13 +9009,11 @@ packages: /@hapi/hoek@9.3.0: resolution: {integrity: sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==} - dev: false /@hapi/topo@5.1.0: resolution: {integrity: sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==} dependencies: '@hapi/hoek': 9.3.0 - dev: false /@hookform/resolvers@3.3.2(react-hook-form@7.48.2): resolution: {integrity: sha512-Tw+GGPnBp+5DOsSg4ek3LCPgkBOuOgS5DsDV7qsWNH9LZc433kgsWICjlsh2J9p04H2K66hsXPPb9qn9ILdUtA==} @@ -9387,7 +9388,7 @@ packages: magic-string: 0.27.0 react-docgen-typescript: 2.2.2(typescript@5.5.4) typescript: 5.5.4 - vite: 5.3.5(@types/node@20.9.2) + vite: 5.3.5(@types/node@18.17.19) dev: true /@jridgewell/gen-mapping@0.3.3: @@ -13420,15 +13421,12 @@ packages: resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==} dependencies: '@hapi/hoek': 9.3.0 - dev: false /@sideway/formula@3.0.1: resolution: {integrity: sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==} - dev: false /@sideway/pinpoint@2.0.0: resolution: {integrity: sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==} - dev: false /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} @@ -15743,7 +15741,7 @@ packages: react: 18.2.0 react-docgen: 6.0.4 react-dom: 18.2.0(react@18.2.0) - vite: 5.3.5(@types/node@20.9.2) + vite: 5.3.5(@types/node@18.17.19) transitivePeerDependencies: - '@preact/preset-vite' - encoding @@ -18513,7 +18511,7 @@ packages: '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.23.3) magic-string: 0.27.0 react-refresh: 0.14.0 - vite: 5.3.5(@types/node@20.9.2) + vite: 5.3.5(@types/node@18.17.19) transitivePeerDependencies: - supports-color dev: true @@ -18529,7 +18527,7 @@ packages: '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.23.3) '@types/babel__core': 7.20.4 react-refresh: 0.14.0 - vite: 4.5.3(@types/node@20.9.2) + vite: 4.5.3(@types/node@18.17.19) transitivePeerDependencies: - supports-color dev: true @@ -23207,7 +23205,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.5) + '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.3) debug: 3.2.7 eslint: 8.54.0 eslint-import-resolver-node: 0.3.9 @@ -23372,7 +23370,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.5) + '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.3) array-includes: 3.1.7 array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 @@ -23744,7 +23742,7 @@ packages: '@typescript-eslint/eslint-plugin': optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.22.0)(typescript@4.9.5) + '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.22.0)(typescript@5.5.4) eslint: 8.22.0 eslint-rule-composer: 0.3.0 dev: true @@ -27220,7 +27218,6 @@ packages: '@sideway/address': 4.1.4 '@sideway/formula': 3.0.1 '@sideway/pinpoint': 2.0.0 - dev: false /js-base64@3.7.6: resolution: {integrity: sha512-NPrWuHFxFUknr1KqJRDgUQPexQF0uIJWjeT+2KjEePhitQxQEx5EJBG1lVn5/hc8aLycTpXrDOgPQ6Zq+EDiTA==} @@ -34893,7 +34890,7 @@ packages: strip-ansi: 6.0.1 tiny-invariant: 1.3.1 typescript: 5.1.6 - vite: 4.5.3(@types/node@20.9.2) + vite: 4.5.3(@types/node@18.17.19) vscode-languageclient: 7.0.0 vscode-languageserver: 7.0.0 vscode-languageserver-textdocument: 1.0.11 @@ -35024,7 +35021,7 @@ packages: kolorist: 1.8.0 sirv: 2.0.3 ufo: 1.3.2 - vite: 4.5.3(@types/node@20.9.2) + vite: 4.5.3(@types/node@18.17.19) transitivePeerDependencies: - rollup - supports-color @@ -35075,7 +35072,7 @@ packages: debug: 4.3.4(supports-color@8.1.1) globrex: 0.1.2 tsconfck: 2.1.2(typescript@5.1.6) - vite: 4.5.3(@types/node@20.9.2) + vite: 4.5.3(@types/node@18.17.19) transitivePeerDependencies: - supports-color - typescript @@ -35092,7 +35089,7 @@ packages: debug: 4.3.4(supports-color@8.1.1) globrex: 0.1.2 tsconfck: 2.1.2(typescript@5.5.4) - vite: 5.3.5(@types/node@20.9.2) + vite: 5.3.5(@types/node@18.17.19) transitivePeerDependencies: - supports-color - typescript @@ -35673,7 +35670,6 @@ packages: rxjs: 7.8.1 transitivePeerDependencies: - debug - dev: false /walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} diff --git a/services/workflows-service/package.json b/services/workflows-service/package.json index 6991f60dd3..321a03e8d0 100644 --- a/services/workflows-service/package.json +++ b/services/workflows-service/package.json @@ -5,7 +5,7 @@ "description": "workflow-service", "scripts": { "spellcheck": "cspell \"*\"", - "setup": "npm run docker:db:down && npm run docker:db && npm run db:reset && npm run seed", + "setup": "npm run docker:db:down && npm run docker:db && wait-on tcp:5432 && npm run db:reset && npm run seed", "format": "prettier --write . '!**/*.{md,hbs}'", "format:check": "prettier --check . '!**/*.{md,hbs}'", "lint": "eslint . --fix", @@ -157,6 +157,7 @@ "tsconfig-paths": "4.2.0", "tsx": "^4.7.1", "type-fest": "0.11.0", - "typescript": "4.9.3" + "typescript": "4.9.3", + "wait-on": "^7.0.1" } } From c4ea42e57f48312e24c50bdc3bd23e30ff79c44e Mon Sep 17 00:00:00 2001 From: Omri Levy <61207713+Omri-Levy@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:54:33 +0300 Subject: [PATCH 2/2] Replaced pagination component (#2642) * feat(backoffice-v2): replaced pagination component and added last page button * revert(backoffice-v2): removed unused isEmptyArray util * fix(backoffice-v2): removed sleep added by mistake --- .../molecules/Pagination/Pagination.Last.tsx | 5 +- .../molecules/UrlPagination/UrlPagination.tsx | 24 +++++++- .../organisms/Pagination/Pagination.tsx | 57 ------------------- .../organisms/Pagination/interfaces.ts | 5 -- .../hooks/usePagination/usePagination.tsx | 13 ++++- .../src/domains/business-reports/fetchers.ts | 7 +-- .../src/pages/Entities/Entities.page.tsx | 45 ++++++++------- .../hooks/useEntities/useEntities.tsx | 29 +++++----- .../MerchantMonitoring.page.tsx | 26 +++++---- .../useMerchantMonitoringLogic.tsx | 8 +-- .../Profiles/Individuals/Individuals.page.tsx | 3 + .../useIndividualsLogic.tsx | 5 +- .../TransactionMonitoringAlerts.page.tsx | 3 + .../useTransactionMonitoringAlertsLogic.tsx | 5 +- 14 files changed, 113 insertions(+), 122 deletions(-) delete mode 100644 apps/backoffice-v2/src/common/components/organisms/Pagination/Pagination.tsx delete mode 100644 apps/backoffice-v2/src/common/components/organisms/Pagination/interfaces.ts diff --git a/apps/backoffice-v2/src/common/components/molecules/Pagination/Pagination.Last.tsx b/apps/backoffice-v2/src/common/components/molecules/Pagination/Pagination.Last.tsx index cf8484d8f7..a5e127fb3a 100644 --- a/apps/backoffice-v2/src/common/components/molecules/Pagination/Pagination.Last.tsx +++ b/apps/backoffice-v2/src/common/components/molecules/Pagination/Pagination.Last.tsx @@ -12,7 +12,10 @@ export const PaginationLast: FunctionComponent< string; onNextPage: () => string; + onLastPage: () => string; onPaginate: (page: number) => string; + isLastPageEnabled?: boolean; isLastPage: boolean; -}> = ({ page, onPrevPage, onNextPage, onPaginate, isLastPage }) => { +}> = ({ + page, + onPrevPage, + onNextPage, + onLastPage, + onPaginate, + isLastPage, + isLastPageEnabled = true, +}) => { return ( @@ -46,6 +57,17 @@ export const UrlPagination: FunctionComponent<{ aria-disabled={isLastPage} /> + {isLastPageEnabled && ( + + + + )} ); diff --git a/apps/backoffice-v2/src/common/components/organisms/Pagination/Pagination.tsx b/apps/backoffice-v2/src/common/components/organisms/Pagination/Pagination.tsx deleted file mode 100644 index 9e6515cfd2..0000000000 --- a/apps/backoffice-v2/src/common/components/organisms/Pagination/Pagination.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { FunctionComponent } from 'react'; -import { IPaginationProps } from './interfaces'; -import { Button } from '../../atoms/Button/Button'; -import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from 'lucide-react'; - -export const Pagination: FunctionComponent = ({ - onPaginate, - page, - totalPages, -}) => { - return ( -
- - Page {page} of {totalPages} - - -
- ); -}; diff --git a/apps/backoffice-v2/src/common/components/organisms/Pagination/interfaces.ts b/apps/backoffice-v2/src/common/components/organisms/Pagination/interfaces.ts deleted file mode 100644 index e255d6738f..0000000000 --- a/apps/backoffice-v2/src/common/components/organisms/Pagination/interfaces.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface IPaginationProps { - page: number; - onPaginate: (page: number) => () => void; - totalPages: number; -} diff --git a/apps/backoffice-v2/src/common/hooks/usePagination/usePagination.tsx b/apps/backoffice-v2/src/common/hooks/usePagination/usePagination.tsx index 219d3dedc4..d0fff8b956 100644 --- a/apps/backoffice-v2/src/common/hooks/usePagination/usePagination.tsx +++ b/apps/backoffice-v2/src/common/hooks/usePagination/usePagination.tsx @@ -2,9 +2,11 @@ import { useCallback } from 'react'; import { useSerializedSearchParams } from '@/common/hooks/useSerializedSearchParams/useSerializedSearchParams'; import { defaultSerializer } from '@/common/hooks/useZodSearchParams/utils/default-serializer'; -export const usePagination = () => { +export const usePagination = ({ totalPages }: { totalPages: number }) => { const [searchParams] = useSerializedSearchParams(); + const isLastPage = Number(searchParams.page) === totalPages || totalPages === 0; + const onPaginate = useCallback( (page: number) => { return defaultSerializer({ @@ -15,6 +17,13 @@ export const usePagination = () => { [searchParams], ); + const onLastPage = useCallback(() => { + return defaultSerializer({ + ...searchParams, + page: totalPages.toString(), + }); + }, [searchParams, totalPages]); + const onNextPage = useCallback(() => { const pageNumber = Number(searchParams.page); const nextPage = pageNumber + 1; @@ -38,7 +47,9 @@ export const usePagination = () => { return { page: searchParams.page, pageSize: searchParams.pageSize, + isLastPage, onPaginate, + onLastPage, onNextPage, onPrevPage, }; diff --git a/apps/backoffice-v2/src/domains/business-reports/fetchers.ts b/apps/backoffice-v2/src/domains/business-reports/fetchers.ts index b6a1aee2b6..faef1932f0 100644 --- a/apps/backoffice-v2/src/domains/business-reports/fetchers.ts +++ b/apps/backoffice-v2/src/domains/business-reports/fetchers.ts @@ -4,10 +4,9 @@ import { Method } from '@/common/enums'; import { handleZodError } from '@/common/utils/handle-zod-error/handle-zod-error'; import { TBusinessReportType } from '@/domains/business-reports/types'; import qs from 'qs'; -import { Severities } from '@ballerine/common'; +import { ObjectValues, Severities } from '@ballerine/common'; import { toast } from 'sonner'; import { t } from 'i18next'; -import { ObjectValues } from '@ballerine/common'; export const BusinessReportStatus = { NEW: 'new', @@ -83,13 +82,13 @@ export const fetchLatestBusinessReport = async ({ businessId: string; reportType: TBusinessReportType; }) => { - const [filter, error] = await apiClient({ + const [data, error] = await apiClient({ endpoint: `business-reports/latest?businessId=${businessId}&type=${reportType}`, method: Method.GET, schema: BusinessReportSchema, }); - return handleZodError(error, filter); + return handleZodError(error, data); }; export const fetchBusinessReports = async ({ diff --git a/apps/backoffice-v2/src/pages/Entities/Entities.page.tsx b/apps/backoffice-v2/src/pages/Entities/Entities.page.tsx index 2f8bb42263..d6a9f379b9 100644 --- a/apps/backoffice-v2/src/pages/Entities/Entities.page.tsx +++ b/apps/backoffice-v2/src/pages/Entities/Entities.page.tsx @@ -1,18 +1,21 @@ import { CaseCreation } from '@/pages/Entities/components/CaseCreation'; -import { ctw } from '@ballerine/ui'; -import { FunctionComponent } from 'react'; +import { ctw, Skeleton } from '@ballerine/ui'; +import React, { FunctionComponent } from 'react'; import { Outlet } from 'react-router-dom'; import { TAssignee } from '../../common/components/atoms/AssignDropdown/AssignDropdown'; import { MotionScrollArea } from '../../common/components/molecules/MotionScrollArea/MotionScrollArea'; -import { Pagination } from '../../common/components/organisms/Pagination/Pagination'; -import { Case } from '../Entity/components/Case/Case'; import { Cases } from './components/Cases/Cases'; import { useEntities } from './hooks/useEntities/useEntities'; import { NoCases } from '@/pages/Entities/components/NoCases/NoCases'; +import { UrlPagination } from '@/common/components/molecules/UrlPagination/UrlPagination'; export const Entities: FunctionComponent = () => { const { onPaginate, + onPrevPage, + onNextPage, + onLastPage, + isLastPage, onSearch, onFilter, onSortBy, @@ -25,6 +28,7 @@ export const Entities: FunctionComponent = () => { caseCount, skeletonEntities, isManualCaseCreationEnabled, + isNoCases, } = useEntities(); return ( @@ -71,26 +75,25 @@ export const Entities: FunctionComponent = () => {
- +
+
+ {!isLoading && `Page ${page} of ${totalPages || 1}`} + {isLoading && } +
+ +
{isManualCaseCreationEnabled && }
- {/* Display skeleton individual when loading the entities list */} - {isLoading && ( - - {/* Reject and approve header */} - - - -
- - -
- -
-
- )} - {Array.isArray(cases) && !cases.length && !isLoading ? : } + {isNoCases && } + {!isNoCases && } ); }; diff --git a/apps/backoffice-v2/src/pages/Entities/hooks/useEntities/useEntities.tsx b/apps/backoffice-v2/src/pages/Entities/hooks/useEntities/useEntities.tsx index 8cc9ff76c2..b9e53e3a63 100644 --- a/apps/backoffice-v2/src/pages/Entities/hooks/useEntities/useEntities.tsx +++ b/apps/backoffice-v2/src/pages/Entities/hooks/useEntities/useEntities.tsx @@ -6,6 +6,7 @@ import { useSearchParamsByEntity } from '../../../../common/hooks/useSearchParam import { createArrayOfNumbers } from '../../../../common/utils/create-array-of-numbers/create-array-of-numbers'; import { useSelectEntityOnMount } from '../../../../domains/entities/hooks/useSelectEntityOnMount/useSelectEntityOnMount'; import { useWorkflowsQuery } from '../../../../domains/workflows/hooks/queries/useWorkflowsQuery/useWorkflowsQuery'; +import { usePagination } from '@/common/hooks/usePagination/usePagination'; export const useEntities = () => { const [{ filterId, filter, sortBy, sortDir, page, pageSize, search }, setSearchParams] = @@ -20,11 +21,8 @@ export const useEntities = () => { pageSize, search, }); - - const { - meta: { totalPages }, - data: workflows, - } = data || { meta: { totalPages: 0 }, data: [] }; + const cases = data?.data; + const totalPages = data?.meta?.totalPages ?? 0; const entity = useEntityType(); const { onSearch, search: searchValue } = useSearch(); @@ -58,15 +56,9 @@ export const useEntities = () => { [filter, setSearchParams], ); - const onPaginate = useCallback( - (page: number) => () => { - setSearchParams({ - page, - pageSize, - }); - }, - [pageSize, setSearchParams], - ); + const { onPaginate, onPrevPage, onNextPage, onLastPage, isLastPage } = usePagination({ + totalPages: data?.meta?.totalPages ?? 0, + }); const onSearchChange: ChangeEventHandler = useCallback( event => { @@ -86,14 +78,20 @@ export const useEntities = () => { const { workflowDefinition } = useCaseCreationWorkflowDefinition(); + const isNoCases = !isLoading && Array.isArray(cases) && !cases.length; + return { onPaginate, + onPrevPage, + onNextPage, + onLastPage, + isLastPage, onSearch: onSearchChange, onFilter: onFilterChange, onSortBy: onSortByChange, onSortDirToggle, search: searchValue, - cases: data?.data, + cases, caseCount: data?.meta?.totalItems || 0, isLoading, page, @@ -101,5 +99,6 @@ export const useEntities = () => { skeletonEntities, entity, isManualCaseCreationEnabled: workflowDefinition?.config?.enableManualCreation, + isNoCases, }; }; diff --git a/apps/backoffice-v2/src/pages/MerchantMonitoring/MerchantMonitoring.page.tsx b/apps/backoffice-v2/src/pages/MerchantMonitoring/MerchantMonitoring.page.tsx index 713cc8387d..5d69cce188 100644 --- a/apps/backoffice-v2/src/pages/MerchantMonitoring/MerchantMonitoring.page.tsx +++ b/apps/backoffice-v2/src/pages/MerchantMonitoring/MerchantMonitoring.page.tsx @@ -8,6 +8,7 @@ import { buttonVariants } from '@/common/components/atoms/Button/Button'; import { Plus } from 'lucide-react'; import { Link } from 'react-router-dom'; import { Search } from '@/common/components/molecules/Search'; +import { Skeleton } from '@ballerine/ui'; export const MerchantMonitoring: FunctionComponent = () => { const { @@ -19,6 +20,7 @@ export const MerchantMonitoring: FunctionComponent = () => { page, onPrevPage, onNextPage, + onLastPage, onPaginate, isLastPage, locale, @@ -50,18 +52,20 @@ export const MerchantMonitoring: FunctionComponent = () => { {Array.isArray(businessReports) && !businessReports.length && !isLoadingBusinessReports && ( )} - {!!totalPages && ( -
-
{`Page ${page} of ${totalPages}`}
- +
+
+ {!isLoadingBusinessReports && `Page ${page} of ${totalPages || 1}`} + {isLoadingBusinessReports && }
- )} + +
); diff --git a/apps/backoffice-v2/src/pages/MerchantMonitoring/hooks/useMerchantMonitoringLogic/useMerchantMonitoringLogic.tsx b/apps/backoffice-v2/src/pages/MerchantMonitoring/hooks/useMerchantMonitoringLogic/useMerchantMonitoringLogic.tsx index f1e49cfa7e..7559c45497 100644 --- a/apps/backoffice-v2/src/pages/MerchantMonitoring/hooks/useMerchantMonitoringLogic/useMerchantMonitoringLogic.tsx +++ b/apps/backoffice-v2/src/pages/MerchantMonitoring/hooks/useMerchantMonitoringLogic/useMerchantMonitoringLogic.tsx @@ -34,10 +34,9 @@ export const useMerchantMonitoringLogic = () => { sortDir, }); - const { onPaginate, onPrevPage, onNextPage } = usePagination(); - - const isLastPage = - (data?.businessReports?.length ?? 0) < pageSize || data?.businessReports?.length === 0; + const { onPaginate, onPrevPage, onNextPage, onLastPage, isLastPage } = usePagination({ + totalPages: data?.meta.totalPages ?? 0, + }); return { totalPages: data?.meta.totalPages || 0, @@ -50,6 +49,7 @@ export const useMerchantMonitoringLogic = () => { page, onPrevPage, onNextPage, + onLastPage, onPaginate, isLastPage, locale, diff --git a/apps/backoffice-v2/src/pages/Profiles/Individuals/Individuals.page.tsx b/apps/backoffice-v2/src/pages/Profiles/Individuals/Individuals.page.tsx index 5a864b2022..502ec994db 100644 --- a/apps/backoffice-v2/src/pages/Profiles/Individuals/Individuals.page.tsx +++ b/apps/backoffice-v2/src/pages/Profiles/Individuals/Individuals.page.tsx @@ -12,6 +12,7 @@ export const Individuals = () => { page, onPrevPage, onNextPage, + onLastPage, onPaginate, isLastPage, search, @@ -32,8 +33,10 @@ export const Individuals = () => { page={page} onPrevPage={onPrevPage} onNextPage={onNextPage} + onLastPage={onLastPage} onPaginate={onPaginate} isLastPage={isLastPage} + isLastPageEnabled={false} /> diff --git a/apps/backoffice-v2/src/pages/Profiles/Individuals/hooks/useIndividualsLogic/useIndividualsLogic.tsx b/apps/backoffice-v2/src/pages/Profiles/Individuals/hooks/useIndividualsLogic/useIndividualsLogic.tsx index f893714a75..8de6cd2b57 100644 --- a/apps/backoffice-v2/src/pages/Profiles/Individuals/hooks/useIndividualsLogic/useIndividualsLogic.tsx +++ b/apps/backoffice-v2/src/pages/Profiles/Individuals/hooks/useIndividualsLogic/useIndividualsLogic.tsx @@ -7,7 +7,6 @@ import { useIndividualsProfilesQuery } from '@/domains/profiles/hook/queries/use export const useIndividualsLogic = () => { const [{ search: searchValue, filter, page, pageSize, sortBy, sortDir }] = useZodSearchParams(ProfilesSearchSchema); - const { onPaginate, onPrevPage, onNextPage } = usePagination(); const { data: individualsProfiles, isLoading: isLoadingIndividualsProfiles } = useIndividualsProfilesQuery({ search: searchValue, @@ -17,6 +16,9 @@ export const useIndividualsLogic = () => { sortBy, sortDir, }); + const { onPaginate, onPrevPage, onNextPage, onLastPage } = usePagination({ + totalPages: 0, + }); const isLastPage = (individualsProfiles?.length ?? 0) < pageSize || individualsProfiles?.length === 0; const { search, onSearch } = useSearch({ @@ -29,6 +31,7 @@ export const useIndividualsLogic = () => { onPaginate, onPrevPage, onNextPage, + onLastPage, isLastPage, page, search, diff --git a/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/TransactionMonitoringAlerts.page.tsx b/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/TransactionMonitoringAlerts.page.tsx index 80abe4a497..bb1282b8fc 100644 --- a/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/TransactionMonitoringAlerts.page.tsx +++ b/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/TransactionMonitoringAlerts.page.tsx @@ -16,6 +16,7 @@ export const TransactionMonitoringAlerts = () => { page, onPrevPage, onNextPage, + onLastPage, onPaginate, isLastPage, search, @@ -40,8 +41,10 @@ export const TransactionMonitoringAlerts = () => { page={page} onPrevPage={onPrevPage} onNextPage={onNextPage} + onLastPage={onLastPage} onPaginate={onPaginate} isLastPage={isLastPage} + isLastPageEnabled={false} /> diff --git a/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/hooks/useTransactionMonitoringAlertsLogic/useTransactionMonitoringAlertsLogic.tsx b/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/hooks/useTransactionMonitoringAlertsLogic/useTransactionMonitoringAlertsLogic.tsx index 551988a0a5..6d5499a086 100644 --- a/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/hooks/useTransactionMonitoringAlertsLogic/useTransactionMonitoringAlertsLogic.tsx +++ b/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/hooks/useTransactionMonitoringAlertsLogic/useTransactionMonitoringAlertsLogic.tsx @@ -32,7 +32,9 @@ export const useTransactionMonitoringAlertsLogic = () => { ); const { data: correlationIds } = useAlertCorrelationIdsQuery(); const sortedCorrelationIds = useMemo(() => correlationIds?.slice()?.sort(), [correlationIds]); - const { onPaginate, onPrevPage, onNextPage } = usePagination(); + const { onPaginate, onPrevPage, onNextPage, onLastPage } = usePagination({ + totalPages: 0, + }); const isLastPage = (alerts?.length ?? 0) < pageSize || alerts?.length === 0; const { search, onSearch } = useSearch({ initialSearch: searchValue, @@ -48,6 +50,7 @@ export const useTransactionMonitoringAlertsLogic = () => { pageSize, onPrevPage, onNextPage, + onLastPage, onPaginate, isLastPage, search,