diff --git a/apps/meteor/client/views/omnichannel/directory/contacts/ContactTable.tsx b/apps/meteor/client/views/omnichannel/directory/contacts/ContactTable.tsx index 4f8da207fa4fa..1747400c30e2f 100644 --- a/apps/meteor/client/views/omnichannel/directory/contacts/ContactTable.tsx +++ b/apps/meteor/client/views/omnichannel/directory/contacts/ContactTable.tsx @@ -2,7 +2,6 @@ import { Pagination, States, StatesAction, StatesActions, StatesIcon, StatesTitl import { useDebouncedState, useDebouncedValue, useMutableCallback } from '@rocket.chat/fuselage-hooks'; import { useRoute, useTranslation } from '@rocket.chat/ui-contexts'; import { hashQueryKey } from '@tanstack/react-query'; -import type { ReactElement } from 'react'; import React, { useMemo, useState } from 'react'; import FilterByText from '../../../../components/FilterByText'; @@ -24,19 +23,19 @@ import { parseOutboundPhoneNumber } from '../../../../lib/voip/parseOutboundPhon import { CallDialpadButton } from '../components/CallDialpadButton'; import { useCurrentContacts } from './hooks/useCurrentContacts'; -function ContactTable(): ReactElement { +function ContactTable() { + const t = useTranslation(); + const { current, itemsPerPage, setItemsPerPage, setCurrent, ...paginationProps } = usePagination(); - const { sortBy, sortDirection, setSort } = useSort<'username' | 'phone' | 'name' | 'visitorEmails.address' | 'lastChat.ts'>('username'); + const { sortBy, sortDirection, setSort } = useSort<'name' | 'phone' | 'visitorEmails.address' | 'lastChat.ts'>('name'); const isCallReady = useIsCallReady(); const [term, setTerm] = useDebouncedState('', 500); - const t = useTranslation(); - const query = useDebouncedValue( useMemo( () => ({ - term, + searchText: term, sort: `{ "${sortBy}": ${sortDirection === 'asc' ? 1 : -1} }`, ...(itemsPerPage && { count: itemsPerPage }), ...(current && { offset: current }), @@ -72,9 +71,6 @@ function ContactTable(): ReactElement { const headers = ( <> - - {t('Username')} - {t('Name')} @@ -105,7 +101,7 @@ function ContactTable(): ReactElement { return ( <> - {((isSuccess && data?.visitors.length > 0) || queryHasChanged) && ( + {((isSuccess && data?.contacts.length > 0) || queryHasChanged) && (